Changeset 0a8ee5 in git


Ignore:
Timestamp:
Mar 19, 2010, 3:38:41 PM (13 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
2937222b4a61df047ac996df75f1a6bfe245af2c
Parents:
18871b8b1489681d13f6dadcbc2940b541da2be2
Message:
sca-std optimization

git-svn-id: file:///usr/local/Singular/svn/trunk@12655 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/gring.cc

    r18871b r0a8ee5  
    19541954  // b will not be multiplied by any constant in this impl.
    19551955  // ==> *c=1
    1956   *c=nInit(1);
     1956  if (c!=NULL) *c=nInit(1);
    19571957  poly m=pOne();
    19581958  pExpVectorDiff(m,kBucketGetLm(b),p);
     
    19651965  pDelete(&m);
    19661966  number n=nCopy(pGetCoeff(pp));
    1967   number MinusOne=nInit(-1);
    19681967  number nn;
    1969   if (!nEqual(n,MinusOne))
     1968  if (!n_IsMOne(n,currRing))
    19701969  {
    19711970    nn=nNeg(nInvers(n));
     
    19771976  pp=p_Mult_nn(pp,n,currRing);
    19781977  nDelete(&n);
    1979   nDelete(&MinusOne);
    19801978  int l=pLength(pp);
    19811979  kBucket_Add_q(b,pp,&l);
     
    20011999  // b will not be multiplied by any constant in this impl.
    20022000  // ==> *c=1
    2003   *c=nInit(1);
     2001  if (c!=NULL) *c=nInit(1);
    20042002  poly m = pOne();
    20052003  const poly pLmB = kBucketGetLm(b); // no new copy!
     
    20302028  assume( pp != NULL );
    20312029  const number n = pGetCoeff(pp); // bug!
    2032   number nn;
    20332030
    20342031  if (!n_IsMOne(n,currRing) ) // does this improve performance??!? also see below... // TODO: check later on.
    2035   {
    2036     nn=nNeg(nInvers(nCopy(n)));
    2037   }
    2038   else nn=nInit(1);           // if n == -1 => nn = 1 and -1/n otherwise
    2039 
    2040   number t = nMult(nn,pGetCoeff(pLmB));
    2041   nDelete(&nn);
    2042 
    2043   pp = p_Mult_nn(pp,t,currRing);
    2044   nDelete(&t);
     2032  // if n == -1 => nn = 1 and -1/n
     2033  {
     2034    number nn=nNeg(nInvers(n));
     2035    number t = nMult(nn,pGetCoeff(pLmB));
     2036    nDelete(&nn);
     2037    pp = p_Mult_nn(pp,t,currRing);
     2038    nDelete(&t);
     2039  }
     2040  else
     2041  {
     2042    pp = p_Mult_nn(pp,pGetCoeff(pLmB),currRing);
     2043  }
    20452044
    20462045  int l = pLength(pp);
     
    20632062{
    20642063  // b is multiplied by a constant in this impl.
     2064  number ctmp;
    20652065  poly m=pOne();
    20662066  pExpVectorDiff(m,kBucketGetLm(b),p);
     
    20692069  pTest(m);
    20702070#endif
    2071   if(p_IsConstant(m,currRing)){
     2071  if(p_IsConstant(m,currRing))
     2072  {
    20722073    pDelete(&m);
    2073     *c = kBucketPolyRed(b,p,pLength(p),NULL);
    2074     return;
    2075   }
    2076   poly pp = nc_mm_Mult_pp(m,p,currRing);
    2077   number c2,cc;
    2078   pCleardenom_n(pp,c2);
    2079   pDelete(&m);
    2080   *c = kBucketPolyRed(b,pp,pLength(pp),NULL);
    2081   //cc=*c;
    2082   //*c=nMult(*c,c2);
    2083   nDelete(&c2);
    2084   //nDelete(&cc);
    2085   pDelete(&pp);
    2086 
     2074    ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
     2075  }
     2076  else
     2077  {
     2078    poly pp = nc_mm_Mult_pp(m,p,currRing);
     2079    number c2,cc;
     2080    pCleardenom_n(pp,c2);
     2081    pDelete(&m);
     2082    ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
     2083    //cc=*c;
     2084    //*c=nMult(*c,c2);
     2085    nDelete(&c2);
     2086    //nDelete(&cc);
     2087    pDelete(&pp);
     2088  }
     2089  if (c!=NULL) *c=ctmp;
     2090  else nDelete(&ctmp);
    20872091}
    20882092
     
    20902094{
    20912095  // b is multiplied by a constant in this impl.
     2096  number ctmp;
    20922097  poly m=pOne();
    20932098  pExpVectorDiff(m,kBucketGetLm(b),p);
     
    21002105  {
    21012106    pDelete(&m);
    2102     *c = kBucketPolyRed(b,p,pLength(p),NULL);
    2103     return;
    2104   }
    2105   poly pp = nc_mm_Mult_pp(m,p,currRing);
    2106   number c2,cc;
    2107   pCleardenom_n(pp,c2);
    2108   pDelete(&m);
    2109   *c = kBucketPolyRed(b,pp,pLength(pp),NULL);
    2110   //cc=*c;
    2111   //*c=nMult(*c,c2);
    2112   nDelete(&c2);
    2113   //nDelete(&cc);
    2114   pDelete(&pp);
    2115 
     2107    ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
     2108  }
     2109  else
     2110  {
     2111    poly pp = nc_mm_Mult_pp(m,p,currRing);
     2112    number c2,cc;
     2113    pCleardenom_n(pp,c2);
     2114    pDelete(&m);
     2115    ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
     2116    //cc=*c;
     2117    //*c=nMult(*c,c2);
     2118    nDelete(&c2);
     2119    //nDelete(&cc);
     2120    pDelete(&pp);
     2121  }
     2122  if (c!=NULL) *c=ctmp;
     2123  else nDelete(&ctmp);
    21162124}
    21172125
     
    21692177  // b will not by multiplied by any constant in this impl.
    21702178  // ==> *c=1
    2171   *c=nInit(1);
     2179  if (c!=NULL) *c=nInit(1);
    21722180
    21732181  poly pp = NULL;
  • kernel/kspoly.cc

    r18871b r0a8ee5  
    7676    // no exp-bound checking needed
    7777    // (only needed if exp-bound(tailring)<exp-b(currRing))
    78     number c;
    79     if (PR->bucket!=NULL)  nc_kBucketPolyRed(PR->bucket, p2,&c);
     78    if (PR->bucket!=NULL)  nc_kBucketPolyRed(PR->bucket, p2,coef);
    8079    else
    8180    {
    8281      poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
    8382      assume(_p != NULL);
    84       nc_PolyPolyRed(_p, p2,&c);
     83      nc_PolyPolyRed(_p, p2,coef);
    8584      if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
    86       PR->pLength=pLength(_p);
    87     }
    88     if (coef!=NULL) *coef=c;
    89     else nDelete(&c);
     85      PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
     86    }
    9087    return 0;
    9188  }
  • kernel/sca.cc

    r18871b r0a8ee5  
    312312          return NULL;
    313313        }
    314 
    315314        tpower ^= cpower; // compute degree of (-1).
    316315      }
    317 
    318316      cpower ^= iExp1;
    319317    }
     
    606604#endif
    607605
    608   if( ( pPoly == NULL ) || ( pMonom == NULL ) )
    609     return NULL;
     606  assume( (pPoly != NULL) && (pMonom !=NULL));
    610607
    611608  const int iComponentMonomM = p_GetComp(pMonom, rRing);
     
    20452042  /* complete reduction of the standard basis--------- */
    20462043
    2047   if (TEST_OPT_REDSB){
     2044  if (TEST_OPT_REDSB)
     2045  {
    20482046    completeReduce(strat);
    20492047  }
Note: See TracChangeset for help on using the changeset viewer.