Changeset 069a40 in git


Ignore:
Timestamp:
Aug 14, 2014, 4:41:34 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '60097d763e0b541617a3b864b5310c523edaf81d')
Children:
cb19322c6f1f4cdfe1142d33ad69f61d04d0eca4
Parents:
c44ff7585aa24e095211fd1b4268fef9abff0844
Message:
introduce nCopyCoeff for copying coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/walk.cc

    rc44ff75 r069a40  
    24842484  res->ref=0;
    24852485
    2486   res->cf = currRing->cf; currRing->cf->ref++;
     2486  res->cf = nCopyCoeff(currRing->cf);
    24872487
    24882488
     
    25532553  r->ref=0;
    25542554
    2555   r->cf = currRing->cf; currRing->cf->ref++;
     2555  r->cf = nCopyCoeff(currRing->cf);
    25562556
    25572557
  • libpolys/coeffs/coeffs.h

    rc44ff75 r069a40  
    11/*! \file coeffs/coeffs.h Coefficient rings, fields and other domains suitable for Singular polynomials
    2    
     2
    33  The main interface for Singular coefficients: \ref coeffs is the main handler for Singular numbers
    44*/
     
    6161///
    6262/// The main handler for Singular numbers which are suitable for Singular polynomials.
    63 /// 
     63///
    6464/// With it one may implement a ring, a field, a domain etc.
    65 /// 
     65///
    6666struct n_Procs_s;
    6767typedef struct  n_Procs_s  *coeffs;
     
    425425coeffs nInitChar(n_coeffType t, void * parameter);
    426426
     427/// "copy" coeffs, i.e. increment ref
     428static inline coeffs nCopyCoeff(const coeffs cf) { cf->ref++; return cf;}
     429
    427430/// undo all initialisations
    428431void nKillChar(coeffs r);
  • libpolys/polys/monomials/ring.cc

    rc44ff75 r069a40  
    731731  if (r1->cf==r2->cf)
    732732  {
    733     tmpR.cf=r1->cf;
    734     r1->cf->ref++;
     733    tmpR.cf=nCopyCoeff(r1->cf);
    735734  }
    736735  else /* different type */
     
    740739      if (getCoeffType(r2->cf)==n_Q)
    741740      {
    742         tmpR.cf=r1->cf;
    743         r1->cf->ref++;
     741        tmpR.cf=nCopyCoeff(r1->cf);
    744742      }
    745743      else if (nCoeff_is_Extension(r2->cf) && rChar(r2) == rChar(r1))
     
    748746        extParam.r = r2->cf->extRing;
    749747        extParam.i = r2->cf->extRing->qideal;*/
    750         tmpR.cf=r2->cf;
    751         r2->cf->ref++;
     748        tmpR.cf=nCopyCoeff(r2->cf);
    752749      }
    753750      else
     
    766763      if (getCoeffType(r2->cf)==n_Zp)
    767764      {
    768         tmpR.cf=r2->cf;
    769         r2->cf->ref++;
     765        tmpR.cf=nCopyCoeff(r2->cf);
    770766      }
    771767      else if (nCoeff_is_Extension(r2->cf))
    772768      {
    773         tmpR.cf=r2->cf;
    774         r2->cf->ref++;
     769        tmpR.cf=nCopyCoeff(r2->cf);
    775770      }
    776771      else
     
    784779      if (r1->cf->extRing->cf==r2->cf)
    785780      {
    786         tmpR.cf=r1->cf;
    787         r1->cf->ref++;
     781        tmpR.cf=nCopyCoeff(r1->cf);
    788782      }
    789783      else if (getCoeffType(r1->cf->extRing->cf)==n_Zp && getCoeffType(r2->cf)==n_Q) //r2->cf == n_Zp should have been handled above
    790784      {
    791         tmpR.cf=r1->cf;
    792         r1->cf->ref++;
     785        tmpR.cf=nCopyCoeff(r1->cf);
    793786      }
    794787      else
     
    13071300  //struct omBin   PolyBin; /* Bin from where monoms are allocated */
    13081301  //memset: res->PolyBin=NULL; // rComplete
    1309   res->cf=r->cf;     /* coeffs */
    1310   res->cf->ref++;
     1302  res->cf=nCopyCoeff(r->cf);     /* coeffs */
    13111303
    13121304  //memset: res->ref=0; /* reference counter to the ring */
     
    14501442  //struct omBin   PolyBin; /* Bin from where monoms are allocated */
    14511443  //memset: res->PolyBin=NULL; // rComplete
    1452   res->cf=r->cf;     /* coeffs */
    1453   res->cf->ref++;
     1444  res->cf=nCopyCoeff(r->cf);     /* coeffs */
    14541445
    14551446  //memset: res->ref=0; /* reference counter to the ring */
     
    27242715  res->block1=block1;
    27252716  res->bitmask=exp_limit;
    2726   int tmpref=r->cf->ref;
     2717  //int tmpref=r->cf->ref0;
    27272718  rComplete(res, 1);
    2728   r->cf->ref=tmpref;
     2719  //r->cf->ref=tmpref;
    27292720
    27302721  // adjust res->pFDeg: if it was changed globally, then
     
    28372828  res->OrdSgn    = 1;
    28382829
    2839   int tmpref=r->cf->ref;
     2830  //int tmpref=r->cf->ref;
    28402831  rComplete(res, 1);
    2841   r->cf->ref=tmpref;
     2832  //r->cf->ref=tmpref;
    28422833#ifdef HAVE_PLURAL
    28432834  if (rIsPluralRing(r))
     
    28972888    res->block1=block1;
    28982889    res->bitmask=exp_limit;
    2899     int tmpref=r->cf->ref;
     2890    //int tmpref=r->cf->ref;
    29002891    rComplete(res, 1);
    2901     r->cf->ref=tmpref;
     2892    //r->cf->ref=tmpref;
    29022893
    29032894#ifdef HAVE_PLURAL
Note: See TracChangeset for help on using the changeset viewer.