40 #define BITS_PER_LONG 8*SIZEOF_LONG
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));
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];
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]);
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++)
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];
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);
660 l+=strlen(params[
i])+1;
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')
885 if (*(r2->names[
i]) ==
'\0')
908 if (strcmp(r1->names[
j],r2->names[
i])==0)
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)
1074 for (
i=0;r2->order[
i]!=0;
i++)
1082 if (r2->wvhdl[
i]!=
NULL)
1089 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
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++)
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));
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;
1448 if (r->wvhdl[
j]!=
NULL)
1456 memcpy(
res->block0,r->block0,
i *
sizeof(
int));
1457 memcpy(
res->block1,r->block1,
i *
sizeof(
int));
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)
1575 for (
j=0;
j<
i-1;
j++)
1577 if (r->wvhdl[
j]!=
NULL)
1585 memcpy(&(
res->block0[1]),r->block0,(
i-1) *
sizeof(
int));
1586 memcpy(&(
res->block1[1]),r->block1,(
i-1) *
sizeof(
int));
1604 res->wvhdl[0]=(
int *)
A;
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;
1666 if (r1->bitmask!=r2->bitmask)
return FALSE;
1667 #ifdef HAVE_SHIFTBBA
1668 if (r1->isLPring!=r2->isLPring)
return FALSE;
1678 if ((r1->names[
i] !=
NULL) && (r2->names[
i] !=
NULL))
1680 if (strcmp(r1->names[
i], r2->names[
i]))
return FALSE;
1682 else if ((r1->names[
i] !=
NULL) ^ (r2->names[
i] !=
NULL))
1690 if (r1->qideal !=
NULL)
1692 ideal id1 = r1->qideal, id2 = r2->qideal;
1706 else if (r2->qideal !=
NULL)
return FALSE;
1716 if (r1 == r2)
return TRUE;
1720 if ((r1->cf != r2->cf)
1722 || (r1->OrdSgn != r2->OrdSgn))
1726 while (r1->order[
i] != 0)
1728 if (r2->order[
i] == 0)
return FALSE;
1729 if ((r1->order[
i] != r2->order[
i])
1730 || (r1->block0[
i] != r2->block0[
i])
1731 || (r1->block1[
i] != r2->block1[
i]))
1733 if (r1->wvhdl[
i] !=
NULL)
1735 if (r2->wvhdl[
i] ==
NULL)
1737 for (
j=0;
j<r1->block1[
i]-r1->block0[
i]+1;
j++)
1738 if (r2->wvhdl[
i][
j] != r1->wvhdl[
i][
j])
1744 if (r2->order[
i] != 0)
return FALSE;
1805 if (blocks == 1)
return TRUE;
1814 if ((blocks -
s) > 2)
return FALSE;
1880 if (blocks == 1)
return TRUE;
1889 if ((blocks -
s) > 3)
return FALSE;
1892 if ((blocks -
s) == 3)
1911 for (pos=0;pos<r->OrdSize;pos++)
1929 return (
rVar(r) > 1 &&
1935 ((r->order[1]!=0) &&
1943 return ((
rVar(r) > 1) &&
1952 while(r->order[
i]!=0)
1954 if((r->block0[
i]<=
v)
1955 && (r->block1[
i]>=
v))
1960 return (r->wvhdl[
i][
v-r->block0[
i]]>0);
1999 if (r->N == 0)
return TRUE;
2001 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2013 for(
int j=0;
j<=
i;
j++)
2016 dError(
"wrong order in r->order");
2027 if (r->VarOffset ==
NULL)
2029 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d", fn,
l);
2034 if ((r->OrdSize==0)!=(r->typ==
NULL))
2036 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
2042 for(
i=0;
i<=r->N;
i++)
2046 for(
j=0;
j<r->OrdSize;
j++)
2050 const int p = r->typ[
j].data.isTemp.suffixpos;
2055 assume( p < r->OrdSize );
2057 if(r->typ[
p].ord_typ !=
ro_is)
2058 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",
j,
p);
2061 if(r->typ[
j].data.isTemp.pVarOffset[
i] != -1)
2067 else if (r->typ[
j].ord_typ ==
ro_is)
2070 if(r->typ[
j].data.is.pVarOffset[
i] != -1)
2078 if (r->typ[
j].ord_typ==
ro_cp)
2080 if(((
short)r->VarOffset[
i]) == r->typ[
j].data.cp.place)
2085 && (r->VarOffset[
i] == r->typ[
j].data.dp.place))
2091 tmp=r->VarOffset[
i] & 0xffffff;
2092 #if SIZEOF_LONG == 8
2093 if ((r->VarOffset[
i] >> 24) >63)
2095 if ((r->VarOffset[
i] >> 24) >31)
2097 dReportError(
"bit_start out of range:%d",r->VarOffset[
i] >> 24);
2098 if (
i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2100 dReportError(
"varoffset out of range for var %d: %d",
i,tmp);
2105 for(
j=0;
j<r->OrdSize;
j++)
2107 if ((r->typ[
j].ord_typ==
ro_dp)
2108 || (r->typ[
j].ord_typ==
ro_wp)
2111 if (r->typ[
j].data.dp.start > r->typ[
j].data.dp.end)
2113 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end);
2114 if ((r->typ[
j].data.dp.start < 1)
2115 || (r->typ[
j].data.dp.end > r->N))
2116 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",
j,
2117 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end,r->N);
2149 static void rO_TDegree(
int &place,
int &bitplace,
int start,
int end,
2155 ord_struct.
data.dp.start=start;
2156 ord_struct.
data.dp.end=end;
2157 ord_struct.
data.dp.place=place;
2169 ord_struct.
data.dp.start=start;
2170 ord_struct.
data.dp.end=end;
2171 ord_struct.
data.dp.place=place;
2177 static void rO_WDegree(
int &place,
int &bitplace,
int start,
int end,
2178 long *o,
sro_ord &ord_struct,
int *weights)
2181 while((start<end) && (weights[0]==0)) { start++; weights++; }
2182 while((start<end) && (weights[end-start]==0)) { end--; }
2185 for(
i=start;
i<=end;
i++)
2187 if(weights[
i-start]!=1)
2195 rO_TDegree(place,bitplace,start,end,o,ord_struct);
2200 ord_struct.
data.wp.start=start;
2201 ord_struct.
data.wp.end=end;
2202 ord_struct.
data.wp.place=place;
2203 ord_struct.
data.wp.weights=weights;
2207 for(
i=start;
i<=end;
i++)
2209 if(weights[
i-start]<0)
2217 static void rO_WMDegree(
int &place,
int &bitplace,
int start,
int end,
2218 long *o,
sro_ord &ord_struct,
int *weights)
2227 ord_struct.
data.am.start=start;
2228 ord_struct.
data.am.end=end;
2229 ord_struct.
data.am.place=place;
2230 ord_struct.
data.am.weights=weights;
2231 ord_struct.
data.am.weights_m = weights + (end-start+1);
2232 ord_struct.
data.am.len_gen=weights[end-start+1];
2233 assume( ord_struct.
data.am.weights_m[0] == ord_struct.
data.am.len_gen );
2246 ord_struct.
data.wp64.start=start;
2247 ord_struct.
data.wp64.end=end;
2248 ord_struct.
data.wp64.place=place;
2249 ord_struct.
data.wp64.weights64=weights;
2258 long *o,
sro_ord &ord_struct,
int *weights)
2261 while((start<end) && (weights[0]==0)) { start++; weights++; }
2262 while((start<end) && (weights[end-start]==0)) { end--; }
2265 ord_struct.
data.wp.start=start;
2266 ord_struct.
data.wp.end=end;
2267 ord_struct.
data.wp.place=place;
2268 ord_struct.
data.wp.weights=weights;
2273 for(
i=start;
i<=end;
i++)
2275 if(weights[
i-start]<0)
2283 static void rO_LexVars(
int &place,
int &bitplace,
int start,
int end,
2284 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2289 if(prev_ord==-1)
rO_Align(place,bitplace);
2295 for(
k=start;;
k+=incr)
2300 v[
k]= place | (bitplace << 24);
2306 assume((opt_var == end+1) ||(opt_var == end-1));
2307 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-2");
2308 int save_bitplace=bitplace;
2312 bitplace=save_bitplace;
2316 v[opt_var]=place | (bitplace << 24);
2321 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2326 if(prev_ord==1)
rO_Align(place,bitplace);
2332 for(
k=start;;
k+=incr)
2337 v[
k]=place | (bitplace << 24);
2344 assume((opt_var == end+1) ||(opt_var == end-1));
2345 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-1");
2346 int save_bitplace=bitplace;
2350 bitplace=save_bitplace;
2354 v[opt_var]=place | (bitplace << 24);
2365 ord_struct.
data.syzcomp.place=place;
2366 ord_struct.
data.syzcomp.Components=
NULL;
2367 ord_struct.
data.syzcomp.ShiftedComponents=
NULL;
2374 static void rO_Syz(
int &place,
int &bitplace,
int &prev_ord,
2375 int syz_comp,
long *o,
sro_ord &ord_struct)
2382 ord_struct.
data.syz.place=place;
2383 ord_struct.
data.syz.limit=syz_comp;
2385 ord_struct.
data.syz.syz_index = (
int*)
omAlloc0((syz_comp+1)*
sizeof(int));
2387 ord_struct.
data.syz.syz_index =
NULL;
2388 ord_struct.
data.syz.curr_index = 1;
2401 long *o,
int ,
int *
v,
sro_ord &ord_struct)
2408 ord_struct.
data.isTemp.start = place;
2410 ord_struct.
data.isTemp.suffixpos = -1;
2418 static void rO_ISSuffix(
int &place,
int &bitplace,
int &prev_ord,
long *o,
2423 int typ_j = typ_i - 1;
2426 if( tmp_typ[typ_j].ord_typ ==
ro_isTemp)
2439 const int start = tmp_typ[typ_j].
data.isTemp.start;
2440 int *pVarOffset = tmp_typ[typ_j].
data.isTemp.pVarOffset;
2451 tmp_typ[typ_j].
data.isTemp.suffixpos = typ_i;
2458 for(
int i = 0;
i <=
N;
i++ )
2461 if(
v[
i] != pVarOffset[
i] )
2463 pVarOffset[
i] =
v[
i];
2465 assume( pVarOffset[
i] != -1 );
2471 if( pVarOffset[0] != -1 )
2472 pVarOffset[0] &= 0x0fff;
2474 sro_ord &ord_struct = tmp_typ[typ_j];
2478 ord_struct.
data.is.start = start;
2479 ord_struct.
data.is.end = place;
2480 ord_struct.
data.is.pVarOffset = pVarOffset;
2502 v[0] = place | (bitplace << 24);
2513 bits=16; bitmask=0xffff;
2515 else if (bitmask <= 1L)
2517 bits=1; bitmask = 1L;
2519 else if (bitmask <= 3L)
2521 bits=2; bitmask = 3L;
2523 else if (bitmask <= 7L)
2527 else if (bitmask <= 0xfL)
2529 bits=4; bitmask=0xfL;
2531 else if (bitmask <= 0x1fL)
2533 bits=5; bitmask=0x1fL;
2535 else if (bitmask <= 0x3fL)
2537 bits=6; bitmask=0x3fL;
2539 #if SIZEOF_LONG == 8
2540 else if (bitmask <= 0x7fL)
2542 bits=7; bitmask=0x7fL;
2545 else if (bitmask <= 0xffL)
2547 bits=8; bitmask=0xffL;
2549 #if SIZEOF_LONG == 8
2550 else if (bitmask <= 0x1ffL)
2552 bits=9; bitmask=0x1ffL;
2555 else if (bitmask <= 0x3ffL)
2557 bits=10; bitmask=0x3ffL;
2559 #if SIZEOF_LONG == 8
2560 else if (bitmask <= 0xfffL)
2562 bits=12; bitmask=0xfff;
2565 else if (bitmask <= 0xffffL)
2567 bits=16; bitmask=0xffffL;
2569 #if SIZEOF_LONG == 8
2570 else if (bitmask <= 0xfffffL)
2572 bits=20; bitmask=0xfffffL;
2574 else if (bitmask <= 0xffffffffL)
2576 bits=32; bitmask=0xffffffffL;
2578 else if (bitmask <= 0x7fffffffffffffffL)
2580 bits=63; bitmask=0x7fffffffffffffffL;
2584 bits=63; bitmask=0x7fffffffffffffffL;
2587 else if (bitmask <= 0x7fffffff)
2589 bits=31; bitmask=0x7fffffff;
2593 bits=31; bitmask=0x7fffffffL;
2604 #if SIZEOF_LONG == 8
2619 unsigned long bitmask1 =
rGetExpSize(bitmask+1, bits1);
2621 if ((((
N+vars_per_long-1)/vars_per_long) ==
2622 ((
N+vars_per_long1-1)/vars_per_long1)))
2624 vars_per_long=vars_per_long1;
2644 unsigned long exp_limit)
2651 int iNeedInducedOrderingSetup = 0;
2655 need_other_ring = (exp_limit != r->bitmask);
2659 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2660 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2661 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2670 if (r->block0[
i]==r->block1[
i])
2695 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2709 need_other_ring=
TRUE;
2710 try_omit_comp=
FALSE;
2711 copy_block_index=
FALSE;
2725 need_other_ring=
TRUE;
2727 omitted_degree =
TRUE;
2741 need_other_ring=
TRUE;
2743 omitted_degree =
TRUE;
2751 try_omit_comp =
FALSE;
2754 iNeedInducedOrderingSetup++;
2763 try_omit_comp =
FALSE;
2772 if (copy_block_index)
2774 block0[
j]=r->block0[
i];
2775 block1[
j]=r->block1[
i];
2776 wvhdl[
j]=r->wvhdl[
i];
2781 if(!need_other_ring)
2801 res->bitmask=exp_limit;
2808 if (r->pFDegOrig !=
res->pFDegOrig &&
2813 res->firstwv = r->firstwv;
2814 res->firstBlockEnds = r->firstBlockEnds;
2818 res->pLDeg = r->pLDegOrig;
2827 res->typ[0] = r->typ[0];
2829 if (r->typ[0].data.syz.limit > 0)
2831 res->typ[0].data.syz.syz_index
2832 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(int));
2833 memcpy(
res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2834 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2838 if( iNeedInducedOrderingSetup > 0 )
2840 for(
j = 0,
i = 0; (
i < nblocks) && (iNeedInducedOrderingSetup > 0);
i++)
2847 r->typ[
i].data.is.limit,
2852 iNeedInducedOrderingSetup--;
2858 res->OrdSgn=r->OrdSgn;
2867 WarnS(
"error in nc_rComplete");
2880 WarnS(
"error in sca_Force!");
2906 res->block1[0] = r->N;
2907 res->wvhdl[0] = weights;
2922 WarnS(
"error in nc_rComplete");
2949 int nblocks=1+(ommit_comp!=0);
2951 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2952 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2953 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2972 res->bitmask=exp_limit;
2983 WarnS(
"error in nc_rComplete");
2999 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
3027 r->CanShortOut=
FALSE;
3030 r->CanShortOut =
TRUE;
3038 r->CanShortOut=
FALSE;
3049 if (r->N <
N)
N = r->N;
3051 for (
i=(
N-1);
i>=0;
i--)
3053 if(r->names[
i] !=
NULL && strlen(r->names[
i])>1)
3055 r->CanShortOut=
FALSE;
3061 r->ShortOut = r->CanShortOut;
3063 assume( !( !r->CanShortOut && r->ShortOut ) );
3071 if(block1[
i]!=r->N) r->LexOrder=
TRUE;
3072 r->firstBlockEnds=block1[
i];
3073 r->firstwv = wvhdl[
i];
3082 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3084 if (r->firstwv[
j]==0) r->LexOrder=
TRUE;
3091 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3093 if (
w[
j]==0) r->LexOrder=
TRUE;
3100 if (r->pFDeg ==
p_Deg)
3121 r->pLDegOrig = r->pLDeg;
3128 int* block0 = r->block0;
3129 int* block1 = r->block1;
3130 int** wvhdl = r->wvhdl;
3139 r->LexOrder =
FALSE;
3146 for(
int ii=block0[0];ii<=block1[0];ii++)
3147 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3149 for(
int ii=block0[0];ii<=block1[0];ii++)
3150 if (wvhdl[0][ii-1]==0) { r->LexOrder=
TRUE;
break;}
3151 if ((block0[0]==1)&&(block1[0]==r->N))
3162 r->firstwv = wvhdl[0];
3174 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3193 for(
int ii=block0[0];ii<=block1[0];ii++)
3195 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3197 if (r->MixedOrder==0)
3199 if ((block0[0]==1)&&(block1[0]==r->N))
3207 r->firstBlockEnds=block1[0];
3208 r->firstwv = wvhdl[0];
3227 r->firstBlockEnds=block1[1];
3228 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3236 for(
int ii=block0[1];ii<=block1[1];ii++)
3237 if (wvhdl[1][ii-1]<0) { r->MixedOrder=2;
break;}
3238 if (r->MixedOrder==
FALSE)
3271 if(r->MixedOrder==
FALSE)
3286 r->pFDegOrig = r->pFDeg;
3301 for(
i=0;
i<r->OrdSize;
i++)
3304 ||(r->typ[
i].ord_typ==
ro_am))
3309 r->NegWeightL_Size=
l;
3310 r->NegWeightL_Offset=(
int *)
omAlloc(
l*
sizeof(
int));
3312 for(
i=0;
i<r->OrdSize;
i++)
3316 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3319 else if(r->typ[
i].ord_typ==
ro_am)
3321 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3328 r->NegWeightL_Size = 0;
3329 r->NegWeightL_Offset =
NULL;
3341 if ( (r->cf->extRing!=
NULL)
3350 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3367 r->pLexOrder=r->LexOrder;
3375 static inline int sign(
int x) {
return (
x > 0) - (
x < 0);}
3400 if (r->VarOffset!=
NULL && force == 0)
return FALSE;
3406 r->BitsPerExp = bits;
3411 long *tmp_ordsgn=(
long *)
omAlloc0(3*(n+r->N)*
sizeof(long));
3413 int *
v=(
int *)
omAlloc((r->N+1)*
sizeof(int));
3414 for(
i=r->N;
i>=0 ;
i--)
3431 switch (r->order[
i])
3435 rO_WDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3441 rO_WMDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3448 tmp_typ[typ_i], (
int64 *)(r->wvhdl[
i]));
3455 r->ComponentOrder=1;
3461 r->ComponentOrder=-1;
3467 k=r->block1[
i]-r->block0[
i]+1;
3472 r->wvhdl[
i]+(r->block1[
i]-r->block0[
i]+1)*
l);
3479 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i], prev_ordsgn,
3480 tmp_ordsgn,
v,bits, -1);
3485 tmp_ordsgn,
v, bits, -1);
3490 tmp_ordsgn,
v, bits, -1);
3494 rO_LexVars(
j, j_bits, r->block1[
i],r->block0[
i], prev_ordsgn,
3495 tmp_ordsgn,
v, bits, -1);
3499 if (r->block0[
i]==r->block1[
i])
3501 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3502 tmp_ordsgn,
v, bits, -1);
3510 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3515 if (r->block0[
i]==r->block1[
i])
3517 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3518 tmp_ordsgn,
v, bits, -1);
3525 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3526 tmp_ordsgn,
v, bits, r->block1[
i]);
3531 if (r->block0[
i]==r->block1[
i])
3534 tmp_ordsgn,
v,bits, -1);
3542 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3547 if (r->block0[
i]==r->block1[
i])
3550 tmp_ordsgn,
v, bits, -1);
3557 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3558 tmp_ordsgn,
v, bits, r->block1[
i]);
3564 tmp_typ[typ_i], r->wvhdl[
i]);
3569 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3571 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3573 if (have_bad_weights)
3580 if (r->block1[
i]!=r->block0[
i])
3583 tmp_ordsgn,
v,bits, r->block0[
i]);
3589 tmp_typ[typ_i], r->wvhdl[
i]);
3594 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3596 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3598 if (have_bad_weights)
3605 if (r->block1[
i]!=r->block0[
i])
3607 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3608 tmp_ordsgn,
v, bits, r->block1[
i]);
3614 tmp_typ[typ_i], r->wvhdl[
i]);
3616 if (r->block1[
i]!=r->block0[
i])
3619 tmp_ordsgn,
v,bits, r->block0[
i]);
3625 tmp_typ[typ_i], r->wvhdl[
i]);
3627 if (r->block1[
i]!=r->block0[
i])
3629 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3630 tmp_ordsgn,
v, bits, r->block1[
i]);
3637 rO_Syzcomp(
j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3638 need_to_add_comp=
TRUE;
3639 r->ComponentOrder=-1;
3645 rO_Syz(
j, j_bits, prev_ordsgn, r->block0[
i], tmp_ordsgn, tmp_typ[typ_i]);
3646 need_to_add_comp=
TRUE;
3647 r->ComponentOrder=-1;
3654 assume( r->block0[
i] == r->block1[
i] );
3655 const int s = r->block0[
i];
3659 rO_ISPrefix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ[typ_i++]);
3662 rO_ISSuffix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ, typ_i,
s);
3663 need_to_add_comp=
FALSE;
3682 j_bits=j_bits0;
j=j0;
3687 if((need_to_add_comp) && (
v[0]== -1))
3701 for(
i=1 ;
i<=r->N ;
i++)
3728 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3730 for(
j=0;
j<r->CmpL_Size;
j++)
3732 r->ordsgn[
j] = tmp_ordsgn[
j];
3741 if (typ_i==0) r->typ=
NULL;
3745 memcpy(r->typ,tmp_typ,typ_i*
sizeof(
sro_ord));
3755 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3758 if (
i==r->pCompIndex)
i++;
3759 while ((j < r->OrdSize)
3767 if (
i==r->pCompIndex)
i++;
3805 for(
int i=1;
i<=r->N;
i++)
3812 if ((r->block0[
j]<=
i)&&(r->block1[
j]>=
i))
3832 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3838 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3849 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3855 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3884 if (nonneg>0) r->MixedOrder=1;
3895 if (r ==
NULL)
return;
3896 if (r->VarOffset !=
NULL)
3898 if (r->OrdSize!=0 && r->typ !=
NULL)
3900 for(
int i = 0;
i < r->OrdSize;
i++)
3901 if( r->typ[
i].ord_typ ==
ro_is)
3904 r->typ[
i].data.is.F =
NULL;
3906 if( r->typ[
i].data.is.pVarOffset !=
NULL )
3909 r->typ[
i].data.is.pVarOffset =
NULL;
3912 else if (r->typ[
i].ord_typ ==
ro_syz)
3914 if(r->typ[
i].data.syz.limit > 0)
3915 omFreeSize(r->typ[
i].data.syz.syz_index, ((r->typ[
i].data.syz.limit) +1)*
sizeof(
int));
3916 r->typ[
i].data.syz.syz_index =
NULL;
3920 assume( r->typ[
i].data.syzcomp.ShiftedComponents ==
NULL );
3921 assume( r->typ[
i].data.syzcomp.Components ==
NULL );
3931 if (r->PolyBin !=
NULL)
3936 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
3938 if (r->p_Procs !=
NULL)
3940 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
3942 if (r->NegWeightL_Offset!=
NULL)
3944 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
3945 r->NegWeightL_Offset=
NULL;
3953 int* VarL_Number = (
int*)
omAlloc0(r->ExpL_Size*
sizeof(
int));
3958 for (
i=1;
i<=r->N;
i++)
3960 VarL_Number[r->VarOffset[
i] & 0xffffff]++;
3964 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
3966 if (VarL_Number[
i] != 0)
3968 if (
min > VarL_Number[
i])
3970 min = VarL_Number[
i];
3979 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
3980 r->VarL_LowIndex = 0;
3983 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
3985 if (VarL_Number[
i] != 0)
3987 r->VarL_Offset[
j] =
i;
3988 if (
j > 0 && r->VarL_Offset[
j-1] != r->VarL_Offset[
j] - 1)
3989 r->VarL_LowIndex = -1;
3993 if (r->VarL_LowIndex >= 0)
3994 r->VarL_LowIndex = r->VarL_Offset[0];
3998 j = r->VarL_Offset[min_j];
3999 r->VarL_Offset[min_j] = r->VarL_Offset[0];
4000 r->VarL_Offset[0] =
j;
4007 int* shifts = (
int*)
omAlloc(r->ExpL_Size*
sizeof(
int));
4010 for (
i=0;
i<r->ExpL_Size;
i++)
4014 for (
i=1;
i<=r->N;
i++)
4016 if (shifts[r->VarOffset[
i] & 0xffffff] > r->VarOffset[
i] >> 24)
4017 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
4020 for (
i=1;
i<=r->N;
i++)
4022 if (shifts[r->VarOffset[
i] & 0xffffff] != 0)
4024 = (r->VarOffset[
i] & 0xffffff) |
4025 (((r->VarOffset[
i] >> 24) - shifts[r->VarOffset[
i] & 0xffffff]) << 24);
4033 unsigned long divmask = 1;
4038 divmask |= (((
unsigned long) 1) << (
unsigned long)
i);
4053 const char *TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
4054 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
4057 Print(
"ExpL_Size:%d ",r->ExpL_Size);
4058 Print(
"CmpL_Size:%d ",r->CmpL_Size);
4059 Print(
"VarL_Size:%d\n",r->VarL_Size);
4060 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4061 Print(
"divmask=%lx\n", r->divmask);
4062 Print(
"BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4064 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
4065 PrintS(
"VarL_Offset:\n");
4068 for(
j = 0;
j < r->VarL_Size;
j++)
4069 Print(
" VarL_Offset[%d]: %d ",
j, r->VarL_Offset[
j]);
4076 for(
j=0;
j<=r->N;
j++)
4077 Print(
" v%d at e-pos %d, bit %d\n",
4078 j,r->VarOffset[
j] & 0xffffff, r->VarOffset[
j] >>24);
4080 for(
j=0;
j<r->CmpL_Size;
j++)
4081 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[
j],
j);
4082 Print(
"OrdSgn:%d\n",r->OrdSgn);
4084 for(
j=0;
j<r->OrdSize;
j++)
4086 Print(
" typ %s", TYP[r->typ[
j].ord_typ]);
4087 if (r->typ[
j].ord_typ==
ro_syz)
4089 const short place = r->typ[
j].data.syz.place;
4090 const int limit = r->typ[
j].data.syz.limit;
4091 const int curr_index = r->typ[
j].data.syz.curr_index;
4092 const int* syz_index = r->typ[
j].data.syz.syz_index;
4094 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4096 if( syz_index ==
NULL )
4101 for(
i=0;
i <= limit;
i++ )
4102 Print(
"%d ", syz_index[
i]);
4109 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[
j].data.isTemp.start, r->typ[
j].data.isTemp.suffixpos);
4112 else if (r->typ[
j].ord_typ==
ro_is)
4114 Print(
" start %d, end: %d: ",r->typ[
j].data.is.start, r->typ[
j].data.is.end);
4118 Print(
" limit %d",r->typ[
j].data.is.limit);
4125 else if (r->typ[
j].ord_typ==
ro_am)
4127 Print(
" place %d",r->typ[
j].data.am.place);
4128 Print(
" start %d",r->typ[
j].data.am.start);
4129 Print(
" end %d",r->typ[
j].data.am.end);
4130 Print(
" len_gen %d",r->typ[
j].data.am.len_gen);
4133 for(
l=r->typ[
j].data.am.start;l<=r->typ[
j].data.am.end;
l++)
4134 Print(
" %d",r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start]);
4135 l=r->typ[
j].data.am.end+1;
4136 int ll=r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start];
4138 for(
int lll=
l+1;lll<
l+ll+1;lll++)
4139 Print(
" %d",r->typ[
j].data.am.weights[lll-r->typ[
j].data.am.start]);
4143 Print(
" place %d",r->typ[
j].data.dp.place);
4147 Print(
" start %d",r->typ[
j].data.dp.start);
4148 Print(
" end %d",r->typ[
j].data.dp.end);
4149 if ((r->typ[
j].ord_typ==
ro_wp)
4153 for(
int l=r->typ[
j].data.wp.start;l<=r->typ[
j].data.wp.end;
l++)
4154 Print(
" %d",r->typ[
j].data.wp.weights[
l-r->typ[
j].data.wp.start]);
4156 else if (r->typ[
j].ord_typ==
ro_wp64)
4160 for(
l=r->typ[
j].data.wp64.start;l<=r->typ[
j].data.wp64.end;
l++)
4161 Print(
" %ld",(
long)(((
int64*)r->typ[
j].data.wp64.weights64)+
l-r->typ[
j].data.wp64.start));
4167 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4168 Print(
"OrdSize:%d\n",r->OrdSize);
4169 PrintS(
"--------------------\n");
4170 for(
j=0;
j<r->ExpL_Size;
j++)
4173 if (j< r->CmpL_Size)
4174 Print(
"ordsgn %ld ", r->ordsgn[
j]);
4180 if( (r->VarOffset[
i] & 0xffffff) ==
j )
4181 {
Print(
"v%d at e[%d], bit %d; ",
i,r->VarOffset[
i] & 0xffffff,
4182 r->VarOffset[
i] >>24 ); }
4184 if( r->pCompIndex==
j )
PrintS(
"v0; ");
4185 for(
i=0;
i<r->OrdSize;
i++)
4187 if (r->typ[
i].data.dp.place ==
j)
4189 Print(
"ordrec:%s (start:%d, end:%d) ",TYP[r->typ[
i].ord_typ],
4190 r->typ[
i].data.dp.start, r->typ[
i].data.dp.end);
4194 if (
j==r->pOrdIndex)
4199 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4201 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4202 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4204 for(
j = 0;
j < r->NegWeightL_Size;
j++)
4205 Print(
" [%d]: %d ",
j, r->NegWeightL_Offset[
j]);
4216 Print(
"p_Spec : %s, %s, %s\n", field,
length, ord);
4218 for (
i=0;
i<(int) (
sizeof(
p_Procs_s)/
sizeof(
void*));
i++)
4220 Print(
" %s,\n", ((
char**) &proc_names)[
i]);
4226 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4232 Print(
"(%p)", r->pFDeg);
4235 Print(
"pLDeg : (%p)", r->pLDeg);
4247 else Print(
"%p\n",r->p_Setm);
4257 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4258 for(
i=0;
i<r->ExpL_Size;
i++)
4266 if (
j==0) {
PrintS(
"...\n");
break; }
4275 Print(
"\nexp[0..%d]\n",
R->ExpL_Size - 1);
4276 for(
int i = 0;
i <
R->ExpL_Size;
i++)
4295 for(
int j = (F->ncols*F->nrows) - 1;
j >= 0;
j-- )
4309 Print(
"gen[%d] -> gen(%d)\n", c,
MIN + (*V)[ c -
MIN - 1 ]);
4333 r->typ[1].data.syzcomp.Components = currComponents;
4341 *currComponents = r->typ[1].data.syzcomp.Components;
4351 r->typ[1].data.syzcomp.length =
length;
4361 *
length = r->typ[1].data.syzcomp.length;
4403 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4414 int ** wvhdl =(
int **)
omAlloc0((
i+1)*
sizeof(
int**));
4417 res->order[
j]=r->order[
j-1];
4418 res->block0[
j]=r->block0[
j-1];
4419 res->block1[
j]=r->block1[
j-1];
4420 if (r->wvhdl[
j-1] !=
NULL)
4438 WarnS(
"error in nc_rComplete");
4448 if (r->qideal!=
NULL)
4478 pos=r->VarL_LowIndex;
4483 for(
int i=r->OrdSize-1;
i>=0;
i--)
4485 if ((r->typ[
i].ord_typ==
ro_dp)
4486 && (r->typ[
i].data.dp.start==1)
4487 && (r->typ[
i].data.dp.end==r->N))
4489 pos=r->typ[
i].data.dp.place;
4509 res->ExpL_Size=r->ExpL_Size+1;
4513 for(
j=0;
j<r->CmpL_Size;
j++)
4515 res->ordsgn[
j] = r->ordsgn[
j];
4517 res->OrdSize=r->OrdSize+1;
4522 memcpy(
res->typ,r->typ,r->OrdSize*
sizeof(
sro_ord));
4526 res->typ[
res->OrdSize-1].data.dp.start=1;
4527 res->typ[
res->OrdSize-1].data.dp.end=
res->N;
4528 res->typ[
res->OrdSize-1].data.dp.place=
res->ExpL_Size-1;
4529 pos=
res->ExpL_Size-1;
4545 WarnS(
"error in nc_rComplete");
4551 if (r->qideal!=
NULL)
4581 if (r->order[
i] == 0)
4590 new_r->wvhdl=(
int **)
omAlloc0(
i *
sizeof(
int *));
4592 new_r->block0 = (
int *)
omAlloc0(
i *
sizeof(
int));
4593 new_r->block1 = (
int *)
omAlloc0(
i *
sizeof(
int));
4595 memcpy(new_r->block0,r->block0,(
i-1) *
sizeof(
int));
4596 memcpy(new_r->block1,r->block1,(
i-1) *
sizeof(
int));
4597 for (
int j=0;
j<=last_block;
j++)
4599 if (r->wvhdl[
j]!=
NULL)
4601 new_r->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[
j]);
4618 WarnS(
"error in nc_rComplete");
4630 int last_block =
rBlocks(r) - 2;
4637 for (
i=0;
i< last_block;
i++)
4648 for (
i=c_pos+1;
i<=last_block;
i++)
4650 new_r->order[
i-1] = new_r->order[
i];
4651 new_r->block0[
i-1] = new_r->block0[
i];
4652 new_r->block1[
i-1] = new_r->block1[
i];
4653 new_r->wvhdl[
i-1] = new_r->wvhdl[
i];
4655 new_r->order[last_block] = r->order[c_pos];
4656 new_r->block0[last_block] = r->block0[c_pos];
4657 new_r->block1[last_block] = r->block1[c_pos];
4658 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4669 WarnS(
"error in nc_rComplete");
4694 if (new_r_1 != new_r && new_r_1 != old_r)
rDelete(new_r_1);
4702 # ifndef SING_NDEBUG
4703 WarnS(
"error in nc_rComplete");
4710 if (old_r->qideal !=
NULL)
4712 new_r->qideal =
idrCopyR(old_r->qideal, old_r, new_r);
4720 WarnS(
"error in nc_SetupQuotient");
4745 if ((r_blocks == 3) &&
4746 (r->order[0] == b1) &&
4747 (r->order[1] == b2) &&
4760 res->block1[1] = r->N;
4765 res->block1[0] = r->N;
4775 WarnS(
"error in nc_rComplete");
4788 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete,
sgn);
4805 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
4813 res->block0[
j] =
res->block1[
j] = 0;
4817 for(
int i = 0; (
i <= n) && (r->order[
i] != 0);
i++,
j++)
4819 res->order [
j] = r->order [
i];
4820 res->block0[
j] = r->block0[
i];
4821 res->block1[
j] = r->block1[
i];
4823 if (r->wvhdl[
i] !=
NULL)
4855 WarnS(
"error in nc_rComplete");
4867 if (r->qideal!=
NULL)
4924 Print(
"rIsIS(p: %d)\nF:",
p);
4935 for(
int pos = 0; pos < r->OrdSize; pos++ )
4936 if( r->typ[pos].ord_typ ==
ro_is)
4958 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4967 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4972 if(
i != r->typ[pos].data.is.limit )
4973 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit,
i);
4976 const ideal FF =
idrHeadR(F, r, r);
4979 if( r->typ[pos].data.is.F !=
NULL)
4982 PrintS(
"Deleting old reference set F... \n");
4985 r->typ[pos].data.is.F =
NULL;
4990 r->typ[pos].data.is.F = FF;
4992 r->typ[pos].data.is.limit =
i;
5016 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
5018 r->block0[0]=r->block1[0] =
k;
5019 if(
k == r->typ[0].data.syz.limit )
5023 if (r->typ[0].data.syz.limit == 0)
5025 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((
k+1)*
sizeof(int));
5026 r->typ[0].data.syz.syz_index[0] = 0;
5027 r->typ[0].data.syz.curr_index = 1;
5031 r->typ[0].data.syz.syz_index = (
int*)
5033 (r->typ[0].data.syz.limit+1)*
sizeof(int),
5036 for (
i=r->typ[0].data.syz.limit + 1;
i<=
k;
i++)
5038 r->typ[0].data.syz.syz_index[
i] =
5039 r->typ[0].data.syz.curr_index;
5041 if(k < r->typ[0].data.syz.limit)
5044 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)",
k, r->typ[0].data.syz.limit);
5046 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5050 r->typ[0].data.syz.limit =
k;
5051 r->typ[0].data.syz.curr_index++;
5060 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!",
k);
5065 r->block0[0] = r->block1[0] =
k;
5080 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5081 r->typ[0].data.syz.limit > 0 &&
i > 0)
5083 assume(i <= r->typ[0].data.syz.limit);
5085 for (
j=0;
j<r->typ[0].data.syz.limit;
j++)
5087 if (r->typ[0].data.syz.syz_index[
j] ==
i &&
5088 r->typ[0].data.syz.syz_index[
j+1] !=
i)
5090 assume(r->typ[0].data.syz.syz_index[
j+1] ==
i+1);
5094 return r->typ[0].data.syz.limit;
5099 WarnS(
"rGetMaxSyzComp: order c");
5109 for (
i=0;
i<nb;
i++)
5111 if (r->wvhdl[
i] !=
NULL)
5113 int length = r->block1[
i] - r->block0[
i];
5114 int* wvhdl = r->wvhdl[
i];
5120 if (wvhdl[
j] != 0 && wvhdl[
j] != 1)
return FALSE;
5139 while((r->typ[
i].ord_typ!=
ro_wp64) && (r->typ[
i].ord_typ>0))
i++;
5141 return (
int64*)(r->typ[
i].data.wp64.weights64);
5149 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*
sizeof(
int64));
5160 for(
int k=
size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5166 static int rReallocM1(ring r,
int size,
int pos)
5172 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5180 for(
int j=0;
j<=i2;
j++)
5188 #define rOppVar(R,I) (rVar(R)+1-I)
5214 int i2 = (
rVar(r)-1)/2;
5215 for(
i=i2;
i>=0;
i--)
5221 p = r->names[
rVar(r)-1-
i];
5222 r->names[
rVar(r)-1-
i] = r->names[
i];
5239 char *
p=r->names[
i];
5240 if(isupper(*
p)) *
p = tolower(*
p);
5241 else *
p = toupper(*
p);
5288 for(
i=0; src->order[
i]!=0;
i++)
5290 switch (src->order[
i])
5295 r->order[
j]=src->order[
i];
5299 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5300 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5304 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5305 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5311 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5312 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5313 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5314 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5315 r->wvhdl[
j][
k-r->block0[
j]]=1;
5318 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5319 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5327 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5328 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5329 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5330 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5331 r->wvhdl[
j][
k-r->block0[
j]]=1;
5334 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5335 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5343 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5344 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5345 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5349 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5350 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5358 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5359 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5360 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5364 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5365 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 int n=r->block1[
j]-r->block0[
j];
5376 for (
int nn=0; nn<=n; nn++)
5385 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5386 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5444 int *par_perm =
NULL;
5447 for(
i=1;
i<=r->N;
i++)
5463 MATELEM(C,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5466 MATELEM(
D,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5474 WarnS(
"Error initializing non-commutative multiplication!");
5482 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5489 if (src->qideal !=
NULL)
5494 r->qideal =
idOppose(src, src->qideal, r);
5496 r->qideal =
id_Copy(src->qideal, r);
5526 int stat =
rSum(
R, Ropp, Renv);
5528 WarnS(
"Error in rEnvelope at rSum");
5551 const int N = dest->N;
5560 const ring srcBase = src;
5567 matrix C0 = src->GetNC()->C;
5568 matrix D0 = src->GetNC()->D;
5571 for (
int i = 1;
i <
N;
i++)
5573 for (
int j =
i + 1;
j <=
N;
j++)
5576 const poly
p =
p_NSet(n, dest);
5618 while(r->order[
i]!=0)
5625 for(
j=r->block1[
i]-r->block0[
i];
j>=0;
j--)
5627 r->wvhdl[
i]=(
int*)w64;
5661 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
5670 WerrorS(
"only for rings with an ordering of one block");
5687 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5690 for(
int i=r->N-1;
i>=0;
i--)
5692 if (strcmp(r->names[
i],
v)==0)
5694 Werror(
"duplicate variable name >>%s<<",
v);
5700 #ifdef HAVE_SHIFTBBA
5703 R->isLPring=r->isLPring+1;
5704 R->N=((r->N)/r->isLPring)+r->N;
5708 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5711 for(
int i=
R->isLPring-1;
i>0;
i--)
5712 names[
i+
b*
R->isLPring]=
R->names[
i-1+
b*r->isLPring];
5717 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5720 for(
int i=
R->isLPring-2;
i>=0;
i--)
5721 names[
i+
b*
R->isLPring]=
R->names[
i+
b*r->isLPring];
5733 for(
int i=
R->N-1;
i>0;
i--) names[
i]=
R->names[
i-1];
5738 for(
int i=
R->N-2;
i>=0;
i--) names[
i]=
R->names[
i];
5752 WerrorS(
"only for rings with an ordering of one block");
5769 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5776 if (strcmp(
R->names[
i],
v)==0)
5780 for(
int j=
i;
j<
R->N;
j++)
R->names[
j]=
R->names[
j+1];
int sgn(const Rational &a)
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
static int si_max(const int a, const int b)
const CanonicalForm CFMap CFMap & N
for(int i=0;i<=n;i++) degsf[i]
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
@ n_R
single prescision (6,6) real numbers
@ n_polyExt
used to represent polys as coeffcients
@ n_Q
rational (GMP) numbers
@ n_Znm
only used if HAVE_RINGS is defined
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_Zn
only used if HAVE_RINGS is defined
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
void nKillChar(coeffs r)
undo all initialisations
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
static int min(int a, int b)
void WerrorS(const char *s)
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static BOOLEAN length(leftv result, leftv arg)
static bool rIsSCA(const ring r)
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
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,...
static nc_type & ncRingType(nc_struct *p)
void nc_rKill(ring r)
complete destructor
#define UPMATELEM(i, j, nVar)
bool sca_Force(ring rGR, int b, int e)
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)
void mp_Delete(matrix *a, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
#define MATELEM(mat, i, j)
1-based access to matrix
int dReportError(const char *fmt,...)
gmp_float sqrt(const gmp_float &a)
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omFreeSize(addr, size)
#define omCheckAddr(addr)
#define omReallocSize(addr, o_size, size)
#define omCheckAddrSize(addr, size)
#define omFreeBin(addr, bin)
#define omcheckAddrSize(addr, size)
#define omfreeSize(addr, size)
size_t omSizeOfAddr(const void *addr)
#define omGetSpecBin(size)
#define omUnGetSpecBin(bin_ptr)
#define TEST_RINGDEP_OPTS
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
long pLDegb(poly p, int *l, const ring r)
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
long p_WFirstTotalDegree(poly p, const ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
void p_Setm_Dummy(poly p, const ring r)
void p_Setm_TotalDegree(poly p, const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
long pLDeg1c_Deg(poly p, int *l, const ring r)
long pLDeg1(poly p, int *l, 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)
long pLDeg1_Deg(poly p, int *l, const ring r)
long p_WTotaldegree(poly p, const ring r)
p_SetmProc p_GetSetmProc(const ring r)
void p_Setm_General(poly p, const ring r)
long pLDeg1c(poly p, int *l, const ring r)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
long pLDeg0c(poly p, int *l, const ring r)
long pLDeg0(poly p, int *l, const ring r)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
long p_Deg(poly a, const ring r)
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static long p_FDeg(const poly p, const ring r)
void p_Write(poly p, ring lmRing, ring tailRing)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static void p_Setm(poly p, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
static void p_Delete(poly *p, const ring r)
void p_Write0(poly p, ring lmRing, ring tailRing)
static long p_Totaldegree(poly p, const ring r)
void p_wrp(poly p, ring lmRing, ring tailRing)
poly prCopyR(poly p, ring src_r, ring dest_r)
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
void StringSetS(const char *st)
void StringAppendS(const char *st)
void PrintS(const char *s)
void Werror(const char *fmt,...)
static void rSetNegWeight(ring r)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
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)
int rSum(ring r1, ring r2, ring &sum)
ring rAssure_TDeg(ring r, int &pos)
void rWrite(ring r, BOOLEAN details)
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
BOOLEAN rHasSimpleOrderAA(ring r)
void rSetWeightVec(ring r, int64 *wv)
const char * rSimpleOrdStr(int ord)
static void rSetOption(ring r)
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...
int r_IsRingVar(const char *n, char **names, int N)
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!...
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
BOOLEAN rHasSimpleLexOrder(const ring r)
returns TRUE, if simple lp or ls ordering
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
BOOLEAN rRing_has_CompLastBlock(ring r)
void p_DebugPrint(poly p, const ring r)
void rKillModifiedRing(ring r)
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
BOOLEAN rRing_is_Homog(ring r)
ring rAssure_c_dp(const ring r)
static void rSetOutParams(ring r)
static void rSetDegStuff(ring r)
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
rOrderType_t rGetOrderType(ring r)
int rTypeOfMatrixOrder(const intvec *order)
ring nc_rCreateNCcomm_rCopy(ring r)
static void rOppWeight(int *w, int l)
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
void rKillModified_Wp_Ring(ring r)
ring rMinusVar(const ring r, char *v)
undo rPlusVar
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
ring rAssure_C_dp(const ring r)
BOOLEAN rHasSimpleOrder(const ring r)
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
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,...
ring rAssure_HasComp(const ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
BOOLEAN rHas_c_Ordering(const ring r)
static int rRealloc1(ring r, int size, int pos)
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
void rDebugPrint(const ring r)
static void rCheckOrdSgn(ring r, int i)
poly rGetVar(const int varIndex, const ring r)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
static void m_DebugPrint(const poly p, const ring R)
debug-print monomial poly/vector p, assuming that it lives in the ring R
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
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...
int64 * rGetWeightVec(const ring r)
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
static void rOptimizeLDeg(ring r)
BOOLEAN rCheckIV(const intvec *iv)
rRingOrder_t rOrderName(char *ordername)
void rModify_a_to_A(ring r)
void rDelete(ring r)
unconditionally deletes fields in 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 void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
BOOLEAN rIsPolyVar(int v, const ring r)
returns TRUE if var(i) belongs to p-block
static void rSetFirstWv(ring r, int i, rRingOrder_t *order, int *block1, int **wvhdl)
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
static void rO_Align(int &place, int &bitplace)
ring rAssure_dp_S(const ring r)
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
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,...
void rSetSyzComp(int k, const ring r)
static const char *const ringorder_name[]
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
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)
ring rAssure_dp_C(const ring r)
BOOLEAN rDBTest(ring r, const char *fn, const int l)
static BOOLEAN rField_is_Ring(const ring r)
static int rBlocks(ring r)
struct p_Procs_s p_Procs_s
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static char const ** rParameter(const ring r)
(r->cf->parameter)
static int rPar(const ring r)
(r->cf->P)
static BOOLEAN rIsLPRing(const ring r)
@ ringorder_a64
for int64 weights
@ ringorder_rs
opposite of ls
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_IS
Induced (Schreyer) ordering.
static BOOLEAN rField_is_Q(const ring r)
static BOOLEAN rShortOut(const ring r)
@ rOrderType_CompExp
simple ordering, component has priority
@ rOrderType_Exp
simple ordering, exponent vector has priority component is compatible with exp-vector order
@ rOrderType_General
non-simple ordering as specified by currRing
@ rOrderType_ExpComp
simple ordering, exponent vector has priority component not compatible with exp-vector order
static BOOLEAN rIsNCRing(const ring r)
static BOOLEAN rCanShortOut(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
ideal SCAQuotient(const ring r)
static short scaLastAltVar(ring r)
static short scaFirstAltVar(ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
EXTERN_VAR long * currShiftedComponents
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,