40 #define BITS_PER_LONG 8*SIZEOF_LONG 79 return ringorder_name[ord];
110 r->names = (
char **)
omAlloc0(N *
sizeof(
char *));
118 r->wvhdl = (
int **)
omAlloc0((ord_size+1) *
sizeof(
int *));
124 r->bitmask = bitmask;
136 return rDefault(cf,N,n,ord_size,ord,block0,block1,wvhdl);
143 int *block0 = (
int *)
omAlloc0(2 *
sizeof(
int));
144 int *block1 = (
int *)
omAlloc0(2 *
sizeof(
int));
152 return rDefault(cf,N,n,2,order,block0,block1);
179 WerrorS(
"weights only for orderings wp,ws,Wp,Ws,a,M");
188 int sz = (int)
sqrt((
double)(order->
length()-2));
189 if ((sz*sz)!=(order->
length()-2))
191 WerrorS(
"Matrix order is not a square matrix");
194 while ((i<sz) && (typ==1))
197 while ((
j<sz) && ((*order)[
j*sz+i+2]==0))
j++;
201 WerrorS(
"Matrix order not complete");
203 else if ((*order)[
j*sz+i+2]<0)
216 for (
int i=0;
i<
N;
i++)
218 if (names[
i]==
NULL)
return -1;
219 if (strcmp(n,names[
i]) == 0)
return (
int)
i;
247 PrintS(
"// coefficients: ");
259 R->ShortOut = bSaveShortOut;
302 Print(
"// number of vars : %d",r->N);
307 for (
int l=0, nlen=0 ;
l<nblocks;
l++)
310 Print(
"\n// block %3d : ",
l+1);
317 assume( r->block0[
l] == r->block1[
l] );
318 const int s = r->block0[
l];
319 assume( (-2 < s) && (s < 2) );
326 Print(
" syz_comp: %d",r->block0[
l]);
338 for (i = r->block0[
l]-1; i<r->block1[
l]; i++)
340 nlen = strlen(r->names[i]);
341 Print(
" %s",r->names[i]);
345 if (r->wvhdl[
l]!=
NULL)
356 Warn(
"should not have wvhdl entry at pos. %d",
l);
360 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
363 PrintS(
"\n// : weights ");
364 for (i = 0; i<=r->block1[
l]-r->block0[
l]; i++)
370 Print(
"%*lld " ,nlen,w[i+
j]);
372 Print(
" %*ld" ,nlen,w[i+
j]);
376 Print(
" %*d" ,nlen,r->wvhdl[
l][i+
j]);
382 int m=r->wvhdl[
l][
i];
383 Print(
"\n// : %d module weights ",m);
385 for(;i<=
m;i++)
Print(
" %*d" ,nlen,r->wvhdl[
l][i]);
392 PrintS(
"\n// noncommutative relations:");
398 for (i = 1; i<r->N; i++)
400 for (j = i+1; j<=r->N; j++)
405 Print(
"\n// %s%s=",r->names[j-1],r->names[i-1]);
416 Print(
"\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
421 PrintS(
"\n// quotient of sca by ideal");
434 Print(
"\n// letterplace ring (block size %d)",r->isLPring);
439 PrintS(
"\n// quotient ring from ideal");
452 if (r ==
NULL)
return;
459 if( r->qideal !=
NULL )
474 if (r->order !=
NULL)
485 if (r->wvhdl[j]!=
NULL)
498 for (i=0; i<r->N; i++)
517 if (order==0)
Werror(
"wrong ring order `%s`",ordername);
527 for (nblocks=0; r->order[nblocks]; nblocks++);
546 if (r->wvhdl[l]!=
NULL)
557 Warn(
"should not have wvhdl entry at pos. %d",l);
565 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[l]-r->block0[l]+1);
572 for (i = 0; i<r->block1[
l]-r->block0[
l]; i++)
581 for (i = 0; i<r->block1[
l]-r->block0[
l]; i++)
591 if (
j+i+1==(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1))
602 assume( r->block0[l] == r->block1[l] );
603 const int s = r->block0[
l];
604 assume( (-2 < s) && (s < 2) );
611 if (r->bitmask!=0xffff)
630 for (i=0; i<r->N; i++)
632 l+=strlen(r->names[i])+1;
636 for (i=0; i<r->N-1; i++)
638 strcat(s,r->names[i]);
641 strcat(s,r->names[i]);
653 char const *
const *
const params =
rParameter(r);
658 for (i=0; i<
rPar(r); i++)
660 l+=strlen(params[i])+1;
664 for (i=0; i<
rPar(r)-1; i++)
666 strcat(s, params[i]);
669 strcat(s, params[i]);
680 char *
res=(
char *)
omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
681 sprintf(res,
"(%s),(%s),(%s)",ch,var,ord);
713 int rChar(ring r) {
return r->cf->ch; }
728 for(
int i=1;
i<r->N;
i++)
729 for(
int j=
i+1;
j<=r->N;
j++)
733 WarnS(
"Error initializing multiplication!");
753 memset(&tmpR,0,
sizeof(tmpR));
788 && (mpz_cmp(r1->cf->modNumber,r2->cf->extRing->cf->modNumber)==0))
821 if (r1->cf->extRing->cf==r2->cf)
831 WerrorS (
"coeff sum of two extension fields not implemented");
837 WerrorS(
"coeff sum not yet implemented");
844 char **names=(
char **)
omAlloc0(l*
sizeof(
char *));
849 for (i=0;i<r1->N;i++)
853 if (*(r1->names[i]) ==
'\0')
859 for(j=0;j<
rPar(r2);j++)
861 if (strcmp(r1->names[i],
rParameter(r2)[j])==0)
885 if (*(r2->names[i]) ==
'\0')
891 for(j=0;j<
rPar(r1);j++)
893 if (strcmp(r2->names[i],
rParameter(r1)[j])==0)
908 if (strcmp(r1->names[j],r2->names[i])==0)
954 for(
int i=0;i<
rVar(r1);i++) tmpR.
wvhdl[0][i]=1;
977 if ((r2->block0[0]==1)
978 && (r2->block1[0]==
rVar(r2))
984 tmpR.
order[1]=r2->order[0];
985 if (r2->wvhdl[0]!=
NULL)
1051 if (rb->wvhdl[i]!=
NULL)
1052 WarnS(
"rSum: weights not implemented");
1058 for (i=0;r1->order[
i]!=0;i++)
1063 if (r1->wvhdl[i]!=
NULL)
1072 tmpR.
order[b-2]=r1->order[
i];
1074 for (i=0;r2->order[
i]!=0;i++)
1082 if (r2->wvhdl[i]!=
NULL)
1089 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1093 else if ((k==
rVar(r1)) && (k==
rVar(r2)))
1109 if (r1->wvhdl[i]!=
NULL)
1120 Werror(
"variables must not overlap (# of vars: %d,%d -> %d)",
rVar(r1),
rVar(r2),k);
1126 memcpy(sum,&tmpR,
sizeof(
ip_sring));
1143 if ( (R1_is_nc) || (R2_is_nc))
1167 int *perm1 = (
int *)
omAlloc0((
rVar(R1)+1)*
sizeof(int));
1168 int *par_perm1 =
NULL;
1171 int *perm2 = (
int *)
omAlloc0((
rVar(R2)+1)*
sizeof(int));
1172 int *par_perm2 =
NULL;
1177 perm1, par_perm1, sum->cf->type);
1181 perm2, par_perm2, sum->cf->type);
1184 matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1185 matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1194 for (i = 1; i <=
rVar(R1); i++)
1195 for (j=
rVar(R1)+1; j <=
l; j++)
1203 for (i=1; i<=
rVar(R1); i++)
1204 for (j=i+1; j<=
rVar(R1); j++)
1207 MATELEM(C,i,j) =
p_PermPoly(
MATELEM(C1,i,j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1210 MATELEM(D,i,j) =
p_PermPoly(
MATELEM(D1,i,j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1219 for (i=1; i<=
rVar(R2); i++)
1220 for (j=i+1; j<=
rVar(R2); j++)
1223 MATELEM(C,
rVar(R1)+i,
rVar(R1)+j) =
p_PermPoly(
MATELEM(C2,i,j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1226 MATELEM(D,
rVar(R1)+i,
rVar(R1)+j) =
p_PermPoly(
MATELEM(D2,i,j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1234 WarnS(
"Error initializing non-commutative multiplication!");
1243 Print(
"\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1266 if (r1->qideal!=
NULL)
1277 int *perm1 = (
int *)
omAlloc0((
rVar(r1)+1)*
sizeof(int));
1278 int *par_perm1 =
NULL;
1282 perm1, par_perm1, sum->cf->type);
1286 for (
int for_i=0;for_i<
IDELEMS(r1->qideal);for_i++)
1288 r1->qideal->m[for_i], perm1,
1291 par_perm1,
rPar(r1));
1296 if (r2->qideal!=
NULL)
1300 int *perm2 = (
int *)
omAlloc0((
rVar(r2)+1)*
sizeof(int));
1301 int *par_perm2 =
NULL;
1305 perm2, par_perm2, sum->cf->type);
1309 for (
int for_i=0;for_i<
IDELEMS(r2->qideal);for_i++)
1311 r2->qideal->m[for_i], perm2,
1314 par_perm2,
rPar(r2));
1346 int rSum(ring r1, ring r2, ring &sum)
1372 res->options=r->options;
1387 res->firstBlockEnds=r->firstBlockEnds;
1389 res->real_var_start=r->real_var_start;
1390 res->real_var_end=r->real_var_end;
1393 #ifdef HAVE_SHIFTBBA 1394 res->isLPring=r->isLPring;
1397 res->VectorOut=r->VectorOut;
1398 res->ShortOut=r->ShortOut;
1399 res->CanShortOut=r->CanShortOut;
1415 res->bitmask=r->bitmask;
1416 res->divmask=r->divmask;
1417 res->BitsPerExp = r->BitsPerExp;
1418 res->ExpPerLong = r->ExpPerLong;
1437 if (copy_ordering ==
TRUE)
1439 res->LexOrder=r->LexOrder;
1440 res->MixedOrder=r->MixedOrder;
1442 res->wvhdl = (
int **)
omAlloc(i *
sizeof(
int *));
1444 res->block0 = (
int *)
omAlloc(i *
sizeof(
int));
1445 res->block1 = (
int *)
omAlloc(i *
sizeof(
int));
1448 if (r->wvhdl[j]!=
NULL)
1450 res->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[j]);
1456 memcpy(res->block0,r->block0,i *
sizeof(
int));
1457 memcpy(res->block1,r->block1,i *
sizeof(
int));
1467 res->names = (
char **)
omAlloc0(
rVar(r) *
sizeof(
char *));
1468 for (i=0; i<
rVar(res); i++)
1472 if (r->qideal!=
NULL)
1501 res->options=r->options;
1516 res->firstBlockEnds=r->firstBlockEnds;
1518 res->real_var_start=r->real_var_start;
1519 res->real_var_end=r->real_var_end;
1522 #ifdef HAVE_SHIFTBBA 1523 res->isLPring=r->isLPring;
1526 res->VectorOut=r->VectorOut;
1527 res->ShortOut=r->ShortOut;
1528 res->CanShortOut=r->CanShortOut;
1529 res->LexOrder=r->LexOrder;
1530 res->MixedOrder=r->MixedOrder;
1546 res->bitmask=r->bitmask;
1547 res->divmask=r->divmask;
1548 res->BitsPerExp = r->BitsPerExp;
1549 res->ExpPerLong = r->ExpPerLong;
1568 if (copy_ordering ==
TRUE)
1571 res->wvhdl = (
int **)
omAlloc(i *
sizeof(
int *));
1573 res->block0 = (
int *)
omAlloc(i *
sizeof(
int));
1574 res->block1 = (
int *)
omAlloc(i *
sizeof(
int));
1575 for (j=0; j<i-1; j++)
1577 if (r->wvhdl[j]!=
NULL)
1579 res->wvhdl[j+1] = (
int*)
omMemDup(r->wvhdl[j]);
1582 res->wvhdl[j+1]=
NULL;
1584 memcpy(&(res->order[1]),r->order,(i-1) *
sizeof(
rRingOrder_t));
1585 memcpy(&(res->block0[1]),r->block0,(i-1) *
sizeof(
int));
1586 memcpy(&(res->block1[1]),r->block1,(i-1) *
sizeof(
int));
1600 for(j=length-1;j>=0;j--)
1604 res->wvhdl[0]=(
int *)A;
1609 res->names = (
char **)
omAlloc0(
rVar(r) *
sizeof(
char *));
1610 for (i=0; i<
rVar(res); i++)
1614 if (r->qideal!=
NULL)
1620 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1625 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1662 if (r1 == r2)
return TRUE;
1664 if (r1->cf!=r2->cf)
return FALSE;
1672 for (i=0; i<
rVar(r1); i++)
1674 if ((r1->names[i] !=
NULL) && (r2->names[
i] !=
NULL))
1676 if (strcmp(r1->names[i], r2->names[i]))
return FALSE;
1678 else if ((r1->names[i] !=
NULL) ^ (r2->names[
i] !=
NULL))
1686 if (r1->qideal !=
NULL)
1688 ideal id1 = r1->qideal, id2 = r2->qideal;
1702 else if (r2->qideal !=
NULL)
return FALSE;
1712 if (r1 == r2)
return TRUE;
1716 if ((r1->cf != r2->cf)
1718 || (r1->OrdSgn != r2->OrdSgn))
1722 while (r1->order[i] != 0)
1724 if (r2->order[i] == 0)
return FALSE;
1725 if ((r1->order[i] != r2->order[i])
1726 || (r1->block0[i] != r2->block0[i])
1727 || (r1->block1[i] != r2->block1[i]))
1729 if (r1->wvhdl[i] !=
NULL)
1731 if (r2->wvhdl[i] ==
NULL)
1733 for (j=0; j<r1->block1[
i]-r1->block0[
i]+1; j++)
1734 if (r2->wvhdl[i][j] != r1->wvhdl[i][j])
1737 else if (r2->wvhdl[i] !=
NULL)
return FALSE;
1740 if (r2->order[i] != 0)
return FALSE;
1801 if (blocks == 1)
return TRUE;
1810 if ((blocks - s) > 2)
return FALSE;
1812 assume( blocks == s + 2 );
1876 if (blocks == 1)
return TRUE;
1885 if ((blocks - s) > 3)
return FALSE;
1888 if ((blocks - s) == 3)
1907 for (pos=0;pos<r->OrdSize;pos++)
1925 return (
rVar(r) > 1 &&
1931 ((r->order[1]!=0) &&
1939 return ((
rVar(r) > 1) &&
1948 while(r->order[i]!=0)
1950 if((r->block0[i]<=v)
1951 && (r->block1[i]>=v))
1956 return (r->wvhdl[i][v-r->block0[i]]>0);
1995 if (r->N == 0)
return TRUE;
1997 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2009 for(
int j=0;j<=
i;j++)
2012 dError(
"wrong order in r->order");
2023 if (r->VarOffset ==
NULL)
2025 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
2030 if ((r->OrdSize==0)!=(r->typ==
NULL))
2032 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
2038 for(i=0;i<=r->N;i++)
2042 for(j=0;j<r->OrdSize;j++)
2046 const int p = r->typ[
j].data.isTemp.suffixpos;
2051 assume( p < r->OrdSize );
2053 if(r->typ[p].ord_typ !=
ro_is)
2054 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
2057 if(r->typ[j].data.isTemp.pVarOffset[i] != -1)
2063 else if (r->typ[j].ord_typ ==
ro_is)
2066 if(r->typ[j].data.is.pVarOffset[i] != -1)
2074 if (r->typ[j].ord_typ==
ro_cp)
2076 if(((
short)r->VarOffset[i]) == r->typ[j].data.cp.place)
2081 && (r->VarOffset[i] == r->typ[j].data.dp.place))
2087 tmp=r->VarOffset[
i] & 0xffffff;
2088 #if SIZEOF_LONG == 8 2089 if ((r->VarOffset[i] >> 24) >63)
2091 if ((r->VarOffset[i] >> 24) >31)
2093 dReportError(
"bit_start out of range:%d",r->VarOffset[i] >> 24);
2094 if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2096 dReportError(
"varoffset out of range for var %d: %d",i,tmp);
2101 for(j=0;j<r->OrdSize;j++)
2103 if ((r->typ[j].ord_typ==
ro_dp)
2104 || (r->typ[j].ord_typ==
ro_wp)
2107 if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2109 r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2110 if ((r->typ[j].data.dp.start < 1)
2111 || (r->typ[j].data.dp.end > r->N))
2112 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2113 r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2145 static void rO_TDegree(
int &place,
int &bitplace,
int start,
int end,
2151 ord_struct.
data.dp.start=start;
2152 ord_struct.
data.dp.end=end;
2153 ord_struct.
data.dp.place=place;
2165 ord_struct.
data.dp.start=start;
2166 ord_struct.
data.dp.end=end;
2167 ord_struct.
data.dp.place=place;
2173 static void rO_WDegree(
int &place,
int &bitplace,
int start,
int end,
2174 long *o,
sro_ord &ord_struct,
int *weights)
2177 while((start<end) && (weights[0]==0)) { start++; weights++; }
2178 while((start<end) && (weights[end-start]==0)) { end--; }
2181 for(i=start;i<=end;i++)
2183 if(weights[i-start]!=1)
2191 rO_TDegree(place,bitplace,start,end,o,ord_struct);
2196 ord_struct.
data.wp.start=start;
2197 ord_struct.
data.wp.end=end;
2198 ord_struct.
data.wp.place=place;
2199 ord_struct.
data.wp.weights=weights;
2203 for(i=start;i<=end;i++)
2205 if(weights[i-start]<0)
2213 static void rO_WMDegree(
int &place,
int &bitplace,
int start,
int end,
2214 long *o,
sro_ord &ord_struct,
int *weights)
2223 ord_struct.
data.am.start=start;
2224 ord_struct.
data.am.end=end;
2225 ord_struct.
data.am.place=place;
2226 ord_struct.
data.am.weights=weights;
2227 ord_struct.
data.am.weights_m = weights + (end-start+1);
2228 ord_struct.
data.am.len_gen=weights[end-start+1];
2229 assume( ord_struct.
data.am.weights_m[0] == ord_struct.
data.am.len_gen );
2242 ord_struct.
data.wp64.start=start;
2243 ord_struct.
data.wp64.end=end;
2244 ord_struct.
data.wp64.place=place;
2245 ord_struct.
data.wp64.weights64=weights;
2254 long *o,
sro_ord &ord_struct,
int *weights)
2257 while((start<end) && (weights[0]==0)) { start++; weights++; }
2258 while((start<end) && (weights[end-start]==0)) { end--; }
2261 ord_struct.
data.wp.start=start;
2262 ord_struct.
data.wp.end=end;
2263 ord_struct.
data.wp.place=place;
2264 ord_struct.
data.wp.weights=weights;
2269 for(i=start;i<=end;i++)
2271 if(weights[i-start]<0)
2279 static void rO_LexVars(
int &place,
int &bitplace,
int start,
int end,
2280 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2285 if(prev_ord==-1)
rO_Align(place,bitplace);
2291 for(k=start;;k+=incr)
2296 v[
k]= place | (bitplace << 24);
2302 assume((opt_var == end+1) ||(opt_var == end-1));
2303 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-2");
2304 int save_bitplace=bitplace;
2308 bitplace=save_bitplace;
2312 v[opt_var]=place | (bitplace << 24);
2317 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2322 if(prev_ord==1)
rO_Align(place,bitplace);
2328 for(k=start;;k+=incr)
2333 v[
k]=place | (bitplace << 24);
2340 assume((opt_var == end+1) ||(opt_var == end-1));
2341 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-1");
2342 int save_bitplace=bitplace;
2346 bitplace=save_bitplace;
2350 v[opt_var]=place | (bitplace << 24);
2361 ord_struct.
data.syzcomp.place=place;
2362 ord_struct.
data.syzcomp.Components=
NULL;
2363 ord_struct.
data.syzcomp.ShiftedComponents=
NULL;
2370 static void rO_Syz(
int &place,
int &bitplace,
int &prev_ord,
2371 int syz_comp,
long *o,
sro_ord &ord_struct)
2378 ord_struct.
data.syz.place=place;
2379 ord_struct.
data.syz.limit=syz_comp;
2381 ord_struct.
data.syz.syz_index = (
int*)
omAlloc0((syz_comp+1)*
sizeof(int));
2383 ord_struct.
data.syz.syz_index =
NULL;
2384 ord_struct.
data.syz.curr_index = 1;
2397 long *o,
int ,
int *
v,
sro_ord &ord_struct)
2404 ord_struct.
data.isTemp.start = place;
2405 ord_struct.
data.isTemp.pVarOffset = (
int *)
omMemDup(v);
2406 ord_struct.
data.isTemp.suffixpos = -1;
2414 static void rO_ISSuffix(
int &place,
int &bitplace,
int &prev_ord,
long *o,
2419 int typ_j = typ_i - 1;
2422 if( tmp_typ[typ_j].ord_typ ==
ro_isTemp)
2435 const int start = tmp_typ[typ_j].
data.isTemp.start;
2436 int *pVarOffset = tmp_typ[typ_j].
data.isTemp.pVarOffset;
2447 tmp_typ[typ_j].
data.isTemp.suffixpos = typ_i;
2454 for(
int i = 0;
i <=
N;
i++ )
2457 if( v[
i] != pVarOffset[
i] )
2459 pVarOffset[
i] = v[
i];
2461 assume( pVarOffset[i] != -1 );
2467 if( pVarOffset[0] != -1 )
2468 pVarOffset[0] &= 0x0fff;
2470 sro_ord &ord_struct = tmp_typ[typ_j];
2474 ord_struct.
data.is.start = start;
2475 ord_struct.
data.is.end = place;
2476 ord_struct.
data.is.pVarOffset = pVarOffset;
2498 v[0] = place | (bitplace << 24);
2509 bits=16; bitmask=0xffff;
2511 else if (bitmask <= 1L)
2513 bits=1; bitmask = 1L;
2515 else if (bitmask <= 3L)
2517 bits=2; bitmask = 3L;
2519 else if (bitmask <= 7L)
2523 else if (bitmask <= 0xfL)
2525 bits=4; bitmask=0xfL;
2527 else if (bitmask <= 0x1fL)
2529 bits=5; bitmask=0x1fL;
2531 else if (bitmask <= 0x3fL)
2533 bits=6; bitmask=0x3fL;
2535 #if SIZEOF_LONG == 8 2536 else if (bitmask <= 0x7fL)
2538 bits=7; bitmask=0x7fL;
2541 else if (bitmask <= 0xffL)
2543 bits=8; bitmask=0xffL;
2545 #if SIZEOF_LONG == 8 2546 else if (bitmask <= 0x1ffL)
2548 bits=9; bitmask=0x1ffL;
2551 else if (bitmask <= 0x3ffL)
2553 bits=10; bitmask=0x3ffL;
2555 #if SIZEOF_LONG == 8 2556 else if (bitmask <= 0xfffL)
2558 bits=12; bitmask=0xfff;
2561 else if (bitmask <= 0xffffL)
2563 bits=16; bitmask=0xffffL;
2565 #if SIZEOF_LONG == 8 2566 else if (bitmask <= 0xfffffL)
2568 bits=20; bitmask=0xfffffL;
2570 else if (bitmask <= 0xffffffffL)
2572 bits=32; bitmask=0xffffffffL;
2574 else if (bitmask <= 0x7fffffffffffffffL)
2576 bits=63; bitmask=0x7fffffffffffffffL;
2580 bits=63; bitmask=0x7fffffffffffffffL;
2583 else if (bitmask <= 0x7fffffff)
2585 bits=31; bitmask=0x7fffffff;
2589 bits=31; bitmask=0x7fffffffL;
2600 #if SIZEOF_LONG == 8 2615 unsigned long bitmask1 =
rGetExpSize(bitmask+1, bits1);
2617 if ((((N+vars_per_long-1)/vars_per_long) ==
2618 ((N+vars_per_long1-1)/vars_per_long1)))
2620 vars_per_long=vars_per_long1;
2640 unsigned long exp_limit)
2647 int iNeedInducedOrderingSetup = 0;
2651 need_other_ring = (exp_limit != r->bitmask);
2655 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2656 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2657 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2666 if (r->block0[i]==r->block1[i])
2691 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2705 need_other_ring=
TRUE;
2706 try_omit_comp=
FALSE;
2707 copy_block_index=
FALSE;
2721 need_other_ring=
TRUE;
2723 omitted_degree =
TRUE;
2737 need_other_ring=
TRUE;
2739 omitted_degree =
TRUE;
2747 try_omit_comp =
FALSE;
2750 iNeedInducedOrderingSetup++;
2755 assume((i == 0) && (j == 0));
2759 try_omit_comp =
FALSE;
2768 if (copy_block_index)
2770 block0[
j]=r->block0[
i];
2771 block1[
j]=r->block1[
i];
2772 wvhdl[
j]=r->wvhdl[
i];
2777 if(!need_other_ring)
2789 res->GetNC() =
NULL;
2797 res->bitmask=exp_limit;
2804 if (r->pFDegOrig != res->pFDegOrig &&
2809 res->firstwv = r->firstwv;
2810 res->firstBlockEnds = r->firstBlockEnds;
2814 res->pLDeg = r->pLDegOrig;
2819 if (res->typ !=
NULL)
2821 if( res->typ[0].ord_typ ==
ro_syz)
2823 res->typ[0] = r->typ[0];
2825 if (r->typ[0].data.syz.limit > 0)
2827 res->typ[0].data.syz.syz_index
2828 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(int));
2829 memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2830 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2834 if( iNeedInducedOrderingSetup > 0 )
2836 for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2837 if( res->typ[i].ord_typ ==
ro_is )
2839 ideal F =
idrHeadR(r->typ[i].data.is.F, r, res);
2843 r->typ[i].data.is.limit,
2848 iNeedInducedOrderingSetup--;
2854 res->OrdSgn=r->OrdSgn;
2863 WarnS(
"error in nc_rComplete");
2876 WarnS(
"error in sca_Force!");
2890 res->GetNC() =
NULL;
2894 res->wvhdl = (
int **)
omAlloc0(3 *
sizeof(
int *));
2897 res->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
2898 res->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
2902 res->block1[0] = r->N;
2903 res->wvhdl[0] = weights;
2918 WarnS(
"error in nc_rComplete");
2945 int nblocks=1+(ommit_comp!=0);
2947 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2948 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2949 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2961 res->GetNC() =
NULL;
2968 res->bitmask=exp_limit;
2979 WarnS(
"error in nc_rComplete");
2995 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
3023 r->CanShortOut=
FALSE;
3026 r->CanShortOut =
TRUE;
3034 r->CanShortOut=
FALSE;
3045 if (r->N < N) N = r->N;
3047 for (
i=(N-1);
i>=0;
i--)
3049 if(r->names[
i] !=
NULL && strlen(r->names[
i])>1)
3051 r->CanShortOut=
FALSE;
3057 r->ShortOut = r->CanShortOut;
3059 assume( !( !r->CanShortOut && r->ShortOut ) );
3067 if(block1[i]!=r->N) r->LexOrder=
TRUE;
3068 r->firstBlockEnds=block1[
i];
3069 r->firstwv = wvhdl[
i];
3078 for(j=block1[i]-r->block0[i];j>=0;j--)
3080 if (r->firstwv[j]==0) r->LexOrder=
TRUE;
3087 for(j=block1[i]-r->block0[i];j>=0;j--)
3089 if (w[j]==0) r->LexOrder=
TRUE;
3096 if (r->pFDeg ==
p_Deg)
3117 r->pLDegOrig = r->pLDeg;
3124 int* block0 = r->block0;
3125 int* block1 = r->block1;
3126 int** wvhdl = r->wvhdl;
3135 r->LexOrder =
FALSE;
3142 for(
int ii=block0[0];ii<=block1[0];ii++)
3143 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3145 for(
int ii=block0[0];ii<=block1[0];ii++)
3146 if (wvhdl[0][ii-1]==0) { r->LexOrder=
TRUE;
break;}
3147 if ((block0[0]==1)&&(block1[0]==r->N))
3158 r->firstwv = wvhdl[0];
3170 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3189 for(
int ii=block0[0];ii<=block1[0];ii++)
3191 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3193 if (r->MixedOrder==0)
3195 if ((block0[0]==1)&&(block1[0]==r->N))
3203 r->firstBlockEnds=block1[0];
3204 r->firstwv = wvhdl[0];
3223 r->firstBlockEnds=block1[1];
3224 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3232 for(
int ii=block0[1];ii<=block1[1];ii++)
3233 if (wvhdl[1][ii-1]<0) { r->MixedOrder=2;
break;}
3234 if (r->MixedOrder==
FALSE)
3267 if(r->MixedOrder==
FALSE)
3282 r->pFDegOrig = r->pFDeg;
3297 for(i=0;i<r->OrdSize;i++)
3300 ||(r->typ[i].ord_typ==
ro_am))
3305 r->NegWeightL_Size=
l;
3306 r->NegWeightL_Offset=(
int *)
omAlloc(l*
sizeof(
int));
3308 for(i=0;i<r->OrdSize;i++)
3312 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3315 else if(r->typ[i].ord_typ==
ro_am)
3317 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3324 r->NegWeightL_Size = 0;
3325 r->NegWeightL_Offset =
NULL;
3337 if ( (r->cf->extRing!=
NULL)
3346 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3363 r->pLexOrder=r->LexOrder;
3371 static inline int sign(
int x) {
return (x > 0) - (x < 0);}
3379 for(i=2;i<=
rVar(r);i++)
3396 if (r->VarOffset!=
NULL && force == 0)
return FALSE;
3402 r->BitsPerExp = bits;
3407 long *tmp_ordsgn=(
long *)
omAlloc0(3*(n+r->N)*
sizeof(long));
3409 int *
v=(
int *)
omAlloc((r->N+1)*
sizeof(int));
3410 for(i=r->N; i>=0 ; i--)
3427 switch (r->order[i])
3431 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3437 rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3443 rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3444 tmp_typ[typ_i], (
int64 *)(r->wvhdl[i]));
3451 r->ComponentOrder=1;
3457 r->ComponentOrder=-1;
3463 k=r->block1[
i]-r->block0[
i]+1;
3466 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3468 r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3475 rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3476 tmp_ordsgn,v,bits, -1);
3480 rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3481 tmp_ordsgn,v, bits, -1);
3485 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3486 tmp_ordsgn,v, bits, -1);
3490 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3491 tmp_ordsgn,v, bits, -1);
3495 if (r->block0[i]==r->block1[i])
3497 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3498 tmp_ordsgn,v, bits, -1);
3502 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3506 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3511 if (r->block0[i]==r->block1[i])
3513 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3514 tmp_ordsgn,v, bits, -1);
3518 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3521 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3522 tmp_ordsgn,v, bits, r->block1[i]);
3527 if (r->block0[i]==r->block1[i])
3530 tmp_ordsgn,v,bits, -1);
3538 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3543 if (r->block0[i]==r->block1[i])
3546 tmp_ordsgn,v, bits, -1);
3553 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3554 tmp_ordsgn,v, bits, r->block1[i]);
3559 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3560 tmp_typ[typ_i], r->wvhdl[i]);
3565 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3567 if (r->wvhdl[i][jj]<=0) have_bad_weights=
TRUE;
3569 if (have_bad_weights)
3571 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3576 if (r->block1[i]!=r->block0[i])
3578 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3579 tmp_ordsgn, v,bits, r->block0[i]);
3584 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3585 tmp_typ[typ_i], r->wvhdl[i]);
3590 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3592 if (r->wvhdl[i][jj]<=0) have_bad_weights=
TRUE;
3594 if (have_bad_weights)
3596 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3601 if (r->block1[i]!=r->block0[i])
3603 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3604 tmp_ordsgn,v, bits, r->block1[i]);
3610 tmp_typ[typ_i], r->wvhdl[i]);
3612 if (r->block1[i]!=r->block0[i])
3614 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3615 tmp_ordsgn, v,bits, r->block0[i]);
3621 tmp_typ[typ_i], r->wvhdl[i]);
3623 if (r->block1[i]!=r->block0[i])
3625 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3626 tmp_ordsgn,v, bits, r->block1[i]);
3633 rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3634 need_to_add_comp=
TRUE;
3635 r->ComponentOrder=-1;
3640 assume(typ_i == 0 && j == 0);
3641 rO_Syz(j, j_bits, prev_ordsgn, r->block0[i], tmp_ordsgn, tmp_typ[typ_i]);
3642 need_to_add_comp=
TRUE;
3643 r->ComponentOrder=-1;
3650 assume( r->block0[i] == r->block1[i] );
3651 const int s = r->block0[
i];
3652 assume( -2 < s && s < 2);
3655 rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]);
3658 rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s);
3659 need_to_add_comp=
FALSE;
3678 j_bits=j_bits0; j=j0;
3683 if((need_to_add_comp) && (v[0]== -1))
3697 for(i=1 ; i<=r->N ; i++)
3703 rO_LexVars(j, j_bits, i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3724 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3726 for(j=0;j<r->CmpL_Size;j++)
3728 r->ordsgn[
j] = tmp_ordsgn[
j];
3737 if (typ_i==0) r->typ=
NULL;
3741 memcpy(r->typ,tmp_typ,typ_i*
sizeof(
sro_ord));
3751 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3754 if (i==r->pCompIndex) i++;
3755 while ((j < r->OrdSize)
3763 if (i==r->pCompIndex) i++;
3801 for(
int i=1;i<=r->N;i++)
3805 for(
int j=0;(
j<=
b) && (found==0);
j++)
3808 if ((r->block0[
j]<=i)&&(r->block1[
j]>=
i))
3828 if(r->wvhdl[
j][i-r->block0[
j]]<0)
3834 else if(r->wvhdl[
j][i-r->block0[
j]]>0)
3845 if(r->wvhdl[
j][i-r->block0[
j]]<0)
3851 else if(r->wvhdl[
j][i-r->block0[
j]]>0)
3880 if (nonneg>0) r->MixedOrder=1;
3891 if (r ==
NULL)
return;
3892 if (r->VarOffset !=
NULL)
3894 if (r->OrdSize!=0 && r->typ !=
NULL)
3896 for(
int i = 0; i < r->OrdSize; i++)
3897 if( r->typ[i].ord_typ ==
ro_is)
3900 r->typ[
i].data.is.F =
NULL;
3902 if( r->typ[i].data.is.pVarOffset !=
NULL )
3905 r->typ[
i].data.is.pVarOffset =
NULL;
3908 else if (r->typ[i].ord_typ ==
ro_syz)
3910 if(r->typ[i].data.syz.limit > 0)
3911 omFreeSize(r->typ[i].data.syz.syz_index, ((r->typ[i].data.syz.limit) +1)*
sizeof(
int));
3912 r->typ[
i].data.syz.syz_index =
NULL;
3916 assume( r->typ[i].data.syzcomp.ShiftedComponents ==
NULL );
3917 assume( r->typ[i].data.syzcomp.Components ==
NULL );
3927 if (r->PolyBin !=
NULL)
3932 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
3934 if (r->p_Procs !=
NULL)
3936 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
3938 if (r->NegWeightL_Offset!=
NULL)
3940 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
3941 r->NegWeightL_Offset=
NULL;
3949 int* VarL_Number = (
int*)
omAlloc0(r->ExpL_Size*
sizeof(
int));
3954 for (i=1; i<=r->N; i++)
3956 VarL_Number[r->VarOffset[
i] & 0xffffff]++;
3960 for (i=0, j=0; i<r->ExpL_Size; i++)
3962 if (VarL_Number[i] != 0)
3964 if (min > VarL_Number[i])
3966 min = VarL_Number[
i];
3975 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
3976 r->VarL_LowIndex = 0;
3979 for (i=0, j=0; i<r->ExpL_Size; i++)
3981 if (VarL_Number[i] != 0)
3983 r->VarL_Offset[
j] =
i;
3984 if (j > 0 && r->VarL_Offset[j-1] != r->VarL_Offset[j] - 1)
3985 r->VarL_LowIndex = -1;
3989 if (r->VarL_LowIndex >= 0)
3990 r->VarL_LowIndex = r->VarL_Offset[0];
3994 j = r->VarL_Offset[min_j];
3995 r->VarL_Offset[min_j] = r->VarL_Offset[0];
3996 r->VarL_Offset[0] =
j;
4003 int* shifts = (
int*)
omAlloc(r->ExpL_Size*
sizeof(
int));
4006 for (i=0;i<r->ExpL_Size;i++)
4010 for (i=1;i<=r->N;i++)
4012 if (shifts[r->VarOffset[i] & 0xffffff] > r->VarOffset[i] >> 24)
4013 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
4016 for (i=1;i<=r->N;i++)
4018 if (shifts[r->VarOffset[i] & 0xffffff] != 0)
4020 = (r->VarOffset[
i] & 0xffffff) |
4021 (((r->VarOffset[i] >> 24) - shifts[r->VarOffset[
i] & 0xffffff]) << 24);
4029 unsigned long divmask = 1;
4034 divmask |= (((
unsigned long) 1) << (
unsigned long) i);
4049 const char *TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
4050 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
4053 Print(
"ExpL_Size:%d ",r->ExpL_Size);
4054 Print(
"CmpL_Size:%d ",r->CmpL_Size);
4055 Print(
"VarL_Size:%d\n",r->VarL_Size);
4056 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4057 Print(
"divmask=%lx\n", r->divmask);
4058 Print(
"BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4060 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
4061 PrintS(
"VarL_Offset:\n");
4064 for(j = 0; j < r->VarL_Size; j++)
4065 Print(
" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
4072 for(j=0;j<=r->N;j++)
4073 Print(
" v%d at e-pos %d, bit %d\n",
4074 j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4076 for(j=0;j<r->CmpL_Size;j++)
4077 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4078 Print(
"OrdSgn:%d\n",r->OrdSgn);
4080 for(j=0;j<r->OrdSize;j++)
4082 Print(
" typ %s", TYP[r->typ[j].ord_typ]);
4083 if (r->typ[j].ord_typ==
ro_syz)
4085 const short place = r->typ[
j].data.syz.place;
4086 const int limit = r->typ[
j].data.syz.limit;
4087 const int curr_index = r->typ[
j].data.syz.curr_index;
4088 const int* syz_index = r->typ[
j].data.syz.syz_index;
4090 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4092 if( syz_index ==
NULL )
4097 for( i=0; i <= limit; i++ )
4098 Print(
"%d ", syz_index[i]);
4105 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4108 else if (r->typ[j].ord_typ==
ro_is)
4110 Print(
" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4114 Print(
" limit %d",r->typ[j].data.is.limit);
4121 else if (r->typ[j].ord_typ==
ro_am)
4123 Print(
" place %d",r->typ[j].data.am.place);
4124 Print(
" start %d",r->typ[j].data.am.start);
4125 Print(
" end %d",r->typ[j].data.am.end);
4126 Print(
" len_gen %d",r->typ[j].data.am.len_gen);
4129 for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4130 Print(
" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4131 l=r->typ[
j].data.am.end+1;
4132 int ll=r->typ[
j].data.am.weights[l-r->typ[
j].data.am.start];
4134 for(
int lll=l+1;lll<l+ll+1;lll++)
4135 Print(
" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4139 Print(
" place %d",r->typ[j].data.dp.place);
4143 Print(
" start %d",r->typ[j].data.dp.start);
4144 Print(
" end %d",r->typ[j].data.dp.end);
4145 if ((r->typ[j].ord_typ==
ro_wp)
4149 for(
int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;
l++)
4150 Print(
" %d",r->typ[j].data.wp.weights[
l-r->typ[j].data.wp.start]);
4152 else if (r->typ[j].ord_typ==
ro_wp64)
4156 for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4157 Print(
" %ld",(
long)(((
int64*)r->typ[j].data.wp64.weights64)+l-r->typ[j].data.wp64.start));
4163 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4164 Print(
"OrdSize:%d\n",r->OrdSize);
4165 PrintS(
"--------------------\n");
4166 for(j=0;j<r->ExpL_Size;j++)
4169 if (j< r->CmpL_Size)
4170 Print(
"ordsgn %ld ", r->ordsgn[j]);
4176 if( (r->VarOffset[i] & 0xffffff) == j )
4177 {
Print(
"v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4178 r->VarOffset[i] >>24 ); }
4180 if( r->pCompIndex==j )
PrintS(
"v0; ");
4181 for(i=0;i<r->OrdSize;i++)
4183 if (r->typ[i].data.dp.place == j)
4185 Print(
"ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4186 r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4190 if (j==r->pOrdIndex)
4195 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4197 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4198 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4200 for(j = 0; j < r->NegWeightL_Size; j++)
4201 Print(
" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4212 Print(
"p_Spec : %s, %s, %s\n", field, length, ord);
4214 for (i=0; i<(int) (
sizeof(
p_Procs_s)/
sizeof(
void*)); i++)
4216 Print(
" %s,\n", ((
char**) &proc_names)[i]);
4222 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" ) 4228 Print(
"(%p)", r->pFDeg);
4231 Print(
"pLDeg : (%p)", r->pLDeg);
4239 if (r->p_Setm==p_Setm_General)
PrintS(
"p_Setm_General\n");
4240 else if (r->p_Setm==p_Setm_Dummy)
PrintS(
"p_Setm_Dummy\n");
4241 else if (r->p_Setm==p_Setm_TotalDegree)
PrintS(
"p_Setm_Totaldegree\n");
4242 else if (r->p_Setm==p_Setm_WFirstTotalDegree)
PrintS(
"p_Setm_WFirstTotalDegree\n");
4243 else Print(
"%p\n",r->p_Setm);
4253 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4254 for(i=0;i<r->ExpL_Size;i++)
4255 Print(
"%ld ",p->exp[i]);
4262 if (j==0) {
PrintS(
"...\n");
break; }
4271 Print(
"\nexp[0..%d]\n", R->ExpL_Size - 1);
4272 for(
int i = 0; i < R->ExpL_Size; i++)
4273 Print(
"%09lx ", p->exp[i]);
4276 for(
int i = 1; i <= R->N; i++)
Print(
" v%d:%5ld",i,
p_GetExp(p, i, R));
4291 for(
int j = (F->ncols*F->nrows) - 1;
j >= 0;
j-- )
4305 Print(
"gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]);
4308 p_SetComp(
p, MIN + (*V)[ c - MIN - 1 ], r );
4329 r->typ[1].data.syzcomp.Components = currComponents;
4336 *currShiftedComponents = r->typ[1].data.syzcomp.ShiftedComponents;
4337 *currComponents = r->typ[1].data.syzcomp.Components;
4347 r->typ[1].data.syzcomp.length =
length;
4357 *length = r->typ[1].data.syzcomp.length;
4358 rNGetSComps( currComponents, currShiftedComponents, r);
4374 rDBGetSComps(currComponents, currShiftedComponents, length, r);
4376 rNGetSComps(currComponents, currShiftedComponents, r);
4399 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4408 res->block0=(
int *)
omAlloc0((i+1)*
sizeof(int));
4409 res->block1=(
int *)
omAlloc0((i+1)*
sizeof(int));
4410 int ** wvhdl =(
int **)
omAlloc0((i+1)*
sizeof(
int**));
4413 res->order[
j]=r->order[j-1];
4414 res->block0[
j]=r->block0[j-1];
4415 res->block1[
j]=r->block1[j-1];
4416 if (r->wvhdl[j-1] !=
NULL)
4418 wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[j-1]);
4434 WarnS(
"error in nc_rComplete");
4444 if (r->qideal!=
NULL)
4475 for(i=r->OrdSize-1;i>=0;i--)
4477 if ((r->typ[i].ord_typ==
ro_dp)
4478 && (r->typ[i].data.dp.start==1)
4479 && (r->typ[i].data.dp.end==r->N))
4493 for(i=r->OrdSize-1;i>=0;i--)
4495 if ((r->typ[i].ord_typ==
ro_dp)
4496 && (r->typ[i].data.dp.start==1)
4497 && (r->typ[i].data.dp.end==r->N))
4499 pos=r->typ[
i].data.dp.place;
4511 if (res->qideal!=
NULL)
4519 res->ExpL_Size=r->ExpL_Size+1;
4522 res->ordsgn=(
long *)
omAlloc0(res->ExpL_Size*
sizeof(
long));
4523 for(j=0;j<r->CmpL_Size;j++)
4525 res->ordsgn[
j] = r->ordsgn[
j];
4527 res->OrdSize=r->OrdSize+1;
4532 memcpy(res->typ,r->typ,r->OrdSize*
sizeof(
sro_ord));
4535 res->typ[res->OrdSize-1].ord_typ=
ro_dp;
4536 res->typ[res->OrdSize-1].data.dp.start=1;
4537 res->typ[res->OrdSize-1].data.dp.end=res->N;
4538 res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4539 pos=res->ExpL_Size-1;
4555 WarnS(
"error in nc_rComplete");
4561 if (r->qideal!=
NULL)
4591 if (r->order[i] == 0)
4600 new_r->wvhdl=(
int **)
omAlloc0(i *
sizeof(
int *));
4602 new_r->block0 = (
int *)
omAlloc0(i *
sizeof(
int));
4603 new_r->block1 = (
int *)
omAlloc0(i *
sizeof(
int));
4604 memcpy(new_r->order,r->order,(i-1) *
sizeof(
rRingOrder_t));
4605 memcpy(new_r->block0,r->block0,(i-1) *
sizeof(
int));
4606 memcpy(new_r->block1,r->block1,(i-1) *
sizeof(
int));
4607 for (
int j=0;
j<=last_block;
j++)
4609 if (r->wvhdl[
j]!=
NULL)
4611 new_r->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[
j]);
4628 WarnS(
"error in nc_rComplete");
4640 int last_block =
rBlocks(r) - 2;
4647 for (i=0; i< last_block; i++)
4658 for (i=c_pos+1; i<=last_block; i++)
4660 new_r->order[i-1] = new_r->order[
i];
4661 new_r->block0[i-1] = new_r->block0[
i];
4662 new_r->block1[i-1] = new_r->block1[
i];
4663 new_r->wvhdl[i-1] = new_r->wvhdl[
i];
4665 new_r->order[last_block] = r->order[c_pos];
4666 new_r->block0[last_block] = r->block0[c_pos];
4667 new_r->block1[last_block] = r->block1[c_pos];
4668 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4679 WarnS(
"error in nc_rComplete");
4704 if (new_r_1 != new_r && new_r_1 != old_r)
rDelete(new_r_1);
4712 # ifndef SING_NDEBUG 4713 WarnS(
"error in nc_rComplete");
4720 if (old_r->qideal !=
NULL)
4722 new_r->qideal =
idrCopyR(old_r->qideal, old_r, new_r);
4730 WarnS(
"error in nc_SetupQuotient");
4755 if ((r_blocks == 3) &&
4756 (r->order[0] == b1) &&
4757 (r->order[1] == b2) &&
4762 res->block0 = (
int*)
omAlloc0(3*
sizeof(
int));
4763 res->block1 = (
int*)
omAlloc0(3*
sizeof(
int));
4764 res->wvhdl = (
int**)
omAlloc0(3*
sizeof(
int*));
4770 res->block1[1] = r->N;
4775 res->block1[0] = r->N;
4785 WarnS(
"error in nc_rComplete");
4798 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete, sgn);
4805 assume((sgn == 1) || (sgn == -1));
4813 res->block0=(
int *)
omAlloc0((n+2)*
sizeof(int));
4814 res->block1=(
int *)
omAlloc0((n+2)*
sizeof(int));
4815 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
4823 res->block0[
j] = res->block1[
j] = 0;
4827 for(
int i = 0; (i <= n) && (r->order[i] != 0); i++, j++)
4829 res->order [
j] = r->order [
i];
4830 res->block0[
j] = r->block0[
i];
4831 res->block1[
j] = r->block1[
i];
4833 if (r->wvhdl[i] !=
NULL)
4835 wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[i]);
4841 res->block0[
j] = res->block1[
j] =
sgn;
4852 assume(res->order[j]==0);
4865 WarnS(
"error in nc_rComplete");
4877 if (r->qideal!=
NULL)
4934 Print(
"rIsIS(p: %d)\nF:", p);
4945 for(
int pos = 0; pos < r->OrdSize; pos++ )
4946 if( r->typ[pos].ord_typ ==
ro_is)
4968 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4977 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4982 if( i != r->typ[pos].data.is.limit )
4983 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
4986 const ideal FF =
idrHeadR(F, r, r);
4989 if( r->typ[pos].data.is.F !=
NULL)
4992 PrintS(
"Deleting old reference set F... \n");
4995 r->typ[pos].data.is.F =
NULL;
5000 r->typ[pos].data.is.F = FF;
5002 r->typ[pos].data.is.limit =
i;
5026 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
5028 r->block0[0]=r->block1[0] =
k;
5029 if( k == r->typ[0].data.syz.limit )
5033 if (r->typ[0].data.syz.limit == 0)
5035 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((k+1)*
sizeof(int));
5036 r->typ[0].data.syz.syz_index[0] = 0;
5037 r->typ[0].data.syz.curr_index = 1;
5041 r->typ[0].data.syz.syz_index = (
int*)
5043 (r->typ[0].data.syz.limit+1)*
sizeof(int),
5046 for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
5048 r->typ[0].data.syz.syz_index[
i] =
5049 r->typ[0].data.syz.curr_index;
5051 if(k < r->typ[0].data.syz.limit)
5054 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
5056 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5060 r->typ[0].data.syz.limit =
k;
5061 r->typ[0].data.syz.curr_index++;
5070 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!", k);
5075 r->block0[0] = r->block1[0] =
k;
5090 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5091 r->typ[0].data.syz.limit > 0 && i > 0)
5093 assume(i <= r->typ[0].data.syz.limit);
5095 for (j=0; j<r->typ[0].data.syz.limit; j++)
5097 if (r->typ[0].data.syz.syz_index[j] == i &&
5098 r->typ[0].data.syz.syz_index[j+1] != i)
5100 assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5104 return r->typ[0].data.syz.limit;
5109 WarnS(
"rGetMaxSyzComp: order c");
5119 for (i=0; i<nb; i++)
5121 if (r->wvhdl[i] !=
NULL)
5123 int length = r->block1[
i] - r->block0[
i];
5124 int* wvhdl = r->wvhdl[
i];
5128 for (j=0; j<
length; j++)
5130 if (wvhdl[j] != 0 && wvhdl[j] != 1)
return FALSE;
5146 return (r->cf->type);
5168 while((r->typ[i].ord_typ!=
ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5170 return (
int64*)(r->typ[
i].data.wp64.weights64);
5178 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*
sizeof(
int64));
5186 r->block0=(
int*)
omReallocSize(r->block0, size*
sizeof(
int), (size+1)*
sizeof(
int));
5187 r->block1=(
int*)
omReallocSize(r->block1, size*
sizeof(
int), (size+1)*
sizeof(
int));
5188 r->wvhdl=(
int **)
omReallocSize(r->wvhdl,size*
sizeof(
int *), (size+1)*
sizeof(
int *));
5189 for(
int k=size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5194 #if 0 // currently unused 5195 static int rReallocM1(ring r,
int size,
int pos)
5197 r->order=(
int*)
omReallocSize(r->order, size*
sizeof(
int), (size-1)*
sizeof(
int));
5198 r->block0=(
int*)
omReallocSize(r->block0, size*
sizeof(
int), (size-1)*
sizeof(
int));
5199 r->block1=(
int*)
omReallocSize(r->block1, size*
sizeof(
int), (size-1)*
sizeof(
int));
5200 r->wvhdl=(
int **)
omReallocSize(r->wvhdl,size*
sizeof(
int *), (size-1)*
sizeof(
int *));
5201 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5209 for(
int j=0;
j<=i2;
j++)
5217 #define rOppVar(R,I) (rVar(R)+1-I) 5243 int i2 = (
rVar(r)-1)/2;
5244 for(i=i2; i>=0; i--)
5250 p = r->names[
rVar(r)-1-
i];
5251 r->names[
rVar(r)-1-
i] = r->names[
i];
5266 for (i=
rVar(r)-1; i>=0; i--)
5268 char *
p=r->names[
i];
5269 if(isupper(*p)) *p = tolower(*p);
5270 else *p = toupper(*p);
5317 for(i=0; src->order[
i]!=0; i++)
5319 switch (src->order[i])
5324 r->order[
j]=src->order[
i];
5328 r->block0[
j]=
rOppVar(r, src->block1[i]);
5329 r->block1[
j]=
rOppVar(r, src->block0[i]);
5333 r->block0[
j]=
rOppVar(r, src->block1[i]);
5334 r->block1[
j]=
rOppVar(r, src->block0[i]);
5340 r->block0[
j]=
rOppVar(r, src->block1[i]);
5341 r->block1[
j]=
rOppVar(r, src->block0[i]);
5342 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[j]-r->block0[j]+1)*
sizeof(int));
5343 for(
int k=r->block0[j]; k<=r->block1[j];
k++)
5344 r->wvhdl[
j][
k-r->block0[
j]]=1;
5347 r->block0[
j]=
rOppVar(r, src->block1[i]);
5348 r->block1[
j]=
rOppVar(r, src->block0[i]);
5356 r->block0[
j]=
rOppVar(r, src->block1[i]);
5357 r->block1[
j]=
rOppVar(r, src->block0[i]);
5358 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[j]-r->block0[j]+1)*
sizeof(int));
5359 for(
int k=r->block0[j]; k<=r->block1[j];
k++)
5360 r->wvhdl[
j][
k-r->block0[
j]]=1;
5363 r->block0[
j]=
rOppVar(r, src->block1[i]);
5364 r->block1[
j]=
rOppVar(r, src->block0[i]);
5372 r->block0[
j]=
rOppVar(r, src->block1[i]);
5373 r->block1[
j]=
rOppVar(r, src->block0[i]);
5374 r->wvhdl[
j]=r->wvhdl[j+1]; r->wvhdl[j+1]=
NULL;
5375 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5378 r->block0[
j]=
rOppVar(r, src->block1[i]);
5379 r->block1[
j]=
rOppVar(r, src->block0[i]);
5387 r->block0[
j]=
rOppVar(r, src->block1[i]);
5388 r->block1[
j]=
rOppVar(r, src->block0[i]);
5389 r->wvhdl[
j]=r->wvhdl[j+1]; r->wvhdl[j+1]=
NULL;
5390 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5393 r->block0[
j]=
rOppVar(r, src->block1[i]);
5394 r->block1[
j]=
rOppVar(r, src->block0[i]);
5401 r->block0[
j]=
rOppVar(r, src->block1[i]);
5402 r->block1[
j]=
rOppVar(r, src->block0[i]);
5403 int n=r->block1[
j]-r->block0[
j];
5405 for (
int nn=0; nn<=n; nn++)
5414 r->block0[
j]=
rOppVar(r, src->block1[i]);
5415 r->block1[
j]=
rOppVar(r, src->block0[i]);
5416 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5473 int *par_perm =
NULL;
5476 for(i=1; i<=r->N; i++)
5484 for (i=1; i<
rVar(r); i++)
5486 for (j=i+1; j<=
rVar(r); j++)
5492 MATELEM(C,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5495 MATELEM(D,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5503 WarnS(
"Error initializing non-commutative multiplication!");
5511 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5518 if (src->qideal !=
NULL)
5523 r->qideal =
idOppose(src, src->qideal, r);
5525 r->qideal =
id_Copy(src->qideal, r);
5555 int stat =
rSum(R, Ropp, Renv);
5557 WarnS(
"Error in rEnvelope at rSum");
5580 const int N = dest->N;
5589 const ring srcBase = src;
5596 matrix C0 = src->GetNC()->C;
5597 matrix D0 = src->GetNC()->D;
5600 for (
int i = 1; i <
N; i++)
5602 for (
int j = i + 1;
j <=
N;
j++)
5605 const poly
p =
p_NSet(n, dest);
5647 while(r->order[i]!=0)
5654 for(j=r->block1[i]-r->block0[i];j>=0;j--)
5656 r->wvhdl[
i]=(
int*)w64;
5657 omFreeSize(w,(r->block1[i]-r->block0[i]+1)*
sizeof(
int));
5690 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
5699 WerrorS(
"only for rings with an ordering of one block");
5716 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5719 for(
int i=r->N-1;i>=0;i--)
5721 if (strcmp(r->names[i],v)==0)
5723 Werror(
"duplicate variable name >>%s<<",v);
5729 #ifdef HAVE_SHIFTBBA 5732 R->isLPring=r->isLPring+1;
5733 R->N=((r->N)/r->isLPring)+r->N;
5737 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5740 for(
int i=R->isLPring-1;i>0;i--)
5741 names[i+
b*R->isLPring]=R->names[i-1+
b*r->isLPring];
5746 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5749 for(
int i=R->isLPring-2;i>=0;i--)
5750 names[i+
b*R->isLPring]=R->names[i+
b*r->isLPring];
5762 for(
int i=R->N-1;i>0;i--) names[
i]=R->names[i-1];
5767 for(
int i=R->N-2;i>=0;i--) names[
i]=R->names[
i];
5781 WerrorS(
"only for rings with an ordering of one block");
5798 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5805 if (strcmp(R->names[i],v)==0)
5809 for(
int j=i;
j<R->N;
j++) R->names[
j]=R->names[
j+1];
for idElimination, like a, except pFDeg, pWeigths ignore it
n_coeffType rFieldType(ring r)
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
ideal SCAQuotient(const ring r)
void p_Setm_General(poly p, const ring r)
const CanonicalForm int s
void p_DebugPrint(poly p, const ring r)
#define omCheckAddrSize(addr, size)
static void rOptimizeLDeg(ring r)
long pLDeg1(poly p, int *l, const ring r)
#define omcheckAddrSize(addr, size)
only used if HAVE_RINGS is defined
poly rGetVar(const int varIndex, const ring r)
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering, 1: dp,dp, 2: aa(...),dp vartest: check for name conflicts
non-simple ordering as specified by currRing
simple ordering, exponent vector has priority component is compatible with exp-vector order ...
static void rSetNegWeight(ring r)
poly prCopyR(poly p, ring src_r, ring dest_r)
static BOOLEAN rField_is_Zp_a(const ring r)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
p_SetmProc p_GetSetmProc(const ring r)
rOrderType_t rGetOrderType(ring r)
only used if HAVE_RINGS is defined
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static int min(int a, int b)
BOOLEAN rRing_is_Homog(ring r)
static BOOLEAN rField_is_Ring_PtoM(const ring r)
int sgn(const Rational &a)
long pLDeg1c(poly p, int *l, const ring r)
static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
size_t omSizeOfAddr(const void *addr)
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
static int rPar(const ring r)
(r->cf->P)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
struct p_Procs_s p_Procs_s
static BOOLEAN rField_is_R(const ring r)
static int rRealloc1(ring r, int size, int pos)
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
BOOLEAN rIsPolyVar(int v, const ring r)
returns TRUE if var(i) belongs to p-block
#define omFreeSize(addr, size)
static BOOLEAN rShortOut(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define omfreeSize(addr, size)
static void m_DebugPrint(const poly p, const ring R)
debug-print monomial poly/vector p, assuming that it lives in the ring R
long pLDeg0c(poly p, int *l, const ring r)
void nc_rKill(ring r)
complete destructor
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
static void rOppWeight(int *w, int l)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
#define omUnGetSpecBin(bin_ptr)
static BOOLEAN rField_is_Q_a(const ring r)
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
static long p_Totaldegree(poly p, const ring r)
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
simple ordering, component has priority
static BOOLEAN rField_is_Zn(const ring r)
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
void WerrorS(const char *s)
void p_Setm_TotalDegree(poly p, const ring r)
static BOOLEAN rField_is_GF(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
static BOOLEAN rField_is_Z(const ring r)
long * currShiftedComponents
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - ...
BOOLEAN rDBTest(ring r, const char *fn, const int l)
ring rAssure_HasComp(const ring r)
long pLDeg1_Deg(poly p, int *l, const ring r)
static BOOLEAN rIsLPRing(const ring r)
ring rAssure_c_dp(const ring r)
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
static BOOLEAN rCanShortOut(const ring r)
BOOLEAN rHasSimpleOrder(const ring r)
BOOLEAN rHas_c_Ordering(const ring r)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
BOOLEAN rHasSimpleOrderAA(ring r)
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
static void rSetOption(ring r)
real floating point (GMP) numbers
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
simple ordering, exponent vector has priority component not compatible with exp-vector order ...
long pLDeg1c_Deg(poly p, int *l, const ring r)
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
int rSum(ring r1, ring r2, ring &sum)
static void rSetDegStuff(ring r)
#define omReallocSize(addr, o_size, size)
bool sca_Force(ring rGR, int b, int e)
static void rO_LexVars_neg(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
static void rO_Align(int &place, int &bitplace)
single prescision (6,6) real numbers
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
static int rBlocks(ring r)
int r_IsRingVar(const char *n, char **names, int N)
long p_Deg(poly a, const ring r)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
const CanonicalForm CFMap CFMap & N
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
only used if HAVE_RINGS is defined
ring rMinusVar(const ring r, char *v)
undo rPlusVar
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
The main handler for Singular numbers which are suitable for Singular polynomials.
long p_WFirstTotalDegree(poly p, const ring r)
void StringSetS(const char *st)
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
for(int i=0;i<=n;i++) degsf[i]
void StringAppendS(const char *st)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
long pLDeg0(poly p, int *l, const ring r)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
ring rAssure_dp_C(const ring r)
complex floating point (GMP) numbers
const char * rSimpleOrdStr(int ord)
gmp_float sqrt(const gmp_float &a)
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
void p_Setm_Dummy(poly p, const ring r)
static long p_FDeg(const poly p, const ring r)
BOOLEAN rCheckIV(const intvec *iv)
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
only used if HAVE_RINGS is defined
static int si_max(const int a, const int b)
void rDebugPrint(const ring r)
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
Induced (Schreyer) ordering.
void PrintS(const char *s)
ring rAssure_TDeg(ring r, int &pos)
static BOOLEAN rField_is_Q(const ring r)
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
static void rSetFirstWv(ring r, int i, rRingOrder_t *order, int *block1, int **wvhdl)
void rWrite(ring r, BOOLEAN details)
void rKillModified_Wp_Ring(ring r)
static void rSetOutParams(ring r)
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well
void mp_Delete(matrix *a, const ring r)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
static short scaFirstAltVar(ring r)
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static BOOLEAN rField_is_long_C(const ring r)
void rSetSyzComp(int k, const ring r)
static BOOLEAN rField_is_Zp(const ring r)
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
void p_Write0(poly p, ring lmRing, ring tailRing)
static void p_Delete(poly *p, const ring r)
#define omGetSpecBin(size)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void rSetWeightVec(ring r, int64 *wv)
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
const Variable & v
< [in] a sqrfree bivariate poly
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
BOOLEAN rHasSimpleLexOrder(const ring r)
returns TRUE, if simple lp or ls ordering
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
long pLDegb(poly p, int *l, const ring r)
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static BOOLEAN rField_is_Ring_2toM(const ring r)
static BOOLEAN rField_is_Ring(const ring r)
ring rAssure_dp_S(const ring r)
static const char *const ringorder_name[]
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
void rDelete(ring r)
unconditionally deletes fields in r
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
ring rAssure_C_dp(const ring r)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
ring nc_rCreateNCcomm_rCopy(ring r)
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
static BOOLEAN rField_is_long_R(const ring r)
int rTypeOfMatrixOrder(const intvec *order)
static BOOLEAN length(leftv result, leftv arg)
static short scaLastAltVar(ring r)
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p)
Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r...
void rModify_a_to_A(ring r)
static bool rIsSCA(const ring r)
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
void rKillModifiedRing(ring r)
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
static void p_Setm(poly p, const ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
rRingOrder_t rOrderName(char *ordername)
static nc_type & ncRingType(nc_struct *p)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
int dReportError(const char *fmt,...)
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
#define TEST_RINGDEP_OPTS
long p_WTotaldegree(poly p, const ring r)
#define omCheckAddr(addr)
void p_wrp(poly p, ring lmRing, ring tailRing)
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
void p_Write(poly p, ring lmRing, ring tailRing)
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
static void rCheckOrdSgn(ring r, int i)
#define omFreeBin(addr, bin)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
static BOOLEAN rIsNCRing(const ring r)
BOOLEAN rRing_has_CompLastBlock(ring r)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
void nKillChar(coeffs r)
undo all initialisations
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
void Werror(const char *fmt,...)
int64 * rGetWeightVec(const ring r)
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
used to represent polys as coeffcients
#define UPMATELEM(i, j, nVar)
#define MATELEM(mat, i, j)
1-based access to matrix
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL