Changeset a539ad in git for kernel/kspoly.cc


Ignore:
Timestamp:
Feb 6, 2008, 10:12:47 AM (16 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
8f2bd1fc11ce18b5be7a734f75309011e212a4d3
Parents:
4dcfc0f02d5040e014133baff89ccfc1bbc383ed
Message:
kspoly.cc:
ksCreateShortSpoly: Speicher freigeben

kstd1.cc:
updateL: Speicher freigeben

kstd2.cc:
redRing2toM: Speicher freigeben
bba: Speicher freigeben
pLmFree(strat->P.lcm); moved down on level, please check

kutil.cc:
deleteInL: Speicher freigeben
eigene Routinen: Speicher freigeben

polys1.cc:
pContent: Speicher freigeben

rintegers.cc, rmodulon.cc: nNeg ist inplace Operation


git-svn-id: file:///usr/local/Singular/svn/trunk@10562 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kspoly.cc

    r4dcfc0f ra539ad  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.12 2008-02-01 15:11:33 wienand Exp $ */
     4/* $Id: kspoly.cc,v 1.13 2008-02-06 09:12:45 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    346346  Exponent_t c;
    347347  poly m1,m2;
    348   number t1,t2;
     348  number t1 = NULL,t2 = NULL;
    349349  int cm,i;
    350350  BOOLEAN equal;
     
    352352#ifdef HAVE_RINGS
    353353  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
    354   int ct = ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors
    355354  if (rField_is_Ring(currRing))
    356355  {
     356    ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors
    357357    if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
    358358    if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     
    360360    {
    361361      pIter(a1);
     362      nDelete(&t2);
    362363      if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
    363364    }
     
    365366    {
    366367      pIter(a2);
     368      nDelete(&t1);
    367369      if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
    368370    }
     
    399401#ifdef HAVE_RINGS
    400402      if (rField_is_Ring(currRing))
     403      {
     404          nDelete(&lc1);
     405          nDelete(&lc2);
     406          nDelete(&t2);
    401407          pSetCoeff0(m2, t1);
     408      }
    402409      else
    403410#endif
     
    406413    }
    407414    else
     415    {
     416#ifdef HAVE_RINGS
     417    if (rField_is_Ring(currRing))
     418    {
     419      nDelete(&lc1);
     420      nDelete(&lc2);
     421      nDelete(&t1);
     422      nDelete(&t2);
     423    }
     424#endif
    408425      return NULL;
     426    }
    409427  }
    410428  if (a2==NULL)
     
    434452    p_Setm(m1, currRing);
    435453#ifdef HAVE_RINGS
    436       if (rField_is_Ring(currRing))
    437         pSetCoeff0(m1, t2);
     454    if (rField_is_Ring(currRing))
     455    {
     456      pSetCoeff0(m1, t2);
     457      nDelete(&lc1);
     458      nDelete(&lc2);
     459      nDelete(&t1);
     460    }
    438461    else
    439462#endif
     
    487510#ifdef HAVE_RINGS
    488511        if (rField_is_Ring(currRing))
     512        {
    489513          pSetCoeff0(m1, t2);
     514          nDelete(&lc1);
     515          nDelete(&lc2);
     516          nDelete(&t1);
     517        }
    490518        else
    491519#endif
     
    498526#ifdef HAVE_RINGS
    499527        if (rField_is_Ring(currRing))
    500             pSetCoeff0(m2, t1);
     528        {
     529          pSetCoeff0(m2, t1);
     530          nDelete(&lc1);
     531          nDelete(&lc2);
     532          nDelete(&t2);
     533        }
    501534        else
    502535#endif
     
    508541    if (rField_is_Ring(currRing))
    509542    {
    510       t1 = nSub(t1, t2);
    511       equal = nIsZero(t1);
    512       nDelete(&t2);
     543      equal = nEqual(t1,t2);
    513544    }
    514545    else
     
    526557#ifdef HAVE_RINGS
    527558      if (rField_is_Ring(currRing))
    528           pSetCoeff0(m1, t1);
     559      {
     560          pSetCoeff0(m1, nSub(t1, t2));
     561          nDelete(&lc1);
     562          nDelete(&lc2);
     563          nDelete(&t1);
     564          nDelete(&t2);
     565      }
    529566      else
    530567#endif
     
    537574    if (rField_is_Ring(currRing))
    538575    {
    539       nDelete(&t1);
    540       if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
    541       if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     576      if (a2 != NULL)
     577      {
     578        nDelete(&t1);
     579        t1 = nMult(pGetCoeff(a2),lc1);
     580      }
     581      if (a1 != NULL)
     582      {
     583        nDelete(&t2);
     584        t2 = nMult(pGetCoeff(a1),lc2);
     585      }
    542586      while (a1 != NULL && nIsZero(t2))
    543587      {
    544588        pIter(a1);
    545         if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     589        if (a1 != NULL)
     590        {
     591          nDelete(&t2);
     592          t2 = nMult(pGetCoeff(a1),lc2);
     593        }
    546594      }
    547595      while (a2 != NULL && nIsZero(t1))
    548596      {
    549597        pIter(a2);
    550         if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     598        if (a2 != NULL)
     599        {
     600          nDelete(&t1);
     601          t1 = nMult(pGetCoeff(a2),lc1);
     602        }
    551603      }
    552604    }
     
    557609      if (a1==NULL)
    558610      {
     611#ifdef HAVE_RINGS
     612        if (rField_is_Ring(currRing))
     613        {
     614          nDelete(&lc1);
     615          nDelete(&lc2);
     616          nDelete(&t1);
     617          nDelete(&t2);
     618        }
     619#endif
    559620        p_LmFree(m1,currRing);
    560621        return NULL;
Note: See TracChangeset for help on using the changeset viewer.