Changeset f70f641 in git


Ignore:
Timestamp:
Apr 27, 2011, 10:22:46 AM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
b7d7eb00647832d8b7ba2d7f853accc84ba835b5
Parents:
b27c0524d725542db31ecb0c95c603a31a1d1faa
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-04-27 10:22:46+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:29+01:00
Message:
- rSum, rCopy0: uses now coeffs
- some unused variables removed in templates
Location:
libpolys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/numbers.h

    rb27c052 rf70f641  
    7272/// Test whether a is a zero divisor in r
    7373/// i.e. not coprime with char. of r
     74/// very inefficient implementation:
     75/// should ONLY be used for debug stuff /tests
    7476BOOLEAN n_IsZeroDivisor( number a, const coeffs r);
    7577
  • libpolys/polys/monomials/ring.cc

    rb27c052 rf70f641  
    171171}
    172172ring   rDefault(coeffs cf, int N, char **n)
    173 { 
     173{
    174174  assume( cf != NULL);
    175175  /*order: lp,0*/
     
    314314    }
    315315  }
    316 #endif 
     316#endif
    317317  Print("//   number of vars : %d",r->N);
    318318
     
    420420//          iiWriteMatrix((matrix)Q,"scaQ",1);
    421421//        }
    422 //        else 
     422//        else
    423423            PrintS(" ...");
    424424      }
     
    739739{
    740740  TODO(Somabody, move this proc. over to coeffs!?);
    741  
     741
    742742#ifdef HAVE_RINGS
    743743  if (rField_is_Ring_2toM(r))
     
    748748    return binaryPower((int)mpz_get_ui(r->cf->modBase),
    749749                       (int)(unsigned long)r->cf->modExponent);
    750  
     750
    751751#endif
    752752  if (rField_is_numeric(r))
     
    776776{
    777777  r = rCopy(r);
    778   if (rIsPluralRing(r)) 
     778  if (rIsPluralRing(r))
    779779    return r;
    780780
     
    815815  else /* different type */
    816816  {
    817     if (r1->cf->ch<-1) /* Z/p(a) */
    818     {
    819       if ((r2->cf->ch==0) /* Q */
    820           || (r2->cf->ch==-r1->cf->ch)) /* Z/p */
    821       {
    822         tmpR.cf->ch=r1->cf->ch;
    823         tmpR.cf->P=rPar(r1);
    824         tmpR.cf->parameter=(char **)omAlloc(rPar(r1)*sizeof(char *));
    825         int i;
    826         for (i=0;i<rPar(r1);i++)
    827         {
    828           tmpR.cf->parameter[i]=omStrDup(r1->cf->parameter[i]);
    829         }
    830         if (r1->cf->minpoly!=NULL)
    831         {
    832           tmpR.cf->minpoly=n_Copy(r1->cf->minpoly, r1->cf);
    833         }
    834       }
    835       else  /* R, Q(a),Z/q,Z/p(a),GF(p,n) */
    836       {
    837         WerrorS("Z/p(a)+(R,Q(a),Z/q(a),GF(q,n))");
     817    if (getCoeffType(r1->cf)==n_Zp)
     818    {
     819      if (getCoeffType(r2->cf)==n_Q)
     820      {
     821        tmpR.cf=r1->cf;
     822        r1->cf->ref++;
     823      }
     824      else
     825      {
     826        WerrorS("Z/p+...");
    838827        return -1;
    839828      }
    840829    }
    841     else if (r1->cf->ch==-1) /* R */
     830    else if (getCoeffType(r1->cf)==n_R)
    842831    {
    843832      WerrorS("R+..");
    844833      return -1;
    845834    }
    846     else if (r1->cf->ch==0) /* Q */
    847     {
    848       if ((r2->cf->ch<-1)||(r2->cf->ch==1)) /* Z/p(a),Q(a) */
    849       {
    850         tmpR.cf->ch=r2->cf->ch;
    851         tmpR.cf->P=rPar(r2);
    852         tmpR.cf->parameter=(char **)omAlloc(rPar(r2)*sizeof(char *));
    853         int i;
    854         for (i=0;i<rPar(r2);i++)
    855         {
    856           tmpR.cf->parameter[i]=omStrDup(r2->cf->parameter[i]);
    857         }
    858         if (r2->cf->minpoly!=NULL)
    859         {
    860           tmpR.cf->minpoly=n_Copy(r2->cf->minpoly, r2->cf);
    861         }
    862       }
    863       else if (r2->cf->ch>1) /* Z/p,GF(p,n) */
    864       {
    865         tmpR.cf->ch=r2->cf->ch;
    866         if (r2->cf->parameter!=NULL)
    867         {
    868           tmpR.cf->parameter=(char_ptr *)omAllocBin(char_ptr_bin);
    869           tmpR.cf->P=1;
    870           tmpR.cf->parameter[0]=omStrDup(r2->cf->parameter[0]);
    871         }
     835    else if (getCoeffType(r1->cf)==n_Q)
     836    {
     837      if (getCoeffType(r2->cf)==n_Zp)
     838      {
     839        tmpR.cf=r2->cf;
     840        r2->cf->ref++;
    872841      }
    873842      else
    874843      {
    875         WerrorS("Q+R");
    876         return -1; /* R */
    877       }
    878     }
    879     else if (r1->cf->ch==1) /* Q(a) */
    880     {
    881       if (r2->cf->ch==0) /* Q */
    882       {
    883         tmpR.cf->ch=r1->cf->ch;
    884         tmpR.cf->P=rPar(r1);
    885         tmpR.cf->parameter=(char **)omAlloc(rPar(r1)*sizeof(char *));
    886         int i;
    887         for(i=0;i<rPar(r1);i++)
    888         {
    889           tmpR.cf->parameter[i]=omStrDup(r1->cf->parameter[i]);
    890         }
    891         if (r1->cf->minpoly!=NULL)
    892         {
    893           tmpR.cf->minpoly=n_Copy(r1->cf->minpoly, r1->cf);
    894         }
    895       }
    896       else  /* R, Z/p,GF(p,n) */
    897       {
    898         WerrorS("Q(a)+(R,Z/p,GF(p,n))");
     844        WerrorS("Q+...");
    899845        return -1;
    900846      }
    901847    }
    902     else /* r1->cf->ch >=2 , Z/p */
    903     {
    904       if (r2->cf->ch==0) /* Q */
    905       {
    906         tmpR.cf->ch=r1->cf->ch;
    907       }
    908       else if (r2->cf->ch==-r1->cf->ch) /* Z/p(a) */
    909       {
    910         tmpR.cf->ch=r2->cf->ch;
    911         tmpR.cf->P=rPar(r2);
    912         tmpR.cf->parameter=(char **)omAlloc(rPar(r2)*sizeof(char *));
    913         int i;
    914         for(i=0;i<rPar(r2);i++)
    915         {
    916           tmpR.cf->parameter[i]=omStrDup(r2->cf->parameter[i]);
    917         }
    918         if (r2->cf->minpoly!=NULL)
    919         {
    920           tmpR.cf->minpoly=n_Copy(r2->cf->minpoly, r2->cf);
    921         }
    922       }
    923       else
    924       {
    925         WerrorS("Z/p+(GF(q,n),Z/q(a),R,Q(a))");
    926         return -1; /* GF(p,n),Z/q(a),R,Q(a) */
    927       }
     848    else
     849    {
     850      WerrorS("coeff sum not yet implemented");
     851      return -1;
    928852    }
    929853  }
     
    13491273    for (int for_i=0;for_i<IDELEMS(r1->qideal);for_i++)
    13501274      Q1->m[for_i] = p_PermPoly(
    1351                                 r1->qideal->m[for_i], perm1,
    1352                                 r1, sum,
    1353                                 nMap1,
    1354                                 par_perm1, rPar(r1));
    1355    
     1275                                r1->qideal->m[for_i], perm1,
     1276                                r1, sum,
     1277                                nMap1,
     1278                                par_perm1, rPar(r1));
     1279
    13561280    omFree((ADDRESS)perm1);
    13571281  }
     
    13691293    nMapFunc nMap2 = n_SetMap(r2->cf,sum->cf);
    13701294    Q2 = idInit(IDELEMS(r2->qideal),1);
    1371      
     1295
    13721296    for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++)
    1373       Q2->m[for_i] = p_PermPoly( 
    1374                   r2->qideal->m[for_i], perm2,
    1375                   r2, sum,
    1376                   nMap2,
    1377                   par_perm2, rPar(r2));
    1378    
     1297      Q2->m[for_i] = p_PermPoly(
     1298                  r2->qideal->m[for_i], perm2,
     1299                  r2, sum,
     1300                  nMap2,
     1301                  par_perm2, rPar(r2));
     1302
    13791303    omFree((ADDRESS)perm2);
    13801304  }
     
    14171341ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
    14181342{
    1419   TODO(Hans, "Please consider the change to '->cf'...");
    1420  
    14211343  if (r == NULL) return NULL;
    14221344  int i,j;
     
    14351357  //struct omBin   PolyBin; /* Bin from where monoms are allocated */
    14361358  //memset: res->PolyBin=NULL; // rComplete
    1437   res->cf->ch=r->cf->ch;     /* characteristic */
    1438 #ifdef HAVE_RINGS
    1439   res->cf->ringtype = r->cf->ringtype;  // cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m
    1440   if (r->cf->modBase!=NULL)
    1441   {
    1442     res->cf->modBase = (int_number) omAlloc(sizeof(mpz_t));
    1443     mpz_init_set(res->cf->modBase,r->cf->modBase);
    1444   }
    1445   res->cf->modExponent=r->cf->modExponent;
    1446   if (r->cf->modNumber!=NULL)
    1447   {
    1448     res->cf->modNumber = (int_number) omAlloc(sizeof(mpz_t));
    1449     mpz_init_set(res->cf->modNumber,r->cf->modNumber);
    1450   }
    1451 #endif
     1359  res->cf=r->cf;     /* coeffs */
     1360  res->cf->ref++;
     1361
    14521362  //memset: res->ref=0; /* reference counter to the ring */
    14531363
     
    14561366
    14571367  res->N=rVar(r);      /* number of vars */
    1458   res->cf->P=rPar(r);      /* number of pars */
    14591368  res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */
    14601369
     
    15041413  //memset: res->cf=NULL;
    15051414  res->options=r->options;
    1506 #ifdef HAVE_RINGS
    1507   res->cf->ringtype=r->cf->ringtype;
    1508 #endif
    15091415  //
    15101416  if (r->algring!=NULL)
     
    15121418  res->algring=r->algring;
    15131419  //memset: res->minideal=NULL;
    1514   if (r->cf->parameter!=NULL)
    1515   {
    1516     if (r->cf->minpoly!=NULL) res->cf->minpoly=n_Copy(r->cf->minpoly,r->cf);
    1517     int l=rPar(r);
    1518     res->cf->parameter=(char **)omAlloc(l*sizeof(char *));
    1519     int i;
    1520     for(i=0;i<rPar(r);i++)
    1521     {
    1522       res->cf->parameter[i]=omStrDup(r->cf->parameter[i]);
    1523     }
    1524     if (r->minideal!=NULL)
    1525     {
    1526       res->minideal=id_Copy(r->minideal,r->algring);
    1527     }
    1528   }
    15291420  if (copy_ordering == TRUE)
    15301421  {
     
    17941685  if (blocks == 1) return TRUE;
    17951686
    1796   int s = 0; 
     1687  int s = 0;
    17971688  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
    17981689  {
     
    18041695
    18051696  assume( blocks == s + 2 );
    1806  
     1697
    18071698  if (
    18081699     (r->order[s] != ringorder_c)
     
    18691760  if (blocks == 1) return TRUE;
    18701761
    1871   int s = 0; 
     1762  int s = 0;
    18721763  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
    18731764  {
     
    18771768
    18781769  if ((blocks - s) > 3)  return FALSE;
    1879  
     1770
    18801771//  if ((blocks > 3) || (blocks < 2)) return FALSE;
    18811772  if ((blocks - s) == 3)
     
    27822673          ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
    27832674          assume(
    2784             rSetISReference( res, 
     2675            rSetISReference( res,
    27852676              F,  // WILL BE COPIED!
    27862677              r->typ[i].data.is.limit,
     
    31523043      ||(
    31533044    ((order[1]==ringorder_c)||(order[1]==ringorder_C)
    3154      ||(order[1]==ringorder_S) 
     3045     ||(order[1]==ringorder_S)
    31553046     ||(order[1]==ringorder_s))
    31563047    && (order[0]!=ringorder_M)
     
    32433134    r->pFDeg = p_WTotaldegree; // may be improved: p_Totaldegree for lp/dp/ls/.. blocks
    32443135  }
    3245  
     3136
    32463137  if (rOrd_is_Totaldegree_Ordering(r) || rOrd_is_WeightedDegree_Ordering(r))
    32473138    r->pFDeg = p_Deg;
     
    40523943#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
    40533944    Print("\npFDeg   : ");
    4054    
     3945
    40553946    pFDeg_CASE(p_Totaldegree); else
    40563947      pFDeg_CASE(p_WFirstTotalDegree); else
     
    40583949      pFDeg_CASE(p_Deg); else
    40593950      Print("(%p)", r->pFDeg); // default case
    4060    
     3951
    40613952    PrintS("\n");
    40623953#undef pFDeg_CASE
    40633954  }
    4064    
     3955
    40653956}
    40663957
     
    41914082{
    41924083  assume(r->typ[1].ord_typ == ro_syzcomp);
    4193      
     4084
    41944085  r->typ[1].data.syzcomp.length = length;
    41954086  rNChangeSComps( currComponents, currShiftedComponents, r);
     
    42014092{
    42024093  assume(r->typ[1].ord_typ == ro_syzcomp);
    4203  
     4094
    42044095  *length = r->typ[1].data.syzcomp.length;
    42054096  rNGetSComps( currComponents, currShiftedComponents, r);
     
    54415332  /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
    54425333
    5443   id_Test((ideal)C, dest); 
     5334  id_Test((ideal)C, dest);
    54445335  id_Test((ideal)D, dest);
    54455336
Note: See TracChangeset for help on using the changeset viewer.