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 if (bitmask!=0) r->wanted_maxExp=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;
248 PrintS(
"// coefficients: ");
260 R->ShortOut = bSaveShortOut;
303 Print(
"// number of vars : %d",r->N);
308 for (
int l=0, nlen=0 ;
l<nblocks;
l++)
311 Print(
"\n// block %3d : ",
l+1);
318 assume( r->block0[
l] == r->block1[
l] );
319 const int s = r->block0[
l];
327 Print(
" syz_comp: %d",r->block0[
l]);
339 for (
i = r->block0[
l]-1; i<r->block1[
l];
i++)
341 nlen = strlen(r->names[
i]);
346 if (r->wvhdl[
l]!=
NULL)
357 Warn(
"should not have wvhdl entry at pos. %d",
l);
361 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
364 PrintS(
"\n// : weights ");
365 for (
i = 0;
i<=r->block1[
l]-r->block0[
l];
i++)
377 Print(
" %*d" ,nlen,r->wvhdl[
l][
i+
j]);
383 int m=r->wvhdl[
l][
i];
384 Print(
"\n// : %d module weights ",
m);
386 for(;
i<=
m;
i++)
Print(
" %*d" ,nlen,r->wvhdl[
l][
i]);
393 PrintS(
"\n// noncommutative relations:");
399 for (
i = 1;
i<r->N;
i++)
401 for (
j =
i+1;
j<=r->N;
j++)
406 Print(
"\n// %s%s=",r->names[
j-1],r->names[
i-1]);
417 Print(
"\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
422 PrintS(
"\n// quotient of sca by ideal");
435 Print(
"\n// letterplace ring (block size %d, ncgen count %d)",r->isLPring, r->LPncGenCount);
440 PrintS(
"\n// quotient ring from ideal");
453 if (r ==
NULL)
return;
460 if( r->qideal !=
NULL )
475 if (r->order !=
NULL)
486 if (r->wvhdl[
j]!=
NULL)
499 for (
i=0;
i<r->N;
i++)
518 if (order==0)
Werror(
"wrong ring order `%s`",ordername);
528 for (nblocks=0; r->order[nblocks]; nblocks++);
547 if (r->wvhdl[
l]!=
NULL)
558 Warn(
"should not have wvhdl entry at pos. %d",
l);
566 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
573 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
582 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
592 if (
j+
i+1==(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1))
603 assume( r->block0[
l] == r->block1[
l] );
604 const int s = r->block0[
l];
612 if (r->wanted_maxExp!=0)
614 long mm=r->wanted_maxExp;
631 for (
i=0;
i<r->N;
i++)
633 l+=strlen(r->names[
i])+1;
637 for (
i=0;
i<r->N-1;
i++)
639 strcat(
s,r->names[
i]);
642 strcat(
s,r->names[
i]);
654 char const *
const *
const params =
rParameter(r);
661 l+=strlen(params[
i])+1;
667 strcat(
s, params[
i]);
670 strcat(
s, params[
i]);
681 char *
res=(
char *)
omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
682 sprintf(
res,
"(%s),(%s),(%s)",ch,var,ord);
714 int rChar(ring r) {
return r->cf->ch; }
729 for(
int i=1;
i<r->N;
i++)
730 for(
int j=
i+1;
j<=r->N;
j++)
734 WarnS(
"Error initializing multiplication!");
754 memset(&tmpR,0,
sizeof(tmpR));
789 && (mpz_cmp(r1->cf->modNumber,r2->cf->extRing->cf->modNumber)==0))
822 if (r1->cf->extRing->cf==r2->cf)
832 WerrorS (
"coeff sum of two extension fields not implemented");
838 WerrorS(
"coeff sum not yet implemented");
845 char **names=(
char **)
omAlloc0(
l*
sizeof(
char *));
850 for (
i=0;
i<r1->N;
i++)
854 if (*(r1->names[
i]) ==
'\0')
886 if (*(r2->names[
i]) ==
'\0')
909 if (strcmp(r1->names[
j],r2->names[
i])==0)
978 if ((r2->block0[0]==1)
979 && (r2->block1[0]==
rVar(r2))
985 tmpR.
order[1]=r2->order[0];
986 if (r2->wvhdl[0]!=
NULL)
1052 if (rb->wvhdl[
i]!=
NULL)
1053 WarnS(
"rSum: weights not implemented");
1059 for (
i=0;r1->order[
i]!=0;
i++)
1064 if (r1->wvhdl[
i]!=
NULL)
1075 for (
i=0;r2->order[
i]!=0;
i++)
1083 if (r2->wvhdl[
i]!=
NULL)
1090 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1110 if (r1->wvhdl[
i]!=
NULL)
1121 Werror(
"variables must not overlap (# of vars: %d,%d -> %d)",
rVar(r1),
rVar(r2),
k);
1127 memcpy(sum,&tmpR,
sizeof(
ip_sring));
1144 if ( (R1_is_nc) || (R2_is_nc))
1168 int *perm1 = (
int *)
omAlloc0((
rVar(R1)+1)*
sizeof(int));
1169 int *par_perm1 =
NULL;
1172 int *perm2 = (
int *)
omAlloc0((
rVar(R2)+1)*
sizeof(int));
1173 int *par_perm2 =
NULL;
1178 perm1, par_perm1, sum->cf->type);
1182 perm2, par_perm2, sum->cf->type);
1185 matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1186 matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1195 for (
i = 1;
i <=
rVar(R1);
i++)
1208 MATELEM(C,
i,
j) =
p_PermPoly(
MATELEM(C1,
i,
j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1211 MATELEM(
D,
i,
j) =
p_PermPoly(
MATELEM(D1,
i,
j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1224 MATELEM(C,
rVar(R1)+
i,
rVar(R1)+
j) =
p_PermPoly(
MATELEM(C2,
i,
j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1227 MATELEM(
D,
rVar(R1)+
i,
rVar(R1)+
j) =
p_PermPoly(
MATELEM(D2,
i,
j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1235 WarnS(
"Error initializing non-commutative multiplication!");
1244 Print(
"\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1267 if (r1->qideal!=
NULL)
1278 int *perm1 = (
int *)
omAlloc0((
rVar(r1)+1)*
sizeof(int));
1279 int *par_perm1 =
NULL;
1283 perm1, par_perm1, sum->cf->type);
1287 for (
int for_i=0;for_i<
IDELEMS(r1->qideal);for_i++)
1289 r1->qideal->m[for_i], perm1,
1292 par_perm1,
rPar(r1));
1297 if (r2->qideal!=
NULL)
1301 int *perm2 = (
int *)
omAlloc0((
rVar(r2)+1)*
sizeof(int));
1302 int *par_perm2 =
NULL;
1306 perm2, par_perm2, sum->cf->type);
1310 for (
int for_i=0;for_i<
IDELEMS(r2->qideal);for_i++)
1312 r2->qideal->m[for_i], perm2,
1315 par_perm2,
rPar(r2));
1347 int rSum(ring r1, ring r2, ring &sum)
1373 res->options=r->options;
1388 res->firstBlockEnds=r->firstBlockEnds;
1390 res->real_var_start=r->real_var_start;
1391 res->real_var_end=r->real_var_end;
1394 #ifdef HAVE_SHIFTBBA
1395 res->isLPring=r->isLPring;
1396 res->LPncGenCount=r->LPncGenCount;
1399 res->VectorOut=r->VectorOut;
1400 res->ShortOut=r->ShortOut;
1401 res->CanShortOut=r->CanShortOut;
1417 res->bitmask=r->bitmask;
1418 res->divmask=r->divmask;
1419 res->BitsPerExp = r->BitsPerExp;
1420 res->ExpPerLong = r->ExpPerLong;
1439 if (copy_ordering ==
TRUE)
1441 res->LexOrder=r->LexOrder;
1442 res->MixedOrder=r->MixedOrder;
1450 if (r->wvhdl[
j]!=
NULL)
1458 memcpy(
res->block0,r->block0,
i *
sizeof(
int));
1459 memcpy(
res->block1,r->block1,
i *
sizeof(
int));
1474 if (r->qideal!=
NULL)
1503 res->options=r->options;
1518 res->firstBlockEnds=r->firstBlockEnds;
1520 res->real_var_start=r->real_var_start;
1521 res->real_var_end=r->real_var_end;
1524 #ifdef HAVE_SHIFTBBA
1525 res->isLPring=r->isLPring;
1526 res->LPncGenCount=r->LPncGenCount;
1529 res->VectorOut=r->VectorOut;
1530 res->ShortOut=r->ShortOut;
1531 res->CanShortOut=r->CanShortOut;
1532 res->LexOrder=r->LexOrder;
1533 res->MixedOrder=r->MixedOrder;
1549 res->bitmask=r->bitmask;
1550 res->divmask=r->divmask;
1551 res->BitsPerExp = r->BitsPerExp;
1552 res->ExpPerLong = r->ExpPerLong;
1571 if (copy_ordering ==
TRUE)
1578 for (
j=0;
j<
i-1;
j++)
1580 if (r->wvhdl[
j]!=
NULL)
1588 memcpy(&(
res->block0[1]),r->block0,(
i-1) *
sizeof(
int));
1589 memcpy(&(
res->block1[1]),r->block1,(
i-1) *
sizeof(
int));
1607 res->wvhdl[0]=(
int *)
A;
1617 if (r->qideal!=
NULL)
1623 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1628 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1665 if (r1 == r2)
return TRUE;
1667 if (r1->cf!=r2->cf)
return FALSE;
1669 if (r1->bitmask!=r2->bitmask)
return FALSE;
1670 #ifdef HAVE_SHIFTBBA
1671 if (r1->isLPring!=r2->isLPring)
return FALSE;
1672 if (r1->LPncGenCount!=r2->LPncGenCount)
return FALSE;
1682 if ((r1->names[
i] !=
NULL) && (r2->names[
i] !=
NULL))
1684 if (strcmp(r1->names[
i], r2->names[
i]))
return FALSE;
1686 else if ((r1->names[
i] !=
NULL) ^ (r2->names[
i] !=
NULL))
1694 if (r1->qideal !=
NULL)
1696 ideal id1 = r1->qideal, id2 = r2->qideal;
1710 else if (r2->qideal !=
NULL)
return FALSE;
1720 if (r1 == r2)
return TRUE;
1724 if ((r1->cf != r2->cf)
1726 || (r1->OrdSgn != r2->OrdSgn))
1730 while (r1->order[
i] != 0)
1732 if (r2->order[
i] == 0)
return FALSE;
1733 if ((r1->order[
i] != r2->order[
i])
1734 || (r1->block0[
i] != r2->block0[
i])
1735 || (r1->block1[
i] != r2->block1[
i]))
1737 if (r1->wvhdl[
i] !=
NULL)
1739 if (r2->wvhdl[
i] ==
NULL)
1741 for (
j=0;
j<r1->block1[
i]-r1->block0[
i]+1;
j++)
1742 if (r2->wvhdl[
i][
j] != r1->wvhdl[
i][
j])
1748 if (r2->order[
i] != 0)
return FALSE;
1809 if (blocks == 1)
return TRUE;
1818 if ((blocks -
s) > 2)
return FALSE;
1884 if (blocks == 1)
return TRUE;
1893 if ((blocks -
s) > 3)
return FALSE;
1896 if ((blocks -
s) == 3)
1915 for (pos=0;pos<r->OrdSize;pos++)
1933 return (
rVar(r) > 1 &&
1939 ((r->order[1]!=0) &&
1947 return ((
rVar(r) > 1) &&
1956 while(r->order[
i]!=0)
1958 if((r->block0[
i]<=
v)
1959 && (r->block1[
i]>=
v))
1964 return (r->wvhdl[
i][
v-r->block0[
i]]>0);
2003 if (r->N == 0)
return TRUE;
2005 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2017 for(
int j=0;
j<=
i;
j++)
2020 dError(
"wrong order in r->order");
2031 if (r->VarOffset ==
NULL)
2033 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d", fn,
l);
2038 if ((r->OrdSize==0)!=(r->typ==
NULL))
2040 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
2046 for(
i=0;
i<=r->N;
i++)
2050 for(
j=0;
j<r->OrdSize;
j++)
2054 const int p = r->typ[
j].data.isTemp.suffixpos;
2059 assume( p < r->OrdSize );
2061 if(r->typ[
p].ord_typ !=
ro_is)
2062 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",
j,
p);
2065 if(r->typ[
j].data.isTemp.pVarOffset[
i] != -1)
2071 else if (r->typ[
j].ord_typ ==
ro_is)
2074 if(r->typ[
j].data.is.pVarOffset[
i] != -1)
2082 if (r->typ[
j].ord_typ==
ro_cp)
2084 if(((
short)r->VarOffset[
i]) == r->typ[
j].data.cp.place)
2089 && (r->VarOffset[
i] == r->typ[
j].data.dp.place))
2095 tmp=r->VarOffset[
i] & 0xffffff;
2096 #if SIZEOF_LONG == 8
2097 if ((r->VarOffset[
i] >> 24) >63)
2099 if ((r->VarOffset[
i] >> 24) >31)
2101 dReportError(
"bit_start out of range:%d",r->VarOffset[
i] >> 24);
2102 if (
i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2104 dReportError(
"varoffset out of range for var %d: %d",
i,tmp);
2109 for(
j=0;
j<r->OrdSize;
j++)
2111 if ((r->typ[
j].ord_typ==
ro_dp)
2112 || (r->typ[
j].ord_typ==
ro_wp)
2115 if (r->typ[
j].data.dp.start > r->typ[
j].data.dp.end)
2117 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end);
2118 if ((r->typ[
j].data.dp.start < 1)
2119 || (r->typ[
j].data.dp.end > r->N))
2120 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",
j,
2121 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end,r->N);
2153 static void rO_TDegree(
int &place,
int &bitplace,
int start,
int end,
2159 ord_struct.
data.dp.start=start;
2160 ord_struct.
data.dp.end=end;
2161 ord_struct.
data.dp.place=place;
2173 ord_struct.
data.dp.start=start;
2174 ord_struct.
data.dp.end=end;
2175 ord_struct.
data.dp.place=place;
2181 static void rO_WDegree(
int &place,
int &bitplace,
int start,
int end,
2182 long *o,
sro_ord &ord_struct,
int *weights)
2185 while((start<end) && (weights[0]==0)) { start++; weights++; }
2186 while((start<end) && (weights[end-start]==0)) { end--; }
2189 for(
i=start;
i<=end;
i++)
2191 if(weights[
i-start]!=1)
2199 rO_TDegree(place,bitplace,start,end,o,ord_struct);
2204 ord_struct.
data.wp.start=start;
2205 ord_struct.
data.wp.end=end;
2206 ord_struct.
data.wp.place=place;
2207 ord_struct.
data.wp.weights=weights;
2211 for(
i=start;
i<=end;
i++)
2213 if(weights[
i-start]<0)
2221 static void rO_WMDegree(
int &place,
int &bitplace,
int start,
int end,
2222 long *o,
sro_ord &ord_struct,
int *weights)
2231 ord_struct.
data.am.start=start;
2232 ord_struct.
data.am.end=end;
2233 ord_struct.
data.am.place=place;
2234 ord_struct.
data.am.weights=weights;
2235 ord_struct.
data.am.weights_m = weights + (end-start+1);
2236 ord_struct.
data.am.len_gen=weights[end-start+1];
2237 assume( ord_struct.
data.am.weights_m[0] == ord_struct.
data.am.len_gen );
2250 ord_struct.
data.wp64.start=start;
2251 ord_struct.
data.wp64.end=end;
2252 ord_struct.
data.wp64.place=place;
2253 ord_struct.
data.wp64.weights64=weights;
2262 long *o,
sro_ord &ord_struct,
int *weights)
2265 while((start<end) && (weights[0]==0)) { start++; weights++; }
2266 while((start<end) && (weights[end-start]==0)) { end--; }
2269 ord_struct.
data.wp.start=start;
2270 ord_struct.
data.wp.end=end;
2271 ord_struct.
data.wp.place=place;
2272 ord_struct.
data.wp.weights=weights;
2277 for(
i=start;
i<=end;
i++)
2279 if(weights[
i-start]<0)
2287 static void rO_LexVars(
int &place,
int &bitplace,
int start,
int end,
2288 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2293 if(prev_ord==-1)
rO_Align(place,bitplace);
2299 for(
k=start;;
k+=incr)
2304 v[
k]= place | (bitplace << 24);
2310 assume((opt_var == end+1) ||(opt_var == end-1));
2311 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-2");
2312 int save_bitplace=bitplace;
2316 bitplace=save_bitplace;
2320 v[opt_var]=place | (bitplace << 24);
2325 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2330 if(prev_ord==1)
rO_Align(place,bitplace);
2336 for(
k=start;;
k+=incr)
2341 v[
k]=place | (bitplace << 24);
2348 assume((opt_var == end+1) ||(opt_var == end-1));
2349 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-1");
2350 int save_bitplace=bitplace;
2354 bitplace=save_bitplace;
2358 v[opt_var]=place | (bitplace << 24);
2369 ord_struct.
data.syzcomp.place=place;
2370 ord_struct.
data.syzcomp.Components=
NULL;
2371 ord_struct.
data.syzcomp.ShiftedComponents=
NULL;
2378 static void rO_Syz(
int &place,
int &bitplace,
int &prev_ord,
2379 int syz_comp,
long *o,
sro_ord &ord_struct)
2386 ord_struct.
data.syz.place=place;
2387 ord_struct.
data.syz.limit=syz_comp;
2389 ord_struct.
data.syz.syz_index = (
int*)
omAlloc0((syz_comp+1)*
sizeof(int));
2391 ord_struct.
data.syz.syz_index =
NULL;
2392 ord_struct.
data.syz.curr_index = 1;
2405 long *o,
int ,
int *
v,
sro_ord &ord_struct)
2412 ord_struct.
data.isTemp.start = place;
2414 ord_struct.
data.isTemp.suffixpos = -1;
2422 static void rO_ISSuffix(
int &place,
int &bitplace,
int &prev_ord,
long *o,
2427 int typ_j = typ_i - 1;
2430 if( tmp_typ[typ_j].ord_typ ==
ro_isTemp)
2443 const int start = tmp_typ[typ_j].
data.isTemp.start;
2444 int *pVarOffset = tmp_typ[typ_j].
data.isTemp.pVarOffset;
2455 tmp_typ[typ_j].
data.isTemp.suffixpos = typ_i;
2462 for(
int i = 0;
i <=
N;
i++ )
2465 if(
v[
i] != pVarOffset[
i] )
2467 pVarOffset[
i] =
v[
i];
2469 assume( pVarOffset[
i] != -1 );
2475 if( pVarOffset[0] != -1 )
2476 pVarOffset[0] &= 0x0fff;
2478 sro_ord &ord_struct = tmp_typ[typ_j];
2482 ord_struct.
data.is.start = start;
2483 ord_struct.
data.is.end = place;
2484 ord_struct.
data.is.pVarOffset = pVarOffset;
2506 v[0] = place | (bitplace << 24);
2517 bits=16; bitmask=0xffff;
2519 else if (bitmask <= 1L)
2521 bits=1; bitmask = 1L;
2523 else if (bitmask <= 3L)
2525 bits=2; bitmask = 3L;
2527 else if (bitmask <= 7L)
2531 else if (bitmask <= 0xfL)
2533 bits=4; bitmask=0xfL;
2535 else if (bitmask <= 0x1fL)
2537 bits=5; bitmask=0x1fL;
2539 else if (bitmask <= 0x3fL)
2541 bits=6; bitmask=0x3fL;
2543 #if SIZEOF_LONG == 8
2544 else if (bitmask <= 0x7fL)
2546 bits=7; bitmask=0x7fL;
2549 else if (bitmask <= 0xffL)
2551 bits=8; bitmask=0xffL;
2553 #if SIZEOF_LONG == 8
2554 else if (bitmask <= 0x1ffL)
2556 bits=9; bitmask=0x1ffL;
2559 else if (bitmask <= 0x3ffL)
2561 bits=10; bitmask=0x3ffL;
2563 #if SIZEOF_LONG == 8
2564 else if (bitmask <= 0xfffL)
2566 bits=12; bitmask=0xfff;
2569 else if (bitmask <= 0xffffL)
2571 bits=16; bitmask=0xffffL;
2573 #if SIZEOF_LONG == 8
2574 else if (bitmask <= 0xfffffL)
2576 bits=20; bitmask=0xfffffL;
2578 else if (bitmask <= 0xffffffffL)
2580 bits=32; bitmask=0xffffffffL;
2582 else if (bitmask <= 0x7fffffffffffffffL)
2584 bits=63; bitmask=0x7fffffffffffffffL;
2588 bits=63; bitmask=0x7fffffffffffffffL;
2591 else if (bitmask <= 0x7fffffff)
2593 bits=31; bitmask=0x7fffffff;
2597 bits=31; bitmask=0x7fffffffL;
2608 #if SIZEOF_LONG == 8
2623 unsigned long bitmask1 =
rGetExpSize(bitmask+1, bits1);
2625 if ((((
N+vars_per_long-1)/vars_per_long) ==
2626 ((
N+vars_per_long1-1)/vars_per_long1)))
2628 vars_per_long=vars_per_long1;
2648 unsigned long exp_limit)
2656 BOOLEAN need_other_ring = (exp_limit != r->bitmask);
2658 int iNeedInducedOrderingSetup = 0;
2662 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2663 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2664 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2673 if (r->block0[
i]==r->block1[
i])
2698 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2712 need_other_ring=
TRUE;
2713 try_omit_comp=
FALSE;
2714 copy_block_index=
FALSE;
2728 need_other_ring=
TRUE;
2730 omitted_degree =
TRUE;
2744 need_other_ring=
TRUE;
2746 omitted_degree =
TRUE;
2754 try_omit_comp =
FALSE;
2757 iNeedInducedOrderingSetup++;
2766 try_omit_comp =
FALSE;
2775 if (copy_block_index)
2777 block0[
j]=r->block0[
i];
2778 block1[
j]=r->block1[
i];
2779 wvhdl[
j]=r->wvhdl[
i];
2784 if(!need_other_ring)
2804 res->bitmask=exp_limit;
2805 res->wanted_maxExp=r->wanted_maxExp;
2812 if (r->pFDegOrig !=
res->pFDegOrig &&
2817 res->firstwv = r->firstwv;
2818 res->firstBlockEnds = r->firstBlockEnds;
2822 res->pLDeg = r->pLDegOrig;
2831 res->typ[0] = r->typ[0];
2833 if (r->typ[0].data.syz.limit > 0)
2835 res->typ[0].data.syz.syz_index
2836 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(int));
2837 memcpy(
res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2838 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2842 if( iNeedInducedOrderingSetup > 0 )
2844 for(
j = 0,
i = 0; (
i < nblocks) && (iNeedInducedOrderingSetup > 0);
i++)
2851 r->typ[
i].data.is.limit,
2856 iNeedInducedOrderingSetup--;
2862 res->OrdSgn=r->OrdSgn;
2871 WarnS(
"error in nc_rComplete");
2884 WarnS(
"error in sca_Force!");
2910 res->block1[0] = r->N;
2911 res->wvhdl[0] = weights;
2926 WarnS(
"error in nc_rComplete");
2953 int nblocks=1+(ommit_comp!=0);
2955 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2956 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2957 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2976 res->bitmask=exp_limit;
2977 res->wanted_maxExp=r->wanted_maxExp;
2988 WarnS(
"error in nc_rComplete");
3004 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
3032 r->CanShortOut=
FALSE;
3035 r->CanShortOut =
TRUE;
3043 r->CanShortOut=
FALSE;
3054 if (r->N <
N)
N = r->N;
3056 for (
i=(
N-1);
i>=0;
i--)
3058 if(r->names[
i] !=
NULL && strlen(r->names[
i])>1)
3060 r->CanShortOut=
FALSE;
3066 r->ShortOut = r->CanShortOut;
3068 assume( !( !r->CanShortOut && r->ShortOut ) );
3076 if(block1[
i]!=r->N) r->LexOrder=
TRUE;
3077 r->firstBlockEnds=block1[
i];
3078 r->firstwv = wvhdl[
i];
3087 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3089 if (r->firstwv[
j]==0) r->LexOrder=
TRUE;
3096 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3098 if (
w[
j]==0) r->LexOrder=
TRUE;
3105 if (r->pFDeg ==
p_Deg)
3126 r->pLDegOrig = r->pLDeg;
3133 int* block0 = r->block0;
3134 int* block1 = r->block1;
3135 int** wvhdl = r->wvhdl;
3144 r->LexOrder =
FALSE;
3151 for(
int ii=block0[0];ii<=block1[0];ii++)
3152 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3154 for(
int ii=block0[0];ii<=block1[0];ii++)
3155 if (wvhdl[0][ii-1]==0) { r->LexOrder=
TRUE;
break;}
3156 if ((block0[0]==1)&&(block1[0]==r->N))
3167 r->firstwv = wvhdl[0];
3179 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3198 for(
int ii=block0[0];ii<=block1[0];ii++)
3200 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3202 if (r->MixedOrder==0)
3204 if ((block0[0]==1)&&(block1[0]==r->N))
3212 r->firstBlockEnds=block1[0];
3213 r->firstwv = wvhdl[0];
3232 r->firstBlockEnds=block1[1];
3233 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3241 for(
int ii=block0[1];ii<=block1[1];ii++)
3242 if (wvhdl[1][ii-1]<0) { r->MixedOrder=2;
break;}
3243 if (r->MixedOrder==
FALSE)
3276 if(r->MixedOrder==
FALSE)
3291 r->pFDegOrig = r->pFDeg;
3306 for(
i=0;
i<r->OrdSize;
i++)
3309 ||(r->typ[
i].ord_typ==
ro_am))
3314 r->NegWeightL_Size=
l;
3315 r->NegWeightL_Offset=(
int *)
omAlloc(
l*
sizeof(
int));
3317 for(
i=0;
i<r->OrdSize;
i++)
3321 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3324 else if(r->typ[
i].ord_typ==
ro_am)
3326 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3333 r->NegWeightL_Size = 0;
3334 r->NegWeightL_Offset =
NULL;
3346 if ( (r->cf->extRing!=
NULL)
3355 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3372 r->pLexOrder=r->LexOrder;
3380 static inline int sign(
int x) {
return (
x > 0) - (
x < 0);}
3405 if (r->VarOffset!=
NULL && force == 0)
return FALSE;
3410 r->bitmask=
rGetExpSize(r->wanted_maxExp,bits,r->N);
3411 r->BitsPerExp = bits;
3416 long *tmp_ordsgn=(
long *)
omAlloc0(3*(n+r->N)*
sizeof(long));
3418 int *
v=(
int *)
omAlloc((r->N+1)*
sizeof(int));
3419 for(
i=r->N;
i>=0 ;
i--)
3436 switch (r->order[
i])
3440 rO_WDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3446 rO_WMDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3453 tmp_typ[typ_i], (
int64 *)(r->wvhdl[
i]));
3460 r->ComponentOrder=1;
3466 r->ComponentOrder=-1;
3472 k=r->block1[
i]-r->block0[
i]+1;
3477 r->wvhdl[
i]+(r->block1[
i]-r->block0[
i]+1)*
l);
3484 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i], prev_ordsgn,
3485 tmp_ordsgn,
v,bits, -1);
3490 tmp_ordsgn,
v, bits, -1);
3495 tmp_ordsgn,
v, bits, -1);
3499 rO_LexVars(
j, j_bits, r->block1[
i],r->block0[
i], prev_ordsgn,
3500 tmp_ordsgn,
v, bits, -1);
3504 if (r->block0[
i]==r->block1[
i])
3506 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3507 tmp_ordsgn,
v, bits, -1);
3515 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3520 if (r->block0[
i]==r->block1[
i])
3522 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3523 tmp_ordsgn,
v, bits, -1);
3530 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3531 tmp_ordsgn,
v, bits, r->block1[
i]);
3536 if (r->block0[
i]==r->block1[
i])
3539 tmp_ordsgn,
v,bits, -1);
3547 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3552 if (r->block0[
i]==r->block1[
i])
3555 tmp_ordsgn,
v, bits, -1);
3562 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3563 tmp_ordsgn,
v, bits, r->block1[
i]);
3569 tmp_typ[typ_i], r->wvhdl[
i]);
3574 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3576 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3578 if (have_bad_weights)
3585 if (r->block1[
i]!=r->block0[
i])
3588 tmp_ordsgn,
v,bits, r->block0[
i]);
3594 tmp_typ[typ_i], r->wvhdl[
i]);
3599 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3601 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3603 if (have_bad_weights)
3610 if (r->block1[
i]!=r->block0[
i])
3612 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3613 tmp_ordsgn,
v, bits, r->block1[
i]);
3619 tmp_typ[typ_i], r->wvhdl[
i]);
3621 if (r->block1[
i]!=r->block0[
i])
3624 tmp_ordsgn,
v,bits, r->block0[
i]);
3630 tmp_typ[typ_i], r->wvhdl[
i]);
3632 if (r->block1[
i]!=r->block0[
i])
3634 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3635 tmp_ordsgn,
v, bits, r->block1[
i]);
3642 rO_Syzcomp(
j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3643 need_to_add_comp=
TRUE;
3644 r->ComponentOrder=-1;
3650 rO_Syz(
j, j_bits, prev_ordsgn, r->block0[
i], tmp_ordsgn, tmp_typ[typ_i]);
3651 need_to_add_comp=
TRUE;
3652 r->ComponentOrder=-1;
3659 assume( r->block0[
i] == r->block1[
i] );
3660 const int s = r->block0[
i];
3664 rO_ISPrefix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ[typ_i++]);
3667 rO_ISSuffix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ, typ_i,
s);
3668 need_to_add_comp=
FALSE;
3687 j_bits=j_bits0;
j=j0;
3692 if((need_to_add_comp) && (
v[0]== -1))
3706 for(
i=1 ;
i<=r->N ;
i++)
3733 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3735 for(
j=0;
j<r->CmpL_Size;
j++)
3737 r->ordsgn[
j] = tmp_ordsgn[
j];
3746 if (typ_i==0) r->typ=
NULL;
3750 memcpy(r->typ,tmp_typ,typ_i*
sizeof(
sro_ord));
3760 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3763 if (
i==r->pCompIndex)
i++;
3764 while ((j < r->OrdSize)
3772 if (
i==r->pCompIndex)
i++;
3810 for(
int i=1;
i<=r->N;
i++)
3817 if ((r->block0[
j]<=
i)&&(r->block1[
j]>=
i))
3837 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3843 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3854 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3860 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3868 int add=r->block1[
j]-r->block0[
j]+1;
3873 if (r->wvhdl[
j][
i-r->block0[
j]]<0)
3879 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3909 if (nonneg>0) r->MixedOrder=1;
3920 if (r ==
NULL)
return;
3921 if (r->VarOffset !=
NULL)
3923 if (r->OrdSize!=0 && r->typ !=
NULL)
3925 for(
int i = 0;
i < r->OrdSize;
i++)
3926 if( r->typ[
i].ord_typ ==
ro_is)
3930 if( r->typ[
i].data.is.pVarOffset !=
NULL )
3935 else if (r->typ[
i].ord_typ ==
ro_syz)
3937 if(r->typ[
i].data.syz.limit > 0)
3938 omFreeSize(r->typ[
i].data.syz.syz_index, ((r->typ[
i].data.syz.limit) +1)*
sizeof(
int));
3942 assume( r->typ[
i].data.syzcomp.ShiftedComponents ==
NULL );
3943 assume( r->typ[
i].data.syzcomp.Components ==
NULL );
3953 if (r->PolyBin !=
NULL)
3959 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
3964 if (r->p_Procs !=
NULL)
3969 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
3970 r->VarL_Offset=
NULL;
3972 if (r->NegWeightL_Offset!=
NULL)
3974 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
3975 r->NegWeightL_Offset=
NULL;
3983 int* VarL_Number = (
int*)
omAlloc0(r->ExpL_Size*
sizeof(
int));
3988 for (
i=1;
i<=r->N;
i++)
3990 VarL_Number[r->VarOffset[
i] & 0xffffff]++;
3994 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
3996 if (VarL_Number[
i] != 0)
3998 if (
min > VarL_Number[
i])
4000 min = VarL_Number[
i];
4009 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
4010 r->VarL_LowIndex = 0;
4013 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
4015 if (VarL_Number[
i] != 0)
4017 r->VarL_Offset[
j] =
i;
4018 if (
j > 0 && r->VarL_Offset[
j-1] != r->VarL_Offset[
j] - 1)
4019 r->VarL_LowIndex = -1;
4023 if (r->VarL_LowIndex >= 0)
4024 r->VarL_LowIndex = r->VarL_Offset[0];
4028 j = r->VarL_Offset[min_j];
4029 r->VarL_Offset[min_j] = r->VarL_Offset[0];
4030 r->VarL_Offset[0] =
j;
4037 int* shifts = (
int*)
omAlloc(r->ExpL_Size*
sizeof(
int));
4040 for (
i=0;
i<r->ExpL_Size;
i++)
4044 for (
i=1;
i<=r->N;
i++)
4046 if (shifts[r->VarOffset[
i] & 0xffffff] > r->VarOffset[
i] >> 24)
4047 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
4050 for (
i=1;
i<=r->N;
i++)
4052 if (shifts[r->VarOffset[
i] & 0xffffff] != 0)
4054 = (r->VarOffset[
i] & 0xffffff) |
4055 (((r->VarOffset[
i] >> 24) - shifts[r->VarOffset[
i] & 0xffffff]) << 24);
4063 unsigned long divmask = 1;
4068 divmask |= (((
unsigned long) 1) << (
unsigned long)
i);
4083 const char *TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
4084 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
4087 Print(
"ExpL_Size:%d ",r->ExpL_Size);
4088 Print(
"CmpL_Size:%d ",r->CmpL_Size);
4089 Print(
"VarL_Size:%d\n",r->VarL_Size);
4090 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4091 Print(
"divmask=%lx\n", r->divmask);
4092 Print(
"BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4094 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
4095 PrintS(
"VarL_Offset:\n");
4098 for(
j = 0;
j < r->VarL_Size;
j++)
4099 Print(
" VarL_Offset[%d]: %d ",
j, r->VarL_Offset[
j]);
4106 for(
j=0;
j<=r->N;
j++)
4107 Print(
" v%d at e-pos %d, bit %d\n",
4108 j,r->VarOffset[
j] & 0xffffff, r->VarOffset[
j] >>24);
4110 for(
j=0;
j<r->CmpL_Size;
j++)
4111 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[
j],
j);
4112 Print(
"OrdSgn:%d\n",r->OrdSgn);
4114 for(
j=0;
j<r->OrdSize;
j++)
4116 Print(
" typ %s", TYP[r->typ[
j].ord_typ]);
4117 if (r->typ[
j].ord_typ==
ro_syz)
4119 const short place = r->typ[
j].data.syz.place;
4120 const int limit = r->typ[
j].data.syz.limit;
4121 const int curr_index = r->typ[
j].data.syz.curr_index;
4122 const int* syz_index = r->typ[
j].data.syz.syz_index;
4124 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4126 if( syz_index ==
NULL )
4131 for(
i=0;
i <= limit;
i++ )
4132 Print(
"%d ", syz_index[
i]);
4139 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[
j].data.isTemp.start, r->typ[
j].data.isTemp.suffixpos);
4142 else if (r->typ[
j].ord_typ==
ro_is)
4144 Print(
" start %d, end: %d: ",r->typ[
j].data.is.start, r->typ[
j].data.is.end);
4148 Print(
" limit %d",r->typ[
j].data.is.limit);
4155 else if (r->typ[
j].ord_typ==
ro_am)
4157 Print(
" place %d",r->typ[
j].data.am.place);
4158 Print(
" start %d",r->typ[
j].data.am.start);
4159 Print(
" end %d",r->typ[
j].data.am.end);
4160 Print(
" len_gen %d",r->typ[
j].data.am.len_gen);
4163 for(
l=r->typ[
j].data.am.start;l<=r->typ[
j].data.am.end;
l++)
4164 Print(
" %d",r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start]);
4165 l=r->typ[
j].data.am.end+1;
4166 int ll=r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start];
4168 for(
int lll=
l+1;lll<
l+ll+1;lll++)
4169 Print(
" %d",r->typ[
j].data.am.weights[lll-r->typ[
j].data.am.start]);
4173 Print(
" place %d",r->typ[
j].data.dp.place);
4177 Print(
" start %d",r->typ[
j].data.dp.start);
4178 Print(
" end %d",r->typ[
j].data.dp.end);
4179 if ((r->typ[
j].ord_typ==
ro_wp)
4183 for(
int l=r->typ[
j].data.wp.start;l<=r->typ[
j].data.wp.end;
l++)
4184 Print(
" %d",r->typ[
j].data.wp.weights[
l-r->typ[
j].data.wp.start]);
4186 else if (r->typ[
j].ord_typ==
ro_wp64)
4190 for(
l=r->typ[
j].data.wp64.start;l<=r->typ[
j].data.wp64.end;
l++)
4191 Print(
" %ld",(
long)(((
int64*)r->typ[
j].data.wp64.weights64)+
l-r->typ[
j].data.wp64.start));
4197 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4198 Print(
"OrdSize:%d\n",r->OrdSize);
4199 PrintS(
"--------------------\n");
4200 for(
j=0;
j<r->ExpL_Size;
j++)
4203 if (j< r->CmpL_Size)
4204 Print(
"ordsgn %ld ", r->ordsgn[
j]);
4210 if( (r->VarOffset[
i] & 0xffffff) ==
j )
4211 {
Print(
"v%d at e[%d], bit %d; ",
i,r->VarOffset[
i] & 0xffffff,
4212 r->VarOffset[
i] >>24 ); }
4214 if( r->pCompIndex==
j )
PrintS(
"v0; ");
4215 for(
i=0;
i<r->OrdSize;
i++)
4217 if (r->typ[
i].data.dp.place ==
j)
4219 Print(
"ordrec:%s (start:%d, end:%d) ",TYP[r->typ[
i].ord_typ],
4220 r->typ[
i].data.dp.start, r->typ[
i].data.dp.end);
4224 if (
j==r->pOrdIndex)
4229 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4231 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4232 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4234 for(
j = 0;
j < r->NegWeightL_Size;
j++)
4235 Print(
" [%d]: %d ",
j, r->NegWeightL_Offset[
j]);
4246 Print(
"p_Spec : %s, %s, %s\n", field,
length, ord);
4248 for (
i=0;
i<(int) (
sizeof(
p_Procs_s)/
sizeof(
void*));
i++)
4250 Print(
" %s,\n", ((
char**) &proc_names)[
i]);
4256 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4262 Print(
"(%p)", r->pFDeg);
4265 Print(
"pLDeg : (%p)", r->pLDeg);
4277 else Print(
"%p\n",r->p_Setm);
4287 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4288 for(
i=0;
i<r->ExpL_Size;
i++)
4296 if (
j==0) {
PrintS(
"...\n");
break; }
4305 Print(
"\nexp[0..%d]\n",
R->ExpL_Size - 1);
4306 for(
int i = 0;
i <
R->ExpL_Size;
i++)
4325 for(
int j = (F->ncols*F->nrows) - 1;
j >= 0;
j-- )
4339 Print(
"gen[%d] -> gen(%d)\n", c,
MIN + (*V)[ c -
MIN - 1 ]);
4363 r->typ[1].data.syzcomp.Components = currComponents;
4371 *currComponents = r->typ[1].data.syzcomp.Components;
4381 r->typ[1].data.syzcomp.length =
length;
4391 *
length = r->typ[1].data.syzcomp.length;
4433 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4444 int ** wvhdl =(
int **)
omAlloc0((
i+1)*
sizeof(
int**));
4447 res->order[
j]=r->order[
j-1];
4448 res->block0[
j]=r->block0[
j-1];
4449 res->block1[
j]=r->block1[
j-1];
4450 if (r->wvhdl[
j-1] !=
NULL)
4468 WarnS(
"error in nc_rComplete");
4478 if (r->qideal!=
NULL)
4508 pos=r->VarL_LowIndex;
4513 for(
int i=r->OrdSize-1;
i>=0;
i--)
4515 if ((r->typ[
i].ord_typ==
ro_dp)
4516 && (r->typ[
i].data.dp.start==1)
4517 && (r->typ[
i].data.dp.end==r->N))
4519 pos=r->typ[
i].data.dp.place;
4539 res->ExpL_Size=r->ExpL_Size+1;
4543 for(
j=0;
j<r->CmpL_Size;
j++)
4545 res->ordsgn[
j] = r->ordsgn[
j];
4547 res->OrdSize=r->OrdSize+1;
4552 memcpy(
res->typ,r->typ,r->OrdSize*
sizeof(
sro_ord));
4556 res->typ[
res->OrdSize-1].data.dp.start=1;
4557 res->typ[
res->OrdSize-1].data.dp.end=
res->N;
4558 res->typ[
res->OrdSize-1].data.dp.place=
res->ExpL_Size-1;
4559 pos=
res->ExpL_Size-1;
4575 WarnS(
"error in nc_rComplete");
4581 if (r->qideal!=
NULL)
4611 if (r->order[
i] == 0)
4620 new_r->wvhdl=(
int **)
omAlloc0(
i *
sizeof(
int *));
4622 new_r->block0 = (
int *)
omAlloc0(
i *
sizeof(
int));
4623 new_r->block1 = (
int *)
omAlloc0(
i *
sizeof(
int));
4625 memcpy(new_r->block0,r->block0,(
i-1) *
sizeof(
int));
4626 memcpy(new_r->block1,r->block1,(
i-1) *
sizeof(
int));
4627 for (
int j=0;
j<=last_block;
j++)
4629 if (r->wvhdl[
j]!=
NULL)
4631 new_r->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[
j]);
4648 WarnS(
"error in nc_rComplete");
4660 int last_block =
rBlocks(r) - 2;
4667 for (
i=0;
i< last_block;
i++)
4678 for (
i=c_pos+1;
i<=last_block;
i++)
4680 new_r->order[
i-1] = new_r->order[
i];
4681 new_r->block0[
i-1] = new_r->block0[
i];
4682 new_r->block1[
i-1] = new_r->block1[
i];
4683 new_r->wvhdl[
i-1] = new_r->wvhdl[
i];
4685 new_r->order[last_block] = r->order[c_pos];
4686 new_r->block0[last_block] = r->block0[c_pos];
4687 new_r->block1[last_block] = r->block1[c_pos];
4688 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4699 WarnS(
"error in nc_rComplete");
4724 if (new_r_1 != new_r && new_r_1 != old_r)
rDelete(new_r_1);
4732 # ifndef SING_NDEBUG
4733 WarnS(
"error in nc_rComplete");
4740 if (old_r->qideal !=
NULL)
4742 new_r->qideal =
idrCopyR(old_r->qideal, old_r, new_r);
4750 WarnS(
"error in nc_SetupQuotient");
4775 if ((r_blocks == 3) &&
4776 (r->order[0] == b1) &&
4777 (r->order[1] == b2) &&
4790 res->block1[1] = r->N;
4795 res->block1[0] = r->N;
4805 WarnS(
"error in nc_rComplete");
4818 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete,
sgn);
4835 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
4843 res->block0[
j] =
res->block1[
j] = 0;
4847 for(
int i = 0; (
i <= n) && (r->order[
i] != 0);
i++,
j++)
4849 res->order [
j] = r->order [
i];
4850 res->block0[
j] = r->block0[
i];
4851 res->block1[
j] = r->block1[
i];
4853 if (r->wvhdl[
i] !=
NULL)
4885 WarnS(
"error in nc_rComplete");
4897 if (r->qideal!=
NULL)
4954 Print(
"rIsIS(p: %d)\nF:",
p);
4965 for(
int pos = 0; pos < r->OrdSize; pos++ )
4966 if( r->typ[pos].ord_typ ==
ro_is)
4988 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4997 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
5002 if(
i != r->typ[pos].data.is.limit )
5003 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit,
i);
5006 const ideal FF =
idrHeadR(F, r, r);
5009 if( r->typ[pos].data.is.F !=
NULL)
5012 PrintS(
"Deleting old reference set F... \n");
5015 r->typ[pos].data.is.F =
NULL;
5020 r->typ[pos].data.is.F = FF;
5022 r->typ[pos].data.is.limit =
i;
5046 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
5048 r->block0[0]=r->block1[0] =
k;
5049 if(
k == r->typ[0].data.syz.limit )
5053 if (r->typ[0].data.syz.limit == 0)
5055 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((
k+1)*
sizeof(int));
5056 r->typ[0].data.syz.syz_index[0] = 0;
5057 r->typ[0].data.syz.curr_index = 1;
5061 r->typ[0].data.syz.syz_index = (
int*)
5063 (r->typ[0].data.syz.limit+1)*
sizeof(int),
5066 for (
i=r->typ[0].data.syz.limit + 1;
i<=
k;
i++)
5068 r->typ[0].data.syz.syz_index[
i] =
5069 r->typ[0].data.syz.curr_index;
5071 if(k < r->typ[0].data.syz.limit)
5074 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)",
k, r->typ[0].data.syz.limit);
5076 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5080 r->typ[0].data.syz.limit =
k;
5081 r->typ[0].data.syz.curr_index++;
5090 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!",
k);
5095 r->block0[0] = r->block1[0] =
k;
5110 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5111 r->typ[0].data.syz.limit > 0 &&
i > 0)
5113 assume(i <= r->typ[0].data.syz.limit);
5115 for (
j=0;
j<r->typ[0].data.syz.limit;
j++)
5117 if (r->typ[0].data.syz.syz_index[
j] ==
i &&
5118 r->typ[0].data.syz.syz_index[
j+1] !=
i)
5120 assume(r->typ[0].data.syz.syz_index[
j+1] ==
i+1);
5124 return r->typ[0].data.syz.limit;
5129 WarnS(
"rGetMaxSyzComp: order c");
5139 for (
i=0;
i<nb;
i++)
5141 if (r->wvhdl[
i] !=
NULL)
5143 int length = r->block1[
i] - r->block0[
i];
5144 int* wvhdl = r->wvhdl[
i];
5150 if (wvhdl[
j] != 0 && wvhdl[
j] != 1)
return FALSE;
5166 if ((r->order[0]==
ringorder_dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5169 && ((r->order[1]==
ringorder_dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5176 if ((r->order[0]==
ringorder_Dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5179 && ((r->order[1]==
ringorder_Dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5186 if ((r->order[0]==
ringorder_lp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5189 && ((r->order[1]==
ringorder_lp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5199 while((r->typ[
i].ord_typ!=
ro_wp64) && (r->typ[
i].ord_typ>0))
i++;
5201 return (
int64*)(r->typ[
i].data.wp64.weights64);
5209 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*
sizeof(
int64));
5220 for(
int k=
size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5226 static int rReallocM1(ring r,
int size,
int pos)
5232 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5242 for(
int j=0;
j<=i2;
j++)
5250 #define rOppVar(R,I) (rVar(R)+1-I)
5268 if (src->qideal !=
NULL)
5275 int i2 = (
rVar(r)-1)/2;
5276 for(
i=i2;
i>=0;
i--)
5282 p = r->names[
rVar(r)-1-
i];
5283 r->names[
rVar(r)-1-
i] = r->names[
i];
5301 char *
p=r->names[
i];
5302 if(isupper(*
p)) *
p = tolower(*
p);
5303 else *
p = toupper(*
p);
5354 for(
i=0; src->order[
i]!=0;
i++)
5356 switch (src->order[
i])
5361 r->order[
j]=src->order[
i];
5365 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5366 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5370 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5371 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5377 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5378 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5379 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5380 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5381 r->wvhdl[
j][
k-r->block0[
j]]=1;
5384 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5385 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5393 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5394 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5395 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5396 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5397 r->wvhdl[
j][
k-r->block0[
j]]=1;
5400 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5401 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5409 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5410 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5411 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5415 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5416 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5424 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5425 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5426 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5430 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5431 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5438 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5439 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5440 int n=r->block1[
j]-r->block0[
j];
5442 for (
int nn=0; nn<=n; nn++)
5451 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5452 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5494 for(
i=0; src->order[
i]!=0;
i++)
5496 switch (src->order[
i])
5501 r->order[
j]=src->order[
i];
5505 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5506 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5510 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5511 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5516 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5517 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5523 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5524 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5569 int *par_perm =
NULL;
5572 for(
i=1;
i<=r->N;
i++)
5588 MATELEM(C,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5591 MATELEM(
D,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5599 WarnS(
"Error initializing non-commutative multiplication!");
5607 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5614 if (src->qideal !=
NULL)
5617 r->qideal =
idOppose(src, src->qideal, r);
5619 r->qideal =
id_Copy(src->qideal, r);
5649 int stat =
rSum(
R, Ropp, Renv);
5651 WarnS(
"Error in rEnvelope at rSum");
5674 const int N = dest->N;
5683 const ring srcBase = src;
5690 matrix C0 = src->GetNC()->C;
5691 matrix D0 = src->GetNC()->D;
5694 for (
int i = 1;
i <
N;
i++)
5696 for (
int j =
i + 1;
j <=
N;
j++)
5699 const poly
p =
p_NSet(n, dest);
5741 while(r->order[
i]!=0)
5748 for(
j=r->block1[
i]-r->block0[
i];
j>=0;
j--)
5750 r->wvhdl[
i]=(
int*)w64;
5784 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
5793 WerrorS(
"only for rings with an ordering of one block");
5810 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5813 for(
int i=r->N-1;
i>=0;
i--)
5815 if (strcmp(r->names[
i],
v)==0)
5817 Werror(
"duplicate variable name >>%s<<",
v);
5823 #ifdef HAVE_SHIFTBBA
5826 R->isLPring=r->isLPring+1;
5827 R->N=((r->N)/r->isLPring)+r->N;
5831 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5834 for(
int i=
R->isLPring-1;
i>0;
i--)
5835 names[
i+
b*
R->isLPring]=
R->names[
i-1+
b*r->isLPring];
5840 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5843 for(
int i=
R->isLPring-2;
i>=0;
i--)
5844 names[
i+
b*
R->isLPring]=
R->names[
i+
b*r->isLPring];
5856 for(
int i=
R->N-1;
i>0;
i--) names[
i]=
R->names[
i-1];
5861 for(
int i=
R->N-2;
i>=0;
i--) names[
i]=
R->names[
i];
5875 WerrorS(
"only for rings with an ordering of one block");
5892 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5899 if (strcmp(
R->names[
i],
v)==0)
5903 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
STATIC_VAR unsigned add[]
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)
BOOLEAN rRing_ord_pure_Dp(const 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)
void p_DebugPrint(poly p, const ring r)
void rKillModifiedRing(ring r)
BOOLEAN rRing_ord_pure_dp(const 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)
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
BOOLEAN rRing_has_CompLastBlock(const ring r)
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)
BOOLEAN rRing_ord_pure_lp(const ring r)
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[]
BOOLEAN rRing_is_Homog(const ring r)
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 ring rIncRefCnt(ring r)
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,