 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
42 #define BITS_PER_LONG 8*SIZEOF_LONG
111 r->names = (
char **)
omAlloc0(
N *
sizeof(
char *));
119 r->wvhdl = (
int **)
omAlloc0((ord_size+1) *
sizeof(
int *));
125 r->bitmask = bitmask;
137 return rDefault(
cf,
N,n,ord_size,ord,block0,block1,wvhdl);
144 int *block0 = (
int *)
omAlloc0(2 *
sizeof(
int));
145 int *block1 = (
int *)
omAlloc0(2 *
sizeof(
int));
180 WerrorS(
"weights only for orderings wp,ws,Wp,Ws,a,M");
189 int sz = (int)
sqrt((
double)(order->
length()-2));
190 if ((sz*sz)!=(order->
length()-2))
192 WerrorS(
"Matrix order is not a square matrix");
195 while ((
i<sz) && (typ==1))
198 while ((
j<sz) && ((*order)[
j*sz+
i+2]==0))
j++;
202 WerrorS(
"Matrix order not complete");
204 else if ((*order)[
j*sz+
i+2]<0)
217 for (
int i=0;
i<
N;
i++)
219 if (names[
i]==
NULL)
return -1;
220 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)
349 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
352 PrintS(
"\n// : weights ");
353 for (
i = 0;
i<=r->block1[
l]-r->block0[
l];
i++)
365 Print(
" %*d" ,nlen,r->wvhdl[
l][
i+
j]);
371 int m=r->wvhdl[
l][
i];
372 Print(
"\n// : %d module weights ",
m);
374 for(;
i<=
m;
i++)
Print(
" %*d" ,nlen,r->wvhdl[
l][
i]);
381 PrintS(
"\n// noncommutative relations:");
387 for (
i = 1;
i<r->N;
i++)
389 for (
j =
i+1;
j<=r->N;
j++)
394 Print(
"\n// %s%s=",r->names[
j-1],r->names[
i-1]);
405 Print(
"\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
410 PrintS(
"\n// quotient of sca by ideal");
423 PrintS(
"\n// letterplace ring");
428 PrintS(
"\n// quotient ring from ideal");
441 if (r ==
NULL)
return;
448 if( r->qideal !=
NULL )
463 if (r->order !=
NULL)
474 if (r->wvhdl[
j]!=
NULL)
487 for (
i=0;
i<r->N;
i++)
506 if (order==0)
Werror(
"wrong ring order `%s`",ordername);
516 for (nblocks=0; r->order[nblocks]; nblocks++);
535 if (r->wvhdl[
l]!=
NULL)
539 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
546 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
555 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
565 if (
j+
i+1==(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1))
575 assume( r->block0[
l] == r->block1[
l] );
576 const int s = r->block0[
l];
584 if (r->bitmask!=0xffff)
603 for (
i=0;
i<r->N;
i++)
605 l+=strlen(r->names[
i])+1;
609 for (
i=0;
i<r->N-1;
i++)
611 strcat(
s,r->names[
i]);
614 strcat(
s,r->names[
i]);
626 char const *
const *
const params =
rParameter(r);
633 l+=strlen(params[
i])+1;
639 strcat(
s, params[
i]);
642 strcat(
s, params[
i]);
653 char *
res=(
char *)
omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
654 sprintf(
res,
"(%s),(%s),(%s)",ch,var,ord);
686 int rChar(ring r) {
return r->cf->ch; }
703 for(
int i=1;
i<r->N;
i++)
704 for(
int j=
i+1;
j<=r->N;
j++)
708 WarnS(
"Error initializing multiplication!");
728 memset(&tmpR,0,
sizeof(tmpR));
763 && (mpz_cmp(r1->cf->modNumber,r2->cf->extRing->cf->modNumber)==0))
796 if (r1->cf->extRing->cf==r2->cf)
806 WerrorS (
"coeff sum of two extension fields not implemented");
812 WerrorS(
"coeff sum not yet implemented");
819 char **names=(
char **)
omAlloc0(
l*
sizeof(
char *));
824 for (
i=0;
i<r1->N;
i++)
828 if (*(r1->names[
i]) ==
'\0')
860 if (*(r2->names[
i]) ==
'\0')
883 if (strcmp(r1->names[
j],r2->names[
i])==0)
952 if ((r2->block0[0]==1)
953 && (r2->block1[0]==
rVar(r2))
959 tmpR.
order[1]=r2->order[0];
960 if (r2->wvhdl[0]!=
NULL)
1026 if (rb->wvhdl[
i]!=
NULL)
1027 WarnS(
"rSum: weights not implemented");
1033 for (
i=0;r1->order[
i]!=0;
i++)
1038 if (r1->wvhdl[
i]!=
NULL)
1049 for (
i=0;r2->order[
i]!=0;
i++)
1057 if (r2->wvhdl[
i]!=
NULL)
1064 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1084 if (r1->wvhdl[
i]!=
NULL)
1095 Werror(
"variables must not overlap (# of vars: %d,%d -> %d)",
rVar(r1),
rVar(r2),
k);
1101 memcpy(sum,&tmpR,
sizeof(
ip_sring));
1118 if ( (R1_is_nc) || (R2_is_nc))
1142 int *perm1 = (
int *)
omAlloc0((
rVar(R1)+1)*
sizeof(int));
1143 int *par_perm1 =
NULL;
1146 int *perm2 = (
int *)
omAlloc0((
rVar(R2)+1)*
sizeof(int));
1147 int *par_perm2 =
NULL;
1152 perm1, par_perm1, sum->cf->type);
1156 perm2, par_perm2, sum->cf->type);
1159 matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1160 matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1169 for (
i = 1;
i <=
rVar(R1);
i++)
1182 MATELEM(C,
i,
j) =
p_PermPoly(
MATELEM(C1,
i,
j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1185 MATELEM(
D,
i,
j) =
p_PermPoly(
MATELEM(D1,
i,
j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1198 MATELEM(C,
rVar(R1)+
i,
rVar(R1)+
j) =
p_PermPoly(
MATELEM(C2,
i,
j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1201 MATELEM(
D,
rVar(R1)+
i,
rVar(R1)+
j) =
p_PermPoly(
MATELEM(D2,
i,
j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1209 WarnS(
"Error initializing non-commutative multiplication!");
1218 Print(
"\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1241 if (r1->qideal!=
NULL)
1252 int *perm1 = (
int *)
omAlloc0((
rVar(r1)+1)*
sizeof(int));
1253 int *par_perm1 =
NULL;
1257 perm1, par_perm1, sum->cf->type);
1261 for (
int for_i=0;for_i<
IDELEMS(r1->qideal);for_i++)
1263 r1->qideal->m[for_i], perm1,
1266 par_perm1,
rPar(r1));
1271 if (r2->qideal!=
NULL)
1275 int *perm2 = (
int *)
omAlloc0((
rVar(r2)+1)*
sizeof(int));
1276 int *par_perm2 =
NULL;
1280 perm2, par_perm2, sum->cf->type);
1284 for (
int for_i=0;for_i<
IDELEMS(r2->qideal);for_i++)
1286 r2->qideal->m[for_i], perm2,
1289 par_perm2,
rPar(r2));
1321 int rSum(ring r1, ring r2, ring &sum)
1347 res->options=r->options;
1362 res->firstBlockEnds=r->firstBlockEnds;
1364 res->real_var_start=r->real_var_start;
1365 res->real_var_end=r->real_var_end;
1368 #ifdef HAVE_SHIFTBBA
1369 res->isLPring=r->isLPring;
1372 res->VectorOut=r->VectorOut;
1373 res->ShortOut=r->ShortOut;
1374 res->CanShortOut=r->CanShortOut;
1390 res->bitmask=r->bitmask;
1391 res->divmask=r->divmask;
1392 res->BitsPerExp = r->BitsPerExp;
1393 res->ExpPerLong = r->ExpPerLong;
1412 if (copy_ordering ==
TRUE)
1414 res->LexOrder=r->LexOrder;
1415 res->MixedOrder=r->MixedOrder;
1423 if (r->wvhdl[
j]!=
NULL)
1431 memcpy(
res->block0,r->block0,
i *
sizeof(
int));
1432 memcpy(
res->block1,r->block1,
i *
sizeof(
int));
1447 if (r->qideal!=
NULL)
1476 res->options=r->options;
1491 res->firstBlockEnds=r->firstBlockEnds;
1493 res->real_var_start=r->real_var_start;
1494 res->real_var_end=r->real_var_end;
1497 #ifdef HAVE_SHIFTBBA
1498 res->isLPring=r->isLPring;
1501 res->VectorOut=r->VectorOut;
1502 res->ShortOut=r->ShortOut;
1503 res->CanShortOut=r->CanShortOut;
1504 res->LexOrder=r->LexOrder;
1505 res->MixedOrder=r->MixedOrder;
1521 res->bitmask=r->bitmask;
1522 res->divmask=r->divmask;
1523 res->BitsPerExp = r->BitsPerExp;
1524 res->ExpPerLong = r->ExpPerLong;
1543 if (copy_ordering ==
TRUE)
1550 for (
j=0;
j<
i-1;
j++)
1552 if (r->wvhdl[
j]!=
NULL)
1560 memcpy(&(
res->block0[1]),r->block0,(
i-1) *
sizeof(
int));
1561 memcpy(&(
res->block1[1]),r->block1,(
i-1) *
sizeof(
int));
1579 res->wvhdl[0]=(
int *)
A;
1589 if (r->qideal!=
NULL)
1595 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1600 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1637 if (r1 == r2)
return TRUE;
1639 if (r1->cf!=r2->cf)
return FALSE;
1649 if ((r1->names[
i] !=
NULL) && (r2->names[
i] !=
NULL))
1651 if (strcmp(r1->names[
i], r2->names[
i]))
return FALSE;
1653 else if ((r1->names[
i] !=
NULL) ^ (r2->names[
i] !=
NULL))
1661 if (r1->qideal !=
NULL)
1663 ideal id1 = r1->qideal, id2 = r2->qideal;
1677 else if (r2->qideal !=
NULL)
return FALSE;
1687 if (r1 == r2)
return TRUE;
1691 if ((r1->cf != r2->cf)
1693 || (r1->OrdSgn != r2->OrdSgn))
1697 while (r1->order[
i] != 0)
1699 if (r2->order[
i] == 0)
return FALSE;
1700 if ((r1->order[
i] != r2->order[
i])
1701 || (r1->block0[
i] != r2->block0[
i])
1702 || (r1->block1[
i] != r2->block1[
i]))
1704 if (r1->wvhdl[
i] !=
NULL)
1706 if (r2->wvhdl[
i] ==
NULL)
1708 for (
j=0;
j<r1->block1[
i]-r1->block0[
i]+1;
j++)
1709 if (r2->wvhdl[
i][
j] != r1->wvhdl[
i][
j])
1715 if (r2->order[
i] != 0)
return FALSE;
1776 if (blocks == 1)
return TRUE;
1785 if ((blocks -
s) > 2)
return FALSE;
1851 if (blocks == 1)
return TRUE;
1860 if ((blocks -
s) > 3)
return FALSE;
1863 if ((blocks -
s) == 3)
1882 for (pos=0;pos<r->OrdSize;pos++)
1900 return (
rVar(r) > 1 &&
1906 ((r->order[1]!=0) &&
1914 return ((
rVar(r) > 1) &&
1923 while(r->order[
i]!=0)
1925 if((r->block0[
i]<=
v)
1926 && (r->block1[
i]>=
v))
1931 return (r->wvhdl[
i][
v-r->block0[
i]]>0);
1970 if (r->N == 0)
return TRUE;
1972 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
1984 for(
int j=0;
j<=
i;
j++)
1987 dError(
"wrong order in r->order");
1998 if (r->VarOffset ==
NULL)
2000 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d", fn,
l);
2005 if ((r->OrdSize==0)!=(r->typ==
NULL))
2007 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
2013 for(
i=0;
i<=r->N;
i++)
2017 for(
j=0;
j<r->OrdSize;
j++)
2021 const int p = r->typ[
j].data.isTemp.suffixpos;
2026 assume( p < r->OrdSize );
2028 if(r->typ[
p].ord_typ !=
ro_is)
2029 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",
j,
p);
2032 if(r->typ[
j].data.isTemp.pVarOffset[
i] != -1)
2038 else if (r->typ[
j].ord_typ ==
ro_is)
2041 if(r->typ[
j].data.is.pVarOffset[
i] != -1)
2049 if (r->typ[
j].ord_typ==
ro_cp)
2051 if(((
short)r->VarOffset[
i]) == r->typ[
j].data.cp.place)
2056 && (r->VarOffset[
i] == r->typ[
j].data.dp.place))
2062 tmp=r->VarOffset[
i] & 0xffffff;
2063 #if SIZEOF_LONG == 8
2064 if ((r->VarOffset[
i] >> 24) >63)
2066 if ((r->VarOffset[
i] >> 24) >31)
2068 dReportError(
"bit_start out of range:%d",r->VarOffset[
i] >> 24);
2069 if (
i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2071 dReportError(
"varoffset out of range for var %d: %d",
i,tmp);
2076 for(
j=0;
j<r->OrdSize;
j++)
2078 if ((r->typ[
j].ord_typ==
ro_dp)
2079 || (r->typ[
j].ord_typ==
ro_wp)
2082 if (r->typ[
j].data.dp.start > r->typ[
j].data.dp.end)
2084 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end);
2085 if ((r->typ[
j].data.dp.start < 1)
2086 || (r->typ[
j].data.dp.end > r->N))
2087 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",
j,
2088 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end,r->N);
2120 static void rO_TDegree(
int &place,
int &bitplace,
int start,
int end,
2126 ord_struct.
data.dp.start=start;
2127 ord_struct.
data.dp.end=end;
2128 ord_struct.
data.dp.place=place;
2140 ord_struct.
data.dp.start=start;
2141 ord_struct.
data.dp.end=end;
2142 ord_struct.
data.dp.place=place;
2148 static void rO_WDegree(
int &place,
int &bitplace,
int start,
int end,
2149 long *o,
sro_ord &ord_struct,
int *weights)
2152 while((start<end) && (weights[0]==0)) { start++; weights++; }
2153 while((start<end) && (weights[end-start]==0)) { end--; }
2156 for(
i=start;
i<=end;
i++)
2158 if(weights[
i-start]!=1)
2166 rO_TDegree(place,bitplace,start,end,o,ord_struct);
2171 ord_struct.
data.wp.start=start;
2172 ord_struct.
data.wp.end=end;
2173 ord_struct.
data.wp.place=place;
2174 ord_struct.
data.wp.weights=weights;
2178 for(
i=start;
i<=end;
i++)
2180 if(weights[
i-start]<0)
2188 static void rO_WMDegree(
int &place,
int &bitplace,
int start,
int end,
2189 long *o,
sro_ord &ord_struct,
int *weights)
2198 ord_struct.
data.am.start=start;
2199 ord_struct.
data.am.end=end;
2200 ord_struct.
data.am.place=place;
2201 ord_struct.
data.am.weights=weights;
2202 ord_struct.
data.am.weights_m = weights + (end-start+1);
2203 ord_struct.
data.am.len_gen=weights[end-start+1];
2204 assume( ord_struct.
data.am.weights_m[0] == ord_struct.
data.am.len_gen );
2217 ord_struct.
data.wp64.start=start;
2218 ord_struct.
data.wp64.end=end;
2219 ord_struct.
data.wp64.place=place;
2220 ord_struct.
data.wp64.weights64=weights;
2229 long *o,
sro_ord &ord_struct,
int *weights)
2232 while((start<end) && (weights[0]==0)) { start++; weights++; }
2233 while((start<end) && (weights[end-start]==0)) { end--; }
2236 ord_struct.
data.wp.start=start;
2237 ord_struct.
data.wp.end=end;
2238 ord_struct.
data.wp.place=place;
2239 ord_struct.
data.wp.weights=weights;
2244 for(
i=start;
i<=end;
i++)
2246 if(weights[
i-start]<0)
2254 static void rO_LexVars(
int &place,
int &bitplace,
int start,
int end,
2255 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2260 if(prev_ord==-1)
rO_Align(place,bitplace);
2266 for(
k=start;;
k+=incr)
2271 v[
k]= place | (bitplace << 24);
2277 assume((opt_var == end+1) ||(opt_var == end-1));
2278 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-2");
2279 int save_bitplace=bitplace;
2283 bitplace=save_bitplace;
2287 v[opt_var]=place | (bitplace << 24);
2292 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2297 if(prev_ord==1)
rO_Align(place,bitplace);
2303 for(
k=start;;
k+=incr)
2308 v[
k]=place | (bitplace << 24);
2315 assume((opt_var == end+1) ||(opt_var == end-1));
2316 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-1");
2317 int save_bitplace=bitplace;
2321 bitplace=save_bitplace;
2325 v[opt_var]=place | (bitplace << 24);
2336 ord_struct.
data.syzcomp.place=place;
2337 ord_struct.
data.syzcomp.Components=
NULL;
2338 ord_struct.
data.syzcomp.ShiftedComponents=
NULL;
2345 static void rO_Syz(
int &place,
int &bitplace,
int &prev_ord,
2346 int syz_comp,
long *o,
sro_ord &ord_struct)
2353 ord_struct.
data.syz.place=place;
2354 ord_struct.
data.syz.limit=syz_comp;
2356 ord_struct.
data.syz.syz_index = (
int*)
omAlloc0((syz_comp+1)*
sizeof(int));
2358 ord_struct.
data.syz.syz_index =
NULL;
2359 ord_struct.
data.syz.curr_index = 1;
2372 long *o,
int ,
int *
v,
sro_ord &ord_struct)
2379 ord_struct.
data.isTemp.start = place;
2381 ord_struct.
data.isTemp.suffixpos = -1;
2389 static void rO_ISSuffix(
int &place,
int &bitplace,
int &prev_ord,
long *o,
2394 int typ_j = typ_i - 1;
2397 if( tmp_typ[typ_j].ord_typ ==
ro_isTemp)
2410 const int start = tmp_typ[typ_j].
data.isTemp.start;
2411 int *pVarOffset = tmp_typ[typ_j].
data.isTemp.pVarOffset;
2422 tmp_typ[typ_j].
data.isTemp.suffixpos = typ_i;
2429 for(
int i = 0;
i <=
N;
i++ )
2432 if(
v[
i] != pVarOffset[
i] )
2434 pVarOffset[
i] =
v[
i];
2436 assume( pVarOffset[
i] != -1 );
2442 if( pVarOffset[0] != -1 )
2443 pVarOffset[0] &= 0x0fff;
2445 sro_ord &ord_struct = tmp_typ[typ_j];
2449 ord_struct.
data.is.start = start;
2450 ord_struct.
data.is.end = place;
2451 ord_struct.
data.is.pVarOffset = pVarOffset;
2473 v[0] = place | (bitplace << 24);
2484 bits=16; bitmask=0xffff;
2486 else if (bitmask <= 1L)
2488 bits=1; bitmask = 1L;
2490 else if (bitmask <= 3L)
2492 bits=2; bitmask = 3L;
2494 else if (bitmask <= 7L)
2498 else if (bitmask <= 0xfL)
2500 bits=4; bitmask=0xfL;
2502 else if (bitmask <= 0x1fL)
2504 bits=5; bitmask=0x1fL;
2506 else if (bitmask <= 0x3fL)
2508 bits=6; bitmask=0x3fL;
2510 #if SIZEOF_LONG == 8
2511 else if (bitmask <= 0x7fL)
2513 bits=7; bitmask=0x7fL;
2516 else if (bitmask <= 0xffL)
2518 bits=8; bitmask=0xffL;
2520 #if SIZEOF_LONG == 8
2521 else if (bitmask <= 0x1ffL)
2523 bits=9; bitmask=0x1ffL;
2526 else if (bitmask <= 0x3ffL)
2528 bits=10; bitmask=0x3ffL;
2530 #if SIZEOF_LONG == 8
2531 else if (bitmask <= 0xfffL)
2533 bits=12; bitmask=0xfff;
2536 else if (bitmask <= 0xffffL)
2538 bits=16; bitmask=0xffffL;
2540 #if SIZEOF_LONG == 8
2541 else if (bitmask <= 0xfffffL)
2543 bits=20; bitmask=0xfffffL;
2545 else if (bitmask <= 0xffffffffL)
2547 bits=32; bitmask=0xffffffffL;
2549 else if (bitmask <= 0x7fffffffffffffffL)
2551 bits=63; bitmask=0x7fffffffffffffffL;
2555 bits=63; bitmask=0x7fffffffffffffffL;
2558 else if (bitmask <= 0x7fffffff)
2560 bits=31; bitmask=0x7fffffff;
2564 bits=31; bitmask=0x7fffffffL;
2575 #if SIZEOF_LONG == 8
2590 unsigned long bitmask1 =
rGetExpSize(bitmask+1, bits1);
2592 if ((((
N+vars_per_long-1)/vars_per_long) ==
2593 ((
N+vars_per_long1-1)/vars_per_long1)))
2595 vars_per_long=vars_per_long1;
2615 unsigned long exp_limit)
2622 int iNeedInducedOrderingSetup = 0;
2626 need_other_ring = (exp_limit != r->bitmask);
2630 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2631 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2632 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2641 if (r->block0[
i]==r->block1[
i])
2666 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2680 need_other_ring=
TRUE;
2681 try_omit_comp=
FALSE;
2682 copy_block_index=
FALSE;
2696 need_other_ring=
TRUE;
2698 omitted_degree =
TRUE;
2712 need_other_ring=
TRUE;
2714 omitted_degree =
TRUE;
2722 try_omit_comp =
FALSE;
2725 iNeedInducedOrderingSetup++;
2734 try_omit_comp =
FALSE;
2743 if (copy_block_index)
2745 block0[
j]=r->block0[
i];
2746 block1[
j]=r->block1[
i];
2747 wvhdl[
j]=r->wvhdl[
i];
2752 if(!need_other_ring)
2772 res->bitmask=exp_limit;
2779 if (r->pFDegOrig !=
res->pFDegOrig &&
2784 res->firstwv = r->firstwv;
2785 res->firstBlockEnds = r->firstBlockEnds;
2789 res->pLDeg = r->pLDegOrig;
2798 res->typ[0] = r->typ[0];
2800 if (r->typ[0].data.syz.limit > 0)
2802 res->typ[0].data.syz.syz_index
2803 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(int));
2804 memcpy(
res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2805 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2809 if( iNeedInducedOrderingSetup > 0 )
2811 for(
j = 0,
i = 0; (
i < nblocks) && (iNeedInducedOrderingSetup > 0);
i++)
2818 r->typ[
i].data.is.limit,
2823 iNeedInducedOrderingSetup--;
2829 res->OrdSgn=r->OrdSgn;
2838 WarnS(
"error in nc_rComplete");
2851 WarnS(
"error in sca_Force!");
2877 res->block1[0] = r->N;
2878 res->wvhdl[0] = weights;
2893 WarnS(
"error in nc_rComplete");
2920 int nblocks=1+(ommit_comp!=0);
2922 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2923 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(int));
2924 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2943 res->bitmask=exp_limit;
2954 WarnS(
"error in nc_rComplete");
2970 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
2998 r->CanShortOut=
FALSE;
3001 r->CanShortOut =
TRUE;
3009 r->CanShortOut=
FALSE;
3020 if (r->N <
N)
N = r->N;
3022 for (
i=(
N-1);
i>=0;
i--)
3024 if(r->names[
i] !=
NULL && strlen(r->names[
i])>1)
3026 r->CanShortOut=
FALSE;
3032 r->ShortOut = r->CanShortOut;
3034 assume( !( !r->CanShortOut && r->ShortOut ) );
3042 if(block1[
i]!=r->N) r->LexOrder=
TRUE;
3043 r->firstBlockEnds=block1[
i];
3044 r->firstwv = wvhdl[
i];
3053 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3055 if (r->firstwv[
j]==0) r->LexOrder=
TRUE;
3062 for(
j=block1[
i]-r->block0[
i];
j>=0;
j--)
3064 if (
w[
j]==0) r->LexOrder=
TRUE;
3071 if (r->pFDeg ==
p_Deg)
3092 r->pLDegOrig = r->pLDeg;
3099 int* block0 = r->block0;
3100 int* block1 = r->block1;
3101 int** wvhdl = r->wvhdl;
3110 r->LexOrder =
FALSE;
3117 for(
int ii=block0[0];ii<=block1[0];ii++)
3118 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3120 for(
int ii=block0[0];ii<=block1[0];ii++)
3121 if (wvhdl[0][ii-1]==0) { r->LexOrder=
TRUE;
break;}
3122 if ((block0[0]==1)&&(block1[0]==r->N))
3133 r->firstwv = wvhdl[0];
3145 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3164 for(
int ii=block0[0];ii<=block1[0];ii++)
3166 if (wvhdl[0][ii-1]<0) { r->MixedOrder=2;
break;}
3168 if (r->MixedOrder==0)
3170 if ((block0[0]==1)&&(block1[0]==r->N))
3178 r->firstBlockEnds=block1[0];
3179 r->firstwv = wvhdl[0];
3198 r->firstBlockEnds=block1[1];
3199 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3207 for(
int ii=block0[1];ii<=block1[1];ii++)
3208 if (wvhdl[1][ii-1]<0) { r->MixedOrder=2;
break;}
3209 if (r->MixedOrder==
FALSE)
3242 if(r->MixedOrder==
FALSE)
3257 r->pFDegOrig = r->pFDeg;
3272 for(
i=0;
i<r->OrdSize;
i++)
3275 ||(r->typ[
i].ord_typ==
ro_am))
3280 r->NegWeightL_Size=
l;
3281 r->NegWeightL_Offset=(
int *)
omAlloc(
l*
sizeof(
int));
3283 for(
i=0;
i<r->OrdSize;
i++)
3287 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3290 else if(r->typ[
i].ord_typ==
ro_am)
3292 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3299 r->NegWeightL_Size = 0;
3300 r->NegWeightL_Offset =
NULL;
3312 if ( (r->cf->extRing!=
NULL)
3321 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3338 r->pLexOrder=r->LexOrder;
3346 static inline int sign(
int x) {
return (
x > 0) - (
x < 0);}
3371 if (r->VarOffset!=
NULL && force == 0)
return FALSE;
3377 r->BitsPerExp = bits;
3382 long *tmp_ordsgn=(
long *)
omAlloc0(3*(n+r->N)*
sizeof(long));
3384 int *
v=(
int *)
omAlloc((r->N+1)*
sizeof(int));
3385 for(
i=r->N;
i>=0 ;
i--)
3402 switch (r->order[
i])
3406 rO_WDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3412 rO_WMDegree(
j,j_bits,r->block0[
i],r->block1[
i],tmp_ordsgn,tmp_typ[typ_i],
3419 tmp_typ[typ_i], (
int64 *)(r->wvhdl[
i]));
3426 r->ComponentOrder=1;
3432 r->ComponentOrder=-1;
3438 k=r->block1[
i]-r->block0[
i]+1;
3443 r->wvhdl[
i]+(r->block1[
i]-r->block0[
i]+1)*
l);
3450 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i], prev_ordsgn,
3451 tmp_ordsgn,
v,bits, -1);
3456 tmp_ordsgn,
v, bits, -1);
3461 tmp_ordsgn,
v, bits, -1);
3465 rO_LexVars(
j, j_bits, r->block1[
i],r->block0[
i], prev_ordsgn,
3466 tmp_ordsgn,
v, bits, -1);
3470 if (r->block0[
i]==r->block1[
i])
3472 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3473 tmp_ordsgn,
v, bits, -1);
3481 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3486 if (r->block0[
i]==r->block1[
i])
3488 rO_LexVars(
j, j_bits, r->block0[
i],r->block0[
i], prev_ordsgn,
3489 tmp_ordsgn,
v, bits, -1);
3496 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3497 tmp_ordsgn,
v, bits, r->block1[
i]);
3502 if (r->block0[
i]==r->block1[
i])
3505 tmp_ordsgn,
v,bits, -1);
3513 prev_ordsgn,tmp_ordsgn,
v,bits, r->block0[
i]);
3518 if (r->block0[
i]==r->block1[
i])
3521 tmp_ordsgn,
v, bits, -1);
3528 rO_LexVars(
j, j_bits, r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3529 tmp_ordsgn,
v, bits, r->block1[
i]);
3535 tmp_typ[typ_i], r->wvhdl[
i]);
3540 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3542 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3544 if (have_bad_weights)
3551 if (r->block1[
i]!=r->block0[
i])
3554 tmp_ordsgn,
v,bits, r->block0[
i]);
3560 tmp_typ[typ_i], r->wvhdl[
i]);
3565 for(jj=r->block1[
i]-r->block0[
i];jj>=0; jj--)
3567 if (r->wvhdl[
i][jj]<=0) have_bad_weights=
TRUE;
3569 if (have_bad_weights)
3576 if (r->block1[
i]!=r->block0[
i])
3578 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3579 tmp_ordsgn,
v, bits, r->block1[
i]);
3585 tmp_typ[typ_i], r->wvhdl[
i]);
3587 if (r->block1[
i]!=r->block0[
i])
3590 tmp_ordsgn,
v,bits, r->block0[
i]);
3596 tmp_typ[typ_i], r->wvhdl[
i]);
3598 if (r->block1[
i]!=r->block0[
i])
3600 rO_LexVars(
j, j_bits,r->block0[
i],r->block1[
i]-1, prev_ordsgn,
3601 tmp_ordsgn,
v, bits, r->block1[
i]);
3608 rO_Syzcomp(
j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3609 need_to_add_comp=
TRUE;
3610 r->ComponentOrder=-1;
3616 rO_Syz(
j, j_bits, prev_ordsgn, r->block0[
i], tmp_ordsgn, tmp_typ[typ_i]);
3617 need_to_add_comp=
TRUE;
3618 r->ComponentOrder=-1;
3625 assume( r->block0[
i] == r->block1[
i] );
3626 const int s = r->block0[
i];
3630 rO_ISPrefix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ[typ_i++]);
3633 rO_ISSuffix(
j, j_bits, prev_ordsgn, tmp_ordsgn, r->N,
v, tmp_typ, typ_i,
s);
3634 need_to_add_comp=
FALSE;
3653 j_bits=j_bits0;
j=j0;
3658 if((need_to_add_comp) && (
v[0]== -1))
3672 for(
i=1 ;
i<=r->N ;
i++)
3699 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3701 for(
j=0;
j<r->CmpL_Size;
j++)
3703 r->ordsgn[
j] = tmp_ordsgn[
j];
3712 if (typ_i==0) r->typ=
NULL;
3716 memcpy(r->typ,tmp_typ,typ_i*
sizeof(
sro_ord));
3726 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3729 if (
i==r->pCompIndex)
i++;
3730 while ((j < r->OrdSize)
3738 if (
i==r->pCompIndex)
i++;
3776 for(
int i=1;
i<=r->N;
i++)
3783 if ((r->block0[
j]<=
i)&&(r->block1[
j]>=
i))
3803 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3809 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3820 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3826 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3855 if (nonneg>0) r->MixedOrder=1;
3866 if (r ==
NULL)
return;
3867 if (r->VarOffset !=
NULL)
3869 if (r->OrdSize!=0 && r->typ !=
NULL)
3871 for(
int i = 0;
i < r->OrdSize;
i++)
3872 if( r->typ[
i].ord_typ ==
ro_is)
3875 r->typ[
i].data.is.F =
NULL;
3877 if( r->typ[
i].data.is.pVarOffset !=
NULL )
3880 r->typ[
i].data.is.pVarOffset =
NULL;
3883 else if (r->typ[
i].ord_typ ==
ro_syz)
3885 if(r->typ[
i].data.syz.limit > 0)
3886 omFreeSize(r->typ[
i].data.syz.syz_index, ((r->typ[
i].data.syz.limit) +1)*
sizeof(
int));
3887 r->typ[
i].data.syz.syz_index =
NULL;
3891 assume( r->typ[
i].data.syzcomp.ShiftedComponents ==
NULL );
3892 assume( r->typ[
i].data.syzcomp.Components ==
NULL );
3902 if (r->PolyBin !=
NULL)
3907 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
3909 if (r->p_Procs !=
NULL)
3911 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
3913 if (r->NegWeightL_Offset!=
NULL)
3915 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
3916 r->NegWeightL_Offset=
NULL;
3924 int* VarL_Number = (
int*)
omAlloc0(r->ExpL_Size*
sizeof(
int));
3929 for (
i=1;
i<=r->N;
i++)
3931 VarL_Number[r->VarOffset[
i] & 0xffffff]++;
3935 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
3937 if (VarL_Number[
i] != 0)
3939 if (
min > VarL_Number[
i])
3941 min = VarL_Number[
i];
3950 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
3951 r->VarL_LowIndex = 0;
3954 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
3956 if (VarL_Number[
i] != 0)
3958 r->VarL_Offset[
j] =
i;
3959 if (
j > 0 && r->VarL_Offset[
j-1] != r->VarL_Offset[
j] - 1)
3960 r->VarL_LowIndex = -1;
3964 if (r->VarL_LowIndex >= 0)
3965 r->VarL_LowIndex = r->VarL_Offset[0];
3969 j = r->VarL_Offset[min_j];
3970 r->VarL_Offset[min_j] = r->VarL_Offset[0];
3971 r->VarL_Offset[0] =
j;
3978 int* shifts = (
int*)
omAlloc(r->ExpL_Size*
sizeof(
int));
3981 for (
i=0;
i<r->ExpL_Size;
i++)
3985 for (
i=1;
i<=r->N;
i++)
3987 if (shifts[r->VarOffset[
i] & 0xffffff] > r->VarOffset[
i] >> 24)
3988 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
3991 for (
i=1;
i<=r->N;
i++)
3993 if (shifts[r->VarOffset[
i] & 0xffffff] != 0)
3995 = (r->VarOffset[
i] & 0xffffff) |
3996 (((r->VarOffset[
i] >> 24) - shifts[r->VarOffset[
i] & 0xffffff]) << 24);
4004 unsigned long divmask = 1;
4009 divmask |= (((
unsigned long) 1) << (
unsigned long)
i);
4024 const char *TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
4025 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
4028 Print(
"ExpL_Size:%d ",r->ExpL_Size);
4029 Print(
"CmpL_Size:%d ",r->CmpL_Size);
4030 Print(
"VarL_Size:%d\n",r->VarL_Size);
4031 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4032 Print(
"divmask=%lx\n", r->divmask);
4033 Print(
"BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4035 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
4036 PrintS(
"VarL_Offset:\n");
4039 for(
j = 0;
j < r->VarL_Size;
j++)
4040 Print(
" VarL_Offset[%d]: %d ",
j, r->VarL_Offset[
j]);
4047 for(
j=0;
j<=r->N;
j++)
4048 Print(
" v%d at e-pos %d, bit %d\n",
4049 j,r->VarOffset[
j] & 0xffffff, r->VarOffset[
j] >>24);
4051 for(
j=0;
j<r->CmpL_Size;
j++)
4052 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[
j],
j);
4053 Print(
"OrdSgn:%d\n",r->OrdSgn);
4055 for(
j=0;
j<r->OrdSize;
j++)
4057 Print(
" typ %s", TYP[r->typ[
j].ord_typ]);
4058 if (r->typ[
j].ord_typ==
ro_syz)
4060 const short place = r->typ[
j].data.syz.place;
4061 const int limit = r->typ[
j].data.syz.limit;
4062 const int curr_index = r->typ[
j].data.syz.curr_index;
4063 const int* syz_index = r->typ[
j].data.syz.syz_index;
4065 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4067 if( syz_index ==
NULL )
4072 for(
i=0;
i <= limit;
i++ )
4073 Print(
"%d ", syz_index[
i]);
4080 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[
j].data.isTemp.start, r->typ[
j].data.isTemp.suffixpos);
4083 else if (r->typ[
j].ord_typ==
ro_is)
4085 Print(
" start %d, end: %d: ",r->typ[
j].data.is.start, r->typ[
j].data.is.end);
4089 Print(
" limit %d",r->typ[
j].data.is.limit);
4096 else if (r->typ[
j].ord_typ==
ro_am)
4098 Print(
" place %d",r->typ[
j].data.am.place);
4099 Print(
" start %d",r->typ[
j].data.am.start);
4100 Print(
" end %d",r->typ[
j].data.am.end);
4101 Print(
" len_gen %d",r->typ[
j].data.am.len_gen);
4104 for(
l=r->typ[
j].data.am.start;l<=r->typ[
j].data.am.end;
l++)
4105 Print(
" %d",r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start]);
4106 l=r->typ[
j].data.am.end+1;
4107 int ll=r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start];
4109 for(
int lll=
l+1;lll<
l+ll+1;lll++)
4110 Print(
" %d",r->typ[
j].data.am.weights[lll-r->typ[
j].data.am.start]);
4114 Print(
" place %d",r->typ[
j].data.dp.place);
4118 Print(
" start %d",r->typ[
j].data.dp.start);
4119 Print(
" end %d",r->typ[
j].data.dp.end);
4120 if ((r->typ[
j].ord_typ==
ro_wp)
4124 for(
int l=r->typ[
j].data.wp.start;l<=r->typ[
j].data.wp.end;
l++)
4125 Print(
" %d",r->typ[
j].data.wp.weights[
l-r->typ[
j].data.wp.start]);
4127 else if (r->typ[
j].ord_typ==
ro_wp64)
4131 for(
l=r->typ[
j].data.wp64.start;l<=r->typ[
j].data.wp64.end;
l++)
4132 Print(
" %ld",(
long)(((
int64*)r->typ[
j].data.wp64.weights64)+
l-r->typ[
j].data.wp64.start));
4138 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4139 Print(
"OrdSize:%d\n",r->OrdSize);
4140 PrintS(
"--------------------\n");
4141 for(
j=0;
j<r->ExpL_Size;
j++)
4144 if (j< r->CmpL_Size)
4145 Print(
"ordsgn %ld ", r->ordsgn[
j]);
4151 if( (r->VarOffset[
i] & 0xffffff) ==
j )
4152 {
Print(
"v%d at e[%d], bit %d; ",
i,r->VarOffset[
i] & 0xffffff,
4153 r->VarOffset[
i] >>24 ); }
4155 if( r->pCompIndex==
j )
PrintS(
"v0; ");
4156 for(
i=0;
i<r->OrdSize;
i++)
4158 if (r->typ[
i].data.dp.place ==
j)
4160 Print(
"ordrec:%s (start:%d, end:%d) ",TYP[r->typ[
i].ord_typ],
4161 r->typ[
i].data.dp.start, r->typ[
i].data.dp.end);
4165 if (
j==r->pOrdIndex)
4170 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4172 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4173 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4175 for(
j = 0;
j < r->NegWeightL_Size;
j++)
4176 Print(
" [%d]: %d ",
j, r->NegWeightL_Offset[
j]);
4187 Print(
"p_Spec : %s, %s, %s\n", field,
length, ord);
4189 for (
i=0;
i<(int) (
sizeof(
p_Procs_s)/
sizeof(
void*));
i++)
4191 Print(
" %s,\n", ((
char**) &proc_names)[
i]);
4197 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4203 Print(
"(%p)", r->pFDeg);
4206 Print(
"pLDeg : (%p)", r->pLDeg);
4218 else Print(
"%p\n",r->p_Setm);
4228 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4229 for(
i=0;
i<r->ExpL_Size;
i++)
4237 if (
j==0) {
PrintS(
"...\n");
break; }
4246 Print(
"\nexp[0..%d]\n",
R->ExpL_Size - 1);
4247 for(
int i = 0;
i <
R->ExpL_Size;
i++)
4266 for(
int j = (F->ncols*F->nrows) - 1;
j >= 0;
j-- )
4280 Print(
"gen[%d] -> gen(%d)\n", c,
MIN + (*V)[ c -
MIN - 1 ]);
4304 r->typ[1].data.syzcomp.Components = currComponents;
4312 *currComponents = r->typ[1].data.syzcomp.Components;
4322 r->typ[1].data.syzcomp.length =
length;
4332 *
length = r->typ[1].data.syzcomp.length;
4374 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4385 int ** wvhdl =(
int **)
omAlloc0((
i+1)*
sizeof(
int**));
4388 res->order[
j]=r->order[
j-1];
4389 res->block0[
j]=r->block0[
j-1];
4390 res->block1[
j]=r->block1[
j-1];
4391 if (r->wvhdl[
j-1] !=
NULL)
4409 WarnS(
"error in nc_rComplete");
4419 if (r->qideal!=
NULL)
4450 for(
i=r->OrdSize-1;
i>=0;
i--)
4452 if ((r->typ[
i].ord_typ==
ro_dp)
4453 && (r->typ[
i].data.dp.start==1)
4454 && (r->typ[
i].data.dp.end==r->N))
4468 for(
i=r->OrdSize-1;
i>=0;
i--)
4470 if ((r->typ[
i].ord_typ==
ro_dp)
4471 && (r->typ[
i].data.dp.start==1)
4472 && (r->typ[
i].data.dp.end==r->N))
4474 pos=r->typ[
i].data.dp.place;
4494 res->ExpL_Size=r->ExpL_Size+1;
4498 for(
j=0;
j<r->CmpL_Size;
j++)
4500 res->ordsgn[
j] = r->ordsgn[
j];
4502 res->OrdSize=r->OrdSize+1;
4507 memcpy(
res->typ,r->typ,r->OrdSize*
sizeof(
sro_ord));
4511 res->typ[
res->OrdSize-1].data.dp.start=1;
4512 res->typ[
res->OrdSize-1].data.dp.end=
res->N;
4513 res->typ[
res->OrdSize-1].data.dp.place=
res->ExpL_Size-1;
4514 pos=
res->ExpL_Size-1;
4530 WarnS(
"error in nc_rComplete");
4536 if (r->qideal!=
NULL)
4566 if (r->order[
i] == 0)
4575 new_r->wvhdl=(
int **)
omAlloc0(
i *
sizeof(
int *));
4577 new_r->block0 = (
int *)
omAlloc0(
i *
sizeof(
int));
4578 new_r->block1 = (
int *)
omAlloc0(
i *
sizeof(
int));
4580 memcpy(new_r->block0,r->block0,(
i-1) *
sizeof(
int));
4581 memcpy(new_r->block1,r->block1,(
i-1) *
sizeof(
int));
4582 for (
int j=0;
j<=last_block;
j++)
4584 if (r->wvhdl[
j]!=
NULL)
4586 new_r->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[
j]);
4603 WarnS(
"error in nc_rComplete");
4615 int last_block =
rBlocks(r) - 2;
4622 for (
i=0;
i< last_block;
i++)
4633 for (
i=c_pos+1;
i<=last_block;
i++)
4635 new_r->order[
i-1] = new_r->order[
i];
4636 new_r->block0[
i-1] = new_r->block0[
i];
4637 new_r->block1[
i-1] = new_r->block1[
i];
4638 new_r->wvhdl[
i-1] = new_r->wvhdl[
i];
4640 new_r->order[last_block] = r->order[c_pos];
4641 new_r->block0[last_block] = r->block0[c_pos];
4642 new_r->block1[last_block] = r->block1[c_pos];
4643 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4654 WarnS(
"error in nc_rComplete");
4679 if (new_r_1 != new_r && new_r_1 != old_r)
rDelete(new_r_1);
4687 # ifndef SING_NDEBUG
4688 WarnS(
"error in nc_rComplete");
4695 if (old_r->qideal !=
NULL)
4697 new_r->qideal =
idrCopyR(old_r->qideal, old_r, new_r);
4705 WarnS(
"error in nc_SetupQuotient");
4730 if ((r_blocks == 3) &&
4731 (r->order[0] == b1) &&
4732 (r->order[1] == b2) &&
4745 res->block1[1] = r->N;
4750 res->block1[0] = r->N;
4760 WarnS(
"error in nc_rComplete");
4773 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete,
sgn);
4790 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
4798 res->block0[
j] =
res->block1[
j] = 0;
4802 for(
int i = 0; (
i <= n) && (r->order[
i] != 0);
i++,
j++)
4804 res->order [
j] = r->order [
i];
4805 res->block0[
j] = r->block0[
i];
4806 res->block1[
j] = r->block1[
i];
4808 if (r->wvhdl[
i] !=
NULL)
4840 WarnS(
"error in nc_rComplete");
4852 if (r->qideal!=
NULL)
4909 Print(
"rIsIS(p: %d)\nF:",
p);
4920 for(
int pos = 0; pos < r->OrdSize; pos++ )
4921 if( r->typ[pos].ord_typ ==
ro_is)
4943 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4952 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4957 if(
i != r->typ[pos].data.is.limit )
4958 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit,
i);
4961 const ideal FF =
idrHeadR(F, r, r);
4964 if( r->typ[pos].data.is.F !=
NULL)
4967 PrintS(
"Deleting old reference set F... \n");
4970 r->typ[pos].data.is.F =
NULL;
4975 r->typ[pos].data.is.F = FF;
4977 r->typ[pos].data.is.limit =
i;
5001 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
5003 r->block0[0]=r->block1[0] =
k;
5004 if(
k == r->typ[0].data.syz.limit )
5008 if (r->typ[0].data.syz.limit == 0)
5010 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((
k+1)*
sizeof(int));
5011 r->typ[0].data.syz.syz_index[0] = 0;
5012 r->typ[0].data.syz.curr_index = 1;
5016 r->typ[0].data.syz.syz_index = (
int*)
5018 (r->typ[0].data.syz.limit+1)*
sizeof(int),
5021 for (
i=r->typ[0].data.syz.limit + 1;
i<=
k;
i++)
5023 r->typ[0].data.syz.syz_index[
i] =
5024 r->typ[0].data.syz.curr_index;
5026 if(k < r->typ[0].data.syz.limit)
5029 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)",
k, r->typ[0].data.syz.limit);
5031 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5035 r->typ[0].data.syz.limit =
k;
5036 r->typ[0].data.syz.curr_index++;
5045 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!",
k);
5050 r->block0[0] = r->block1[0] =
k;
5065 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5066 r->typ[0].data.syz.limit > 0 &&
i > 0)
5068 assume(i <= r->typ[0].data.syz.limit);
5070 for (
j=0;
j<r->typ[0].data.syz.limit;
j++)
5072 if (r->typ[0].data.syz.syz_index[
j] ==
i &&
5073 r->typ[0].data.syz.syz_index[
j+1] !=
i)
5075 assume(r->typ[0].data.syz.syz_index[
j+1] ==
i+1);
5079 return r->typ[0].data.syz.limit;
5084 WarnS(
"rGetMaxSyzComp: order c");
5094 for (
i=0;
i<nb;
i++)
5096 if (r->wvhdl[
i] !=
NULL)
5098 int length = r->block1[
i] - r->block0[
i];
5099 int* wvhdl = r->wvhdl[
i];
5105 if (wvhdl[
j] != 0 && wvhdl[
j] != 1)
return FALSE;
5121 return (r->cf->type);
5143 while((r->typ[
i].ord_typ!=
ro_wp64) && (r->typ[
i].ord_typ>0))
i++;
5145 return (
int64*)(r->typ[
i].data.wp64.weights64);
5153 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*
sizeof(
int64));
5164 for(
int k=
size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5169 #if 0 // currently unused
5170 static int rReallocM1(ring r,
int size,
int pos)
5176 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5184 for(
int j=0;
j<=i2;
j++)
5192 #define rOppVar(R,I) (rVar(R)+1-I)
5218 int i2 = (
rVar(r)-1)/2;
5219 for(
i=i2;
i>=0;
i--)
5225 p = r->names[
rVar(r)-1-
i];
5226 r->names[
rVar(r)-1-
i] = r->names[
i];
5243 char *
p=r->names[
i];
5244 if(isupper(*
p)) *
p = tolower(*
p);
5245 else *
p = toupper(*
p);
5292 for(
i=0; src->order[
i]!=0;
i++)
5294 switch (src->order[
i])
5299 r->order[
j]=src->order[
i];
5303 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5304 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5308 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5309 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5315 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5316 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5317 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5318 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5319 r->wvhdl[
j][
k-r->block0[
j]]=1;
5322 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5323 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5331 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5332 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5333 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(int));
5334 for(
int k=r->block0[
j]; k<=r->block1[
j];
k++)
5335 r->wvhdl[
j][
k-r->block0[
j]]=1;
5338 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5339 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5347 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5348 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5349 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5353 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5354 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5362 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5363 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5364 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5368 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5369 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5376 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5377 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5378 int n=r->block1[
j]-r->block0[
j];
5380 for (
int nn=0; nn<=n; nn++)
5389 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5390 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5448 int *par_perm =
NULL;
5451 for(
i=1;
i<=r->N;
i++)
5467 MATELEM(C,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5470 MATELEM(
D,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5478 WarnS(
"Error initializing non-commutative multiplication!");
5486 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5493 if (src->qideal !=
NULL)
5498 r->qideal =
idOppose(src, src->qideal, r);
5500 r->qideal =
id_Copy(src->qideal, r);
5530 int stat =
rSum(
R, Ropp, Renv);
5532 WarnS(
"Error in rEnvelope at rSum");
5555 const int N = dest->N;
5564 const ring srcBase = src;
5571 matrix C0 = src->GetNC()->C;
5572 matrix D0 = src->GetNC()->D;
5575 for (
int i = 1;
i <
N;
i++)
5577 for (
int j =
i + 1;
j <=
N;
j++)
5580 const poly
p =
p_NSet(n, dest);
5622 while(r->order[
i]!=0)
5629 for(
j=r->block1[
i]-r->block0[
i];
j>=0;
j--)
5631 r->wvhdl[
i]=(
int*)w64;
5665 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
static int rRealloc1(ring r, int size, int pos)
int dReportError(const char *fmt,...)
BOOLEAN rRing_has_CompLastBlock(ring r)
#define omCheckAddrSize(addr, size)
long pLDeg1(poly p, int *l, const ring r)
@ n_Zn
only used if HAVE_RINGS is defined
static BOOLEAN rField_is_Zn(const ring r)
static BOOLEAN rField_is_long_R(const ring r)
BOOLEAN rRing_is_Homog(ring r)
void rSetWeightVec(ring r, int64 *wv)
BOOLEAN rCheckIV(const intvec *iv)
void StringAppendS(const char *st)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
#define omcheckAddrSize(addr, size)
static void rO_Align(int &place, int &bitplace)
size_t omSizeOfAddr(const void *addr)
long pLDeg0c(poly p, int *l, const ring r)
void p_Write0(poly p, ring lmRing, ring tailRing)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
static BOOLEAN rCanShortOut(const ring r)
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
void rDebugPrint(const ring r)
#define MATELEM(mat, i, j)
long pLDeg0(poly p, int *l, const ring r)
static BOOLEAN rField_is_Ring_2toM(const ring r)
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
#define omGetSpecBin(size)
@ rOrderType_ExpComp
simple ordering, exponent vector has priority component not compatible with exp-vector order
void p_DebugPrint(poly p, const ring r)
@ n_long_C
complex floating point (GMP) numbers
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
static nc_type & ncRingType(nc_struct *p)
void rModify_a_to_A(ring r)
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
@ n_Z2m
only used if HAVE_RINGS is defined
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
void rKillModifiedRing(ring r)
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
static void rSetNegWeight(ring r)
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
static BOOLEAN length(leftv result, leftv arg)
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
long pLDeg1c_Deg(poly p, int *l, const ring r)
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
void p_wrp(poly p, ring lmRing, ring tailRing)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
@ n_Q
rational (GMP) numbers
gmp_float sqrt(const gmp_float &a)
@ rOrderType_General
non-simple ordering as specified by currRing
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
static void rOppWeight(int *w, int l)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
@ n_Znm
only used if HAVE_RINGS is defined
const CanonicalForm CFMap CFMap & N
static BOOLEAN rField_is_Zp_a(const ring r)
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
ring nc_rCreateNCcomm_rCopy(ring r)
int rSum(ring r1, ring r2, ring &sum)
long pLDegb(poly p, int *l, const ring r)
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,...
@ n_long_R
real floating point (GMP) numbers
void p_Setm_Dummy(poly p, const ring r)
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
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 void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
ring rAssure_c_dp(const ring r)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
int r_IsRingVar(const char *n, char **names, int N)
bool sca_Force(ring rGR, int b, int e)
for(int i=0;i<=n;i++) degsf[i]
@ rOrderType_Exp
simple ordering, exponent vector has priority component is compatible with exp-vector order
long p_WFirstTotalDegree(poly p, const ring r)
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
BOOLEAN rHasSimpleOrder(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
@ n_polyExt
used to represent polys as coeffcients
n_coeffType rFieldType(ring r)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
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)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
BOOLEAN rDBTest(ring r, const char *fn, const int l)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static BOOLEAN rField_is_Q_a(const ring r)
BOOLEAN rIsPolyVar(int v, const ring r)
returns TRUE if var(i) belongs to p-block
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
void PrintS(const char *s)
#define omFreeSize(addr, size)
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
static void rOptimizeLDeg(ring r)
ring rAssure_dp_C(const ring r)
@ rOrderType_CompExp
simple ordering, component has priority
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
static void rSetOutParams(ring r)
#define omfreeSize(addr, size)
ring rAssure_dp_S(const ring r)
static short scaFirstAltVar(ring r)
static BOOLEAN rField_is_Ring(const ring r)
ring rAssure_C_dp(const ring r)
static void rSetDegStuff(ring r)
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
ring rAssure_TDeg(ring r, int &pos)
The main handler for Singular numbers which are suitable for Singular polynomials.
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
void p_Write(poly p, ring lmRing, ring tailRing)
static BOOLEAN rField_is_Ring_PtoM(const ring r)
static const char *const ringorder_name[]
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
@ n_Z
only used if HAVE_RINGS is defined
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
static int rPar(const ring r)
(r->cf->P)
long pLDeg1c(poly p, int *l, const ring r)
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
struct p_Procs_s p_Procs_s
static BOOLEAN rField_is_R(const ring r)
static void rCheckOrdSgn(ring r, int i)
BOOLEAN rHas_c_Ordering(const ring r)
void mp_Delete(matrix *a, const ring r)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
static void rSetOption(ring r)
static int rBlocks(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
void nc_rKill(ring r)
complete destructor
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
rOrderType_t rGetOrderType(ring r)
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
matrix mpNew(int r, int c)
create a r x c zero-matrix
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,...
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
void p_Setm_General(poly p, const ring r)
@ n_R
single prescision (6,6) real numbers
#define UPMATELEM(i, j, nVar)
void rDelete(ring r)
unconditionally deletes fields in r
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
long p_Deg(poly a, const ring r)
static BOOLEAN rIsNCRing(const ring r)
static void p_Delete(poly *p, const ring r)
static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
static int min(int a, int b)
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
static BOOLEAN rField_is_GF(const ring r)
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,...
p_SetmProc p_GetSetmProc(const ring r)
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
void rWrite(ring r, BOOLEAN details)
void StringSetS(const char *st)
static int si_max(const int a, const int b)
static void rSetFirstWv(ring r, int i, rRingOrder_t *order, int *block1, int **wvhdl)
#define omUnGetSpecBin(bin_ptr)
long pLDeg1_Deg(poly p, int *l, const ring r)
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
void rSetSyzComp(int k, const ring r)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
@ ringorder_IS
Induced (Schreyer) ordering.
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
void Werror(const char *fmt,...)
static short scaLastAltVar(ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
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)
const char * rSimpleOrdStr(int ord)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
void WerrorS(const char *s)
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
BOOLEAN rHasSimpleLexOrder(const ring r)
returns TRUE, if simple lp or ls ordering
ideal SCAQuotient(const ring r)
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)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
long p_WTotaldegree(poly p, const ring r)
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
static void p_Setm(poly p, const ring r)
ring rAssure_HasComp(const ring r)
const Variable & v
< [in] a sqrfree bivariate poly
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...
#define omCheckAddr(addr)
static long p_Totaldegree(poly p, const ring r)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
int64 * rGetWeightVec(const ring r)
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
const CanonicalForm int s
int rTypeOfMatrixOrder(const intvec *order)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
BOOLEAN rHasSimpleOrderAA(ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
void p_Setm_TotalDegree(poly p, const ring r)
ideal id_Copy(ideal h1, const ring r)
copy an ideal
@ ringorder_rs
opposite of ls
@ ringorder_a64
for int64 weights
#define TEST_RINGDEP_OPTS
static char const ** rParameter(const ring r)
(r->cf->parameter)
static BOOLEAN rField_is_Z(const ring r)
static bool rIsSCA(const ring r)
static BOOLEAN rField_is_long_C(const ring r)
#define omFreeBin(addr, bin)
static BOOLEAN rField_is_Zp(const ring r)
static BOOLEAN rShortOut(const ring r)
static long p_FDeg(const poly p, const ring r)
rRingOrder_t rOrderName(char *ordername)
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
poly prCopyR(poly p, ring src_r, ring dest_r)
long * currShiftedComponents
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong!...
void nKillChar(coeffs r)
undo all initialisations
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
void rKillModified_Wp_Ring(ring r)
int sgn(const Rational &a)
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Coefficient rings, fields and other domains suitable for Singular polynomials.
static BOOLEAN rField_is_Q(const 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...
#define omReallocSize(addr, o_size, size)
poly rGetVar(const int varIndex, const ring r)