52 #define BITS_PER_LONG 8*SIZEOF_LONG
90 return ringorder_name[ord];
113 ring
rDefault(
const coeffs cf,
int N,
char **
n,
int ord_size,
int *ord,
int *block0,
int *block1,
int** wvhdl)
121 r->names = (
char **)
omAlloc0(N *
sizeof(
char *));
129 r->wvhdl = (
int **)
omAlloc0((ord_size+1) *
sizeof(
int *));
140 ring
rDefault(
int ch,
int N,
char **
n,
int ord_size,
int *ord,
int *block0,
int *block1,
int ** wvhdl)
146 return rDefault(cf,N,n,ord_size,ord,block0,block1,wvhdl);
152 int *order = (
int *)
omAlloc(2*
sizeof(
int));
153 int *block0 = (
int *)
omAlloc0(2 *
sizeof(
int));
154 int *block1 = (
int *)
omAlloc0(2 *
sizeof(
int));
162 return rDefault(cf,N,n,2,order,block0,block1);
189 WerrorS(
"weights only for orderings wp,ws,Wp,Ws,a,M");
199 if ((sz*sz)!=(order->
length()-2))
201 WerrorS(
"Matrix order is not a square matrix");
204 while ((i<sz) && (typ==1))
207 while ((
j<sz) && ((*order)[
j*sz+i+2]==0))
j++;
211 WerrorS(
"Matrix order not complete");
213 else if ((*order)[
j*sz+i+2]<0)
226 for (
int i=0;
i<
N;
i++)
228 if (names[
i]==
NULL)
return -1;
229 if (strcmp(n,names[
i]) == 0)
return (
int)
i;
268 R->ShortOut = bSaveShortOut;
310 Print(
"// number of vars : %d",r->N);
315 for (
int l=0, nlen=0 ;
l<nblocks;
l++)
318 Print(
"\n// block %3d : ",
l+1);
327 Print(
" syzcomp at %d",r->typ[
l].data.syz.limit);
333 assume( r->block0[
l] == r->block1[
l] );
334 const int s = r->block0[
l];
335 assume( (-2 < s) && (s < 2) );
348 for (i = r->block0[
l]-1; i<r->block1[
l]; i++)
350 nlen = strlen(r->names[i]);
351 Print(
" %s",r->names[i]);
355 if (r->wvhdl[
l]!=
NULL)
358 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
361 PrintS(
"\n// : weights ");
362 for (i = 0; i<=r->block1[
l]-r->block0[
l]; i++)
368 Print(
"%*lld " ,nlen,w[i+
j]);
370 Print(
" %*ld" ,nlen,w[i+
j]);
374 Print(
" %*d" ,nlen,r->wvhdl[
l][i+
j]);
380 int m=r->wvhdl[
l][
i];
381 Print(
"\n// : %d module weights ",m);
383 for(;i<=
m;i++)
Print(
" %*d" ,nlen,r->wvhdl[
l][i]);
390 PrintS(
"\n// noncommutative relations:");
396 for (i = 1; i<r->N; i++)
398 for (j = i+1; j<=r->N; j++)
403 Print(
"\n// %s%s=",r->names[j-1],r->names[i-1]);
414 Print(
"\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
419 PrintS(
"\n// quotient of sca by ideal");
439 PrintS(
"\n// quotient ring from ideal");
452 if (r ==
NULL)
return;
459 if( r->qideal !=
NULL )
474 if (r->order !=
NULL)
485 if (r->wvhdl[j]!=
NULL)
498 for (i=0; i<r->N; i++)
517 if (order==0)
Werror(
"wrong ring order `%s`",ordername);
527 for (nblocks=0; r->order[nblocks]; nblocks++);
542 if (r->wvhdl[l]!=
NULL)
546 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[l]-r->block0[l]+1);
553 for (i = 0; i<r->block1[
l]-r->block0[
l]; i++)
562 for (i = 0; i<r->block1[
l]-r->block0[
l]; i++)
572 if (
j+i+1==(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1))
582 assume( r->block0[l] == r->block1[l] );
583 const int s = r->block0[
l];
584 assume( (-2 < s) && (s < 2) );
601 for (i=0; i<r->N; i++)
603 l+=strlen(r->names[i])+1;
607 for (i=0; i<r->N-1; i++)
609 strcat(s,r->names[i]);
612 strcat(s,r->names[i]);
624 char const *
const *
const params =
rParameter(r);
629 for (i=0; i<
rPar(r); i++)
631 l+=strlen(params[i])+1;
635 for (i=0; i<
rPar(r)-1; i++)
637 strcat(s, params[i]);
640 strcat(s, params[i]);
651 char *
res=(
char *)
omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
652 sprintf(res,
"(%s),(%s),(%s)",ch,var,ord);
701 for(
int i=1;
i<r->N;
i++)
702 for(
int j=
i+1;
j<=r->N;
j++)
706 WarnS(
"Error initializing multiplication!");
724 memset(&tmpR,0,
sizeof(tmpR));
775 if (r1->cf->extRing->cf==r2->cf)
785 WerrorS (
"coeff sum of two extension fields not implemented");
791 WerrorS(
"coeff sum not yet implemented");
798 char **names=(
char **)
omAlloc0(l*
sizeof(
char *));
803 for (i=0;i<r1->N;i++)
807 if (*(r1->names[i]) ==
'\0')
813 for(j=0;j<
rPar(r2);j++)
815 if (strcmp(r1->names[i],
rParameter(r2)[j])==0)
839 if (*(r2->names[i]) ==
'\0')
845 for(j=0;j<
rPar(r1);j++)
847 if (strcmp(r2->names[i],
rParameter(r1)[j])==0)
862 if (strcmp(r1->names[j],r2->names[i])==0)
906 if ((r2->block0[0]==1)
907 && (r2->block1[0]==
rVar(r2))
913 tmpR.
order[1]=r2->order[0];
914 if (r2->wvhdl[0]!=
NULL)
980 if (rb->wvhdl[i]!=
NULL)
981 WarnS(
"rSum: weights not implemented");
987 for (i=0;r1->order[
i]!=0;i++)
992 if (r1->wvhdl[i]!=
NULL)
1001 tmpR.
order[b-2]=r1->order[
i];
1003 for (i=0;r2->order[
i]!=0;i++)
1011 if (r2->wvhdl[i]!=
NULL)
1018 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1022 else if ((k==
rVar(r1)) && (k==
rVar(r2)))
1038 if (r1->wvhdl[i]!=
NULL)
1049 Werror(
"difficulties with variables: %d,%d -> %d",
rVar(r1),
rVar(r2),k);
1055 memcpy(sum,&tmpR,
sizeof(
ip_sring));
1072 if ( (R1_is_nc) || (R2_is_nc))
1097 int *par_perm1 =
NULL;
1101 int *par_perm2 =
NULL;
1106 perm1, par_perm1, sum->cf->type);
1110 perm2, par_perm2, sum->cf->type);
1113 matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1114 matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1123 for (i = 1; i <=
rVar(R1); i++)
1124 for (j=
rVar(R1)+1; j <=
l; j++)
1132 for (i=1; i<=
rVar(R1); i++)
1133 for (j=i+1; j<=
rVar(R1); j++)
1136 MATELEM(C,i,j) =
p_PermPoly(
MATELEM(C1,i,j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1139 MATELEM(D,i,j) =
p_PermPoly(
MATELEM(D1,i,j), perm1, R1, sum, nMap1, par_perm1,
rPar(R1));
1148 for (i=1; i<=
rVar(R2); i++)
1149 for (j=i+1; j<=
rVar(R2); j++)
1152 MATELEM(C,
rVar(R1)+i,
rVar(R1)+j) =
p_PermPoly(
MATELEM(C2,i,j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1155 MATELEM(D,
rVar(R1)+i,
rVar(R1)+j) =
p_PermPoly(
MATELEM(D2,i,j),perm2,R2,sum, nMap2,par_perm2,
rPar(R2));
1163 WarnS(
"Error initializing non-commutative multiplication!");
1172 Print(
"\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1195 if (r1->qideal!=
NULL)
1207 int *par_perm1 =
NULL;
1211 perm1, par_perm1, sum->cf->type);
1215 for (
int for_i=0;for_i<
IDELEMS(r1->qideal);for_i++)
1217 r1->qideal->m[for_i], perm1,
1220 par_perm1,
rPar(r1));
1225 if (r2->qideal!=
NULL)
1230 int *par_perm2 =
NULL;
1234 perm2, par_perm2, sum->cf->type);
1238 for (
int for_i=0;for_i<
IDELEMS(r2->qideal);for_i++)
1240 r2->qideal->m[for_i], perm2,
1243 par_perm2,
rPar(r2));
1265 int rSum(ring r1, ring r2, ring &sum)
1290 res->options=r->options;
1304 res->OrdSgn=r->OrdSgn;
1306 res->firstBlockEnds=r->firstBlockEnds;
1308 res->real_var_start=r->real_var_start;
1309 res->real_var_end=r->real_var_end;
1312 #ifdef HAVE_SHIFTBBA
1313 res->isLPring=r->isLPring;
1316 res->VectorOut=r->VectorOut;
1317 res->ShortOut=r->ShortOut;
1318 res->CanShortOut=r->CanShortOut;
1319 res->LexOrder=r->LexOrder;
1320 res->MixedOrder=r->MixedOrder;
1321 res->ComponentOrder=r->ComponentOrder;
1338 res->bitmask=r->bitmask;
1339 res->divmask=r->divmask;
1340 res->BitsPerExp = r->BitsPerExp;
1341 res->ExpPerLong = r->ExpPerLong;
1360 if (copy_ordering ==
TRUE)
1363 res->wvhdl = (
int **)
omAlloc(i *
sizeof(
int *));
1364 res->order = (
int *)
omAlloc(i *
sizeof(
int));
1365 res->block0 = (
int *)
omAlloc(i *
sizeof(
int));
1366 res->block1 = (
int *)
omAlloc(i *
sizeof(
int));
1369 if (r->wvhdl[j]!=
NULL)
1371 res->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[j]);
1376 memcpy(res->order,r->order,i *
sizeof(
int));
1377 memcpy(res->block0,r->block0,i *
sizeof(
int));
1378 memcpy(res->block1,r->block1,i *
sizeof(
int));
1388 res->names = (
char **)
omAlloc0(
rVar(r) *
sizeof(
char *));
1389 for (i=0; i<
rVar(res); i++)
1393 if (r->qideal!=
NULL)
1399 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1404 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1432 res->options=r->options;
1446 res->OrdSgn=r->OrdSgn;
1448 res->firstBlockEnds=r->firstBlockEnds;
1450 res->real_var_start=r->real_var_start;
1451 res->real_var_end=r->real_var_end;
1454 #ifdef HAVE_SHIFTBBA
1455 res->isLPring=r->isLPring;
1458 res->VectorOut=r->VectorOut;
1459 res->ShortOut=r->ShortOut;
1460 res->CanShortOut=r->CanShortOut;
1461 res->LexOrder=r->LexOrder;
1462 res->MixedOrder=r->MixedOrder;
1463 res->ComponentOrder=r->ComponentOrder;
1480 res->bitmask=r->bitmask;
1481 res->divmask=r->divmask;
1482 res->BitsPerExp = r->BitsPerExp;
1483 res->ExpPerLong = r->ExpPerLong;
1502 if (copy_ordering ==
TRUE)
1505 res->wvhdl = (
int **)
omAlloc(i *
sizeof(
int *));
1506 res->order = (
int *)
omAlloc(i *
sizeof(
int));
1507 res->block0 = (
int *)
omAlloc(i *
sizeof(
int));
1508 res->block1 = (
int *)
omAlloc(i *
sizeof(
int));
1509 for (j=0; j<i-1; j++)
1511 if (r->wvhdl[j]!=
NULL)
1513 res->wvhdl[j+1] = (
int*)
omMemDup(r->wvhdl[j]);
1516 res->wvhdl[j+1]=
NULL;
1518 memcpy(&(res->order[1]),r->order,(i-1) *
sizeof(
int));
1519 memcpy(&(res->block0[1]),r->block0,(i-1) *
sizeof(
int));
1520 memcpy(&(res->block1[1]),r->block1,(i-1) *
sizeof(
int));
1532 int length=wv64->
rows();
1534 for(j=length-1;j>=0;j--)
1538 res->wvhdl[0]=(
int *)A;
1540 res->block1[0]=length;
1543 res->names = (
char **)
omAlloc0(
rVar(r) *
sizeof(
char *));
1544 for (i=0; i<
rVar(res); i++)
1548 if (r->qideal!=
NULL)
1554 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1559 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1596 if (r1 == r2)
return TRUE;
1598 if (r1->cf!=r2->cf)
return FALSE;
1606 for (i=0; i<
rVar(r1); i++)
1608 if ((r1->names[i] !=
NULL) && (r2->names[
i] !=
NULL))
1610 if (strcmp(r1->names[i], r2->names[i]))
return FALSE;
1612 else if ((r1->names[i] !=
NULL) ^ (r2->names[
i] !=
NULL))
1620 if (r1->qideal !=
NULL)
1622 ideal id1 = r1->qideal, id2 = r2->qideal;
1636 else if (r2->qideal !=
NULL)
return FALSE;
1646 if (r1 == r2)
return TRUE;
1650 if ((r1->cf != r2->cf)
1652 || (r1->OrdSgn != r2->OrdSgn))
1656 while (r1->order[i] != 0)
1658 if (r2->order[i] == 0)
return FALSE;
1659 if ((r1->order[i] != r2->order[i])
1660 || (r1->block0[i] != r2->block0[i])
1661 || (r1->block1[i] != r2->block1[i]))
1663 if (r1->wvhdl[i] !=
NULL)
1665 if (r2->wvhdl[i] ==
NULL)
1667 for (j=0; j<r1->block1[
i]-r1->block0[
i]+1; j++)
1668 if (r2->wvhdl[i][j] != r1->wvhdl[i][j])
1671 else if (r2->wvhdl[i] !=
NULL)
return FALSE;
1674 if (r2->order[i] != 0)
return FALSE;
1735 if (blocks == 1)
return TRUE;
1744 if ((blocks - s) > 2)
return FALSE;
1746 assume( blocks == s + 2 );
1810 if (blocks == 1)
return TRUE;
1819 if ((blocks - s) > 3)
return FALSE;
1822 if ((blocks - s) == 3)
1841 for (pos=0;pos<r->OrdSize;pos++)
1859 return (
rVar(r) > 1 &&
1872 return ((
rVar(r) > 1) &&
1881 while(r->order[i]!=0)
1883 if((r->block0[i]<=v)
1884 && (r->block1[i]>=v))
1889 return (r->wvhdl[i][v-r->block0[i]]>0);
1928 if (r->N == 0)
return TRUE;
1945 if (r->VarOffset ==
NULL)
1947 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
1952 if ((r->OrdSize==0)!=(r->typ==
NULL))
1954 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
1960 for(i=0;i<=r->N;i++)
1964 for(j=0;j<r->OrdSize;j++)
1968 const int p = r->typ[
j].data.isTemp.suffixpos;
1973 assume( p < r->OrdSize );
1975 if(r->typ[p].ord_typ !=
ro_is)
1976 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
1979 if(r->typ[j].data.isTemp.pVarOffset[i] != -1)
1985 else if (r->typ[j].ord_typ ==
ro_is)
1988 if(r->typ[j].data.is.pVarOffset[i] != -1)
1996 if (r->typ[j].ord_typ==
ro_cp)
1998 if(((
short)r->VarOffset[i]) == r->typ[j].data.cp.place)
2003 && (r->VarOffset[i] == r->typ[j].data.dp.place))
2009 tmp=r->VarOffset[
i] & 0xffffff;
2010 #if SIZEOF_LONG == 8
2011 if ((r->VarOffset[i] >> 24) >63)
2013 if ((r->VarOffset[i] >> 24) >31)
2015 dReportError(
"bit_start out of range:%d",r->VarOffset[i] >> 24);
2016 if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2018 dReportError(
"varoffset out of range for var %d: %d",i,tmp);
2023 for(j=0;j<r->OrdSize;j++)
2025 if ((r->typ[j].ord_typ==
ro_dp)
2026 || (r->typ[j].ord_typ==
ro_wp)
2029 if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2031 r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2032 if ((r->typ[j].data.dp.start < 1)
2033 || (r->typ[j].data.dp.end > r->N))
2034 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2035 r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2067 static void rO_TDegree(
int &place,
int &bitplace,
int start,
int end,
2073 ord_struct.
data.dp.start=start;
2074 ord_struct.
data.dp.end=end;
2075 ord_struct.
data.dp.place=place;
2087 ord_struct.
data.dp.start=start;
2088 ord_struct.
data.dp.end=end;
2089 ord_struct.
data.dp.place=place;
2095 static void rO_WDegree(
int &place,
int &bitplace,
int start,
int end,
2096 long *o,
sro_ord &ord_struct,
int *weights)
2099 while((start<end) && (weights[0]==0)) { start++; weights++; }
2100 while((start<end) && (weights[end-start]==0)) { end--; }
2103 for(i=start;i<=end;i++)
2105 if(weights[i-start]!=1)
2113 rO_TDegree(place,bitplace,start,end,o,ord_struct);
2118 ord_struct.
data.wp.start=start;
2119 ord_struct.
data.wp.end=end;
2120 ord_struct.
data.wp.place=place;
2121 ord_struct.
data.wp.weights=weights;
2125 for(i=start;i<=end;i++)
2127 if(weights[i-start]<0)
2135 static void rO_WMDegree(
int &place,
int &bitplace,
int start,
int end,
2136 long *o,
sro_ord &ord_struct,
int *weights)
2145 ord_struct.
data.am.start=start;
2146 ord_struct.
data.am.end=end;
2147 ord_struct.
data.am.place=place;
2148 ord_struct.
data.am.weights=weights;
2149 ord_struct.
data.am.weights_m = weights + (end-start+1);
2150 ord_struct.
data.am.len_gen=weights[end-start+1];
2151 assume( ord_struct.
data.am.weights_m[0] == ord_struct.
data.am.len_gen );
2164 ord_struct.
data.wp64.start=start;
2165 ord_struct.
data.wp64.end=end;
2166 ord_struct.
data.wp64.place=place;
2167 ord_struct.
data.wp64.weights64=weights;
2176 long *o,
sro_ord &ord_struct,
int *weights)
2179 while((start<end) && (weights[0]==0)) { start++; weights++; }
2180 while((start<end) && (weights[end-start]==0)) { end--; }
2183 ord_struct.
data.wp.start=start;
2184 ord_struct.
data.wp.end=end;
2185 ord_struct.
data.wp.place=place;
2186 ord_struct.
data.wp.weights=weights;
2191 for(i=start;i<=end;i++)
2193 if(weights[i-start]<0)
2201 static void rO_LexVars(
int &place,
int &bitplace,
int start,
int end,
2202 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2207 if(prev_ord==-1)
rO_Align(place,bitplace);
2213 for(k=start;;k+=incr)
2218 v[
k]= place | (bitplace << 24);
2224 assume((opt_var == end+1) ||(opt_var == end-1));
2225 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-2");
2226 int save_bitplace=bitplace;
2230 bitplace=save_bitplace;
2234 v[opt_var]=place | (bitplace << 24);
2239 int &prev_ord,
long *o,
int *
v,
int bits,
int opt_var)
2244 if(prev_ord==1)
rO_Align(place,bitplace);
2250 for(k=start;;k+=incr)
2255 v[
k]=place | (bitplace << 24);
2262 assume((opt_var == end+1) ||(opt_var == end-1));
2263 if((opt_var != end+1) &&(opt_var != end-1))
WarnS(
"hier-1");
2264 int save_bitplace=bitplace;
2268 bitplace=save_bitplace;
2272 v[opt_var]=place | (bitplace << 24);
2283 ord_struct.
data.syzcomp.place=place;
2284 ord_struct.
data.syzcomp.Components=
NULL;
2285 ord_struct.
data.syzcomp.ShiftedComponents=
NULL;
2292 static void rO_Syz(
int &place,
int &bitplace,
int &prev_ord,
2300 ord_struct.
data.syz.place=place;
2301 ord_struct.
data.syz.limit=0;
2302 ord_struct.
data.syz.syz_index =
NULL;
2303 ord_struct.
data.syz.curr_index = 1;
2316 long *o,
int ,
int *
v,
sro_ord &ord_struct)
2323 ord_struct.
data.isTemp.start = place;
2324 ord_struct.
data.isTemp.pVarOffset = (
int *)
omMemDup(v);
2325 ord_struct.
data.isTemp.suffixpos = -1;
2333 static void rO_ISSuffix(
int &place,
int &bitplace,
int &prev_ord,
long *o,
2338 int typ_j = typ_i - 1;
2341 if( tmp_typ[typ_j].ord_typ ==
ro_isTemp)
2354 const int start = tmp_typ[typ_j].
data.isTemp.start;
2355 int *pVarOffset = tmp_typ[typ_j].
data.isTemp.pVarOffset;
2366 tmp_typ[typ_j].
data.isTemp.suffixpos = typ_i;
2373 for(
int i = 0;
i <=
N;
i++ )
2376 if( v[
i] != pVarOffset[
i] )
2378 pVarOffset[
i] = v[
i];
2380 assume( pVarOffset[i] != -1 );
2386 if( pVarOffset[0] != -1 )
2387 pVarOffset[0] &= 0x0fff;
2389 sro_ord &ord_struct = tmp_typ[typ_j];
2393 ord_struct.
data.is.start = start;
2394 ord_struct.
data.is.end = place;
2395 ord_struct.
data.is.pVarOffset = pVarOffset;
2417 v[0] = place | (bitplace << 24);
2428 bits=16; bitmask=0xffff;
2430 else if (bitmask <= 1L)
2432 bits=1; bitmask = 1L;
2434 else if (bitmask <= 3L)
2436 bits=2; bitmask = 3L;
2438 else if (bitmask <= 7L)
2442 else if (bitmask <= 0xfL)
2444 bits=4; bitmask=0xfL;
2446 else if (bitmask <= 0x1fL)
2448 bits=5; bitmask=0x1fL;
2450 else if (bitmask <= 0x3fL)
2452 bits=6; bitmask=0x3fL;
2454 #if SIZEOF_LONG == 8
2455 else if (bitmask <= 0x7fL)
2457 bits=7; bitmask=0x7fL;
2460 else if (bitmask <= 0xffL)
2462 bits=8; bitmask=0xffL;
2464 #if SIZEOF_LONG == 8
2465 else if (bitmask <= 0x1ffL)
2467 bits=9; bitmask=0x1ffL;
2470 else if (bitmask <= 0x3ffL)
2472 bits=10; bitmask=0x3ffL;
2474 #if SIZEOF_LONG == 8
2475 else if (bitmask <= 0xfffL)
2477 bits=12; bitmask=0xfff;
2480 else if (bitmask <= 0xffffL)
2482 bits=16; bitmask=0xffffL;
2484 #if SIZEOF_LONG == 8
2485 else if (bitmask <= 0xfffffL)
2487 bits=20; bitmask=0xfffffL;
2489 else if (bitmask <= 0xffffffffL)
2491 bits=32; bitmask=0xffffffffL;
2493 else if (bitmask <= 0x7fffffffffffffffL)
2495 bits=63; bitmask=0x7fffffffffffffffL;
2499 bits=63; bitmask=0x7fffffffffffffffL;
2502 else if (bitmask <= 0x7fffffff)
2504 bits=31; bitmask=0x7fffffff;
2508 bits=31; bitmask=0x7fffffffL;
2519 #if SIZEOF_LONG == 8
2534 unsigned long bitmask1 =
rGetExpSize(bitmask+1, bits1);
2536 if ((((N+vars_per_long-1)/vars_per_long) ==
2537 ((N+vars_per_long1-1)/vars_per_long1)))
2539 vars_per_long=vars_per_long1;
2559 unsigned long exp_limit)
2566 int iNeedInducedOrderingSetup = 0;
2570 need_other_ring = (exp_limit != r->bitmask);
2573 int *order=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2574 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2575 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2576 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2581 for(
int r_ord=r->order[i]; (r_ord != 0) && (i < nblocks); j++, r_ord=r->order[++
i])
2585 if (r->block0[i]==r->block1[i])
2610 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2624 need_other_ring=
TRUE;
2625 try_omit_comp=
FALSE;
2626 copy_block_index=
FALSE;
2640 need_other_ring=
TRUE;
2642 omitted_degree =
TRUE;
2656 need_other_ring=
TRUE;
2658 omitted_degree =
TRUE;
2666 try_omit_comp =
FALSE;
2669 iNeedInducedOrderingSetup++;
2674 assume((i == 0) && (j == 0));
2678 try_omit_comp =
FALSE;
2687 if (copy_block_index)
2689 block0[
j]=r->block0[
i];
2690 block1[
j]=r->block1[
i];
2691 wvhdl[
j]=r->wvhdl[
i];
2696 if(!need_other_ring)
2708 res->GetNC() =
NULL;
2716 res->bitmask=exp_limit;
2723 if (r->pFDegOrig != res->pFDegOrig &&
2728 res->firstwv = r->firstwv;
2729 res->firstBlockEnds = r->firstBlockEnds;
2733 res->pLDeg = r->pLDegOrig;
2738 if (res->typ !=
NULL)
2740 if( res->typ[0].ord_typ ==
ro_syz)
2742 res->typ[0] = r->typ[0];
2744 if (r->typ[0].data.syz.limit > 0)
2746 res->typ[0].data.syz.syz_index
2747 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(
int));
2748 memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2749 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2753 if( iNeedInducedOrderingSetup > 0 )
2755 for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2756 if( res->typ[i].ord_typ ==
ro_is )
2762 r->typ[i].data.is.limit,
2767 iNeedInducedOrderingSetup--;
2773 res->OrdSgn=r->OrdSgn;
2782 WarnS(
"error in nc_rComplete");
2795 WarnS(
"error in sca_Force!");
2809 res->GetNC() =
NULL;
2813 res->wvhdl = (
int **)
omAlloc0(3 *
sizeof(
int *));
2815 res->order = (
int *)
omAlloc(3 *
sizeof(
int *));
2816 res->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
2817 res->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
2821 res->block1[0] = r->N;
2822 res->wvhdl[0] = weights;
2837 WarnS(
"error in nc_rComplete");
2864 int nblocks=1+(ommit_comp!=0);
2865 int *order=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2866 int *block0=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2867 int *block1=(
int*)
omAlloc0((nblocks+1)*
sizeof(
int));
2868 int **wvhdl=(
int**)
omAlloc0((nblocks+1)*
sizeof(
int *));
2880 res->GetNC() =
NULL;
2887 res->bitmask=exp_limit;
2898 WarnS(
"error in nc_rComplete");
2914 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
2947 r->CanShortOut =
TRUE;
2952 for (i=0;i<
rPar(r);i++)
2956 r->CanShortOut=
FALSE;
2967 if (r->N < N) N = r->N;
2969 for (i=(N-1);i>=0;i--)
2971 if(r->names[i] !=
NULL && strlen(r->names[i])>1)
2973 r->CanShortOut=
FALSE;
2979 r->ShortOut = r->CanShortOut;
2981 assume( !( !r->CanShortOut && r->ShortOut ) );
3003 if (r->OrdSgn==-1) r->MixedOrder=
TRUE;
3013 if (r->wvhdl[o]!=
NULL)
3016 for(i=r->block1[o]-r->block0[o];i>=0;i--)
3017 if (r->wvhdl[o][i]<0) { r->MixedOrder=
TRUE;
break; }
3021 r->ComponentOrder=1;
3025 r->ComponentOrder=-1;
3033 if( r->block0[o] != 0 )
3034 r->ComponentOrder = r->block0[o];
3043 dReportError(
"wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
3052 if(block1[i]!=r->N) r->LexOrder=
TRUE;
3053 r->firstBlockEnds=block1[
i];
3054 r->firstwv = wvhdl[
i];
3063 for(j=block1[i]-r->block0[i];j>=0;j--)
3065 if (r->firstwv[j]<0) r->MixedOrder=
TRUE;
3066 if (r->firstwv[j]==0) r->LexOrder=
TRUE;
3073 for(j=block1[i]-r->block0[i];j>=0;j--)
3075 if (w[j]==0) r->LexOrder=
TRUE;
3082 if (r->pFDeg ==
p_Deg)
3103 r->pLDegOrig = r->pLDeg;
3109 int* order = r->order;
3110 int* block0 = r->block0;
3111 int* block1 = r->block1;
3112 int** wvhdl = r->wvhdl;
3121 r->LexOrder =
FALSE;
3122 r->MixedOrder =
FALSE;
3123 r->ComponentOrder = 1;
3130 r->MixedOrder =
FALSE;
3131 for(
int ii=block0[0];ii<=block1[0];ii++)
3132 if (wvhdl[0][ii-1]<0) { r->MixedOrder=
TRUE;
break;}
3134 for(
int ii=block0[0];ii<=block1[0];ii++)
3135 if (wvhdl[0][ii-1]==0) { r->LexOrder=
TRUE;
break;}
3136 if ((block0[0]==1)&&(block1[0]==r->N))
3147 r->firstwv = wvhdl[0];
3162 r->ComponentOrder=-1;
3163 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3179 r->firstBlockEnds=block1[0];
3180 r->firstwv = wvhdl[0];
3192 r->ComponentOrder=-1;
3202 r->firstBlockEnds=block1[1];
3203 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3222 int i = 0;
while (order[++i] != 0);
3257 r->pFDegOrig = r->pFDeg;
3273 for(i=0;i<r->OrdSize;i++)
3276 ||(r->typ[i].ord_typ==
ro_am))
3281 r->NegWeightL_Size=
l;
3282 r->NegWeightL_Offset=(
int *)
omAlloc(l*
sizeof(
int));
3284 for(i=0;i<r->OrdSize;i++)
3288 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3291 else if(r->typ[i].ord_typ==
ro_am)
3293 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3300 r->NegWeightL_Size = 0;
3301 r->NegWeightL_Offset =
NULL;
3313 if ( (r->cf->extRing!=
NULL)
3324 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3341 r->pLexOrder=r->LexOrder;
3349 static inline int sign(
int x) {
return (x > 0) - (x < 0);}
3356 for(i=2;i<=
rVar(r);i++)
3373 if (r->VarOffset!=
NULL && force == 0)
return FALSE;
3379 r->BitsPerExp = bits;
3382 if (r->OrdSgn!=-1) r->OrdSgn=1;
3385 long *tmp_ordsgn=(
long *)
omAlloc0(3*(n+r->N)*
sizeof(long));
3388 for(i=r->N; i>=0 ; i--)
3405 switch (r->order[i])
3409 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3415 rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3421 rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3422 tmp_typ[typ_i], (
int64 *)(r->wvhdl[i]));
3439 k=r->block1[
i]-r->block0[
i]+1;
3442 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3444 r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3451 rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3452 tmp_ordsgn,v,bits, -1);
3456 rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3457 tmp_ordsgn,v, bits, -1);
3462 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3463 tmp_ordsgn,v, bits, -1);
3468 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3469 tmp_ordsgn,v, bits, -1);
3473 if (r->block0[i]==r->block1[i])
3475 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3476 tmp_ordsgn,v, bits, -1);
3480 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3484 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3489 if (r->block0[i]==r->block1[i])
3491 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3492 tmp_ordsgn,v, bits, -1);
3496 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3499 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3500 tmp_ordsgn,v, bits, r->block1[i]);
3505 if (r->block0[i]==r->block1[i])
3508 tmp_ordsgn,v,bits, -1);
3516 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3522 if (r->block0[i]==r->block1[i])
3525 tmp_ordsgn,v, bits, -1);
3532 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3533 tmp_ordsgn,v, bits, r->block1[i]);
3539 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3540 tmp_typ[typ_i], r->wvhdl[i]);
3545 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3547 if (r->wvhdl[i][jj]<=0) have_bad_weights=
TRUE;
3549 if (have_bad_weights)
3551 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3557 if (r->block1[i]!=r->block0[i])
3559 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3560 tmp_ordsgn, v,bits, r->block0[i]);
3565 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3566 tmp_typ[typ_i], r->wvhdl[i]);
3571 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3573 if (r->wvhdl[i][jj]<=0) have_bad_weights=
TRUE;
3575 if (have_bad_weights)
3577 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3583 if (r->block1[i]!=r->block0[i])
3585 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3586 tmp_ordsgn,v, bits, r->block1[i]);
3592 tmp_typ[typ_i], r->wvhdl[i]);
3594 if (r->block1[i]!=r->block0[i])
3596 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3597 tmp_ordsgn, v,bits, r->block0[i]);
3604 tmp_typ[typ_i], r->wvhdl[i]);
3606 if (r->block1[i]!=r->block0[i])
3608 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3609 tmp_ordsgn,v, bits, r->block1[i]);
3617 rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3618 need_to_add_comp=
TRUE;
3623 assume(typ_i == 0 && j == 0);
3624 rO_Syz(j, j_bits, prev_ordsgn, tmp_ordsgn, tmp_typ[typ_i]);
3625 need_to_add_comp=
TRUE;
3632 assume( r->block0[i] == r->block1[i] );
3633 const int s = r->block0[
i];
3634 assume( -2 < s && s < 2);
3637 rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]);
3640 rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s);
3641 need_to_add_comp=
FALSE;
3659 j_bits=j_bits0; j=j0;
3664 if((need_to_add_comp) && (v[0]== -1))
3678 for(i=1 ; i<=r->N ; i++)
3684 rO_LexVars(j, j_bits, i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3705 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3707 for(j=0;j<r->CmpL_Size;j++)
3709 r->ordsgn[
j] = tmp_ordsgn[
j];
3718 if (typ_i==0) r->typ=
NULL;
3722 memcpy(r->typ,tmp_typ,typ_i*
sizeof(
sro_ord));
3732 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3735 if (i==r->pCompIndex) i++;
3736 while ((j < r->OrdSize)
3745 if (i==r->pCompIndex) i++;
3780 if (r->OrdSgn==-1)
return;
3782 for(
int i=1;
i<=r->N;
i++)
3786 for(
int j=0;(
j<=
b) && (found==0);
j++)
3789 if ((r->block0[
j]<=
i)&&(r->block1[
j]>=
i))
3808 if(r->wvhdl[
j][
i-r->block0[
j]]<0) { r->OrdSgn=-1;
return;}
3809 if(r->wvhdl[
j][
i-r->block0[
j]]>0) { found=1;
break;}
3820 if (r ==
NULL)
return;
3821 if (r->VarOffset !=
NULL)
3823 if (r->OrdSize!=0 && r->typ !=
NULL)
3825 for(
int i = 0;
i < r->OrdSize;
i++)
3826 if( r->typ[
i].ord_typ ==
ro_is)
3829 r->typ[
i].data.is.F =
NULL;
3831 if( r->typ[
i].data.is.pVarOffset !=
NULL )
3834 r->typ[
i].data.is.pVarOffset =
NULL;
3837 else if (r->typ[
i].ord_typ ==
ro_syz)
3839 if(r->typ[
i].data.syz.limit > 0)
3840 omFreeSize(r->typ[
i].data.syz.syz_index, ((r->typ[
i].data.syz.limit) +1)*
sizeof(
int));
3841 r->typ[
i].data.syz.syz_index =
NULL;
3845 assume( r->typ[
i].data.syzcomp.ShiftedComponents ==
NULL );
3846 assume( r->typ[
i].data.syzcomp.Components ==
NULL );
3856 if (r->PolyBin !=
NULL)
3861 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
3863 if (r->p_Procs !=
NULL)
3865 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
3867 if (r->NegWeightL_Offset!=
NULL)
3869 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
3870 r->NegWeightL_Offset=
NULL;
3878 int* VarL_Number = (
int*)
omAlloc0(r->ExpL_Size*
sizeof(
int));
3883 for (i=1; i<=r->N; i++)
3885 VarL_Number[r->VarOffset[
i] & 0xffffff]++;
3889 for (i=0, j=0; i<r->ExpL_Size; i++)
3891 if (VarL_Number[i] != 0)
3893 if (min > VarL_Number[i])
3895 min = VarL_Number[
i];
3904 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
3905 r->VarL_LowIndex = 0;
3908 for (i=0, j=0; i<r->ExpL_Size; i++)
3910 if (VarL_Number[i] != 0)
3912 r->VarL_Offset[
j] =
i;
3913 if (j > 0 && r->VarL_Offset[j-1] != r->VarL_Offset[j] - 1)
3914 r->VarL_LowIndex = -1;
3918 if (r->VarL_LowIndex >= 0)
3919 r->VarL_LowIndex = r->VarL_Offset[0];
3921 r->MinExpPerLong =
min;
3924 j = r->VarL_Offset[min_j];
3925 r->VarL_Offset[min_j] = r->VarL_Offset[0];
3926 r->VarL_Offset[0] =
j;
3933 int* shifts = (
int*)
omAlloc(r->ExpL_Size*
sizeof(
int));
3936 for (i=0;i<r->ExpL_Size;i++)
3940 for (i=1;i<=r->N;i++)
3942 if (shifts[r->VarOffset[i] & 0xffffff] > r->VarOffset[i] >> 24)
3943 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
3946 for (i=1;i<=r->N;i++)
3948 if (shifts[r->VarOffset[i] & 0xffffff] != 0)
3950 = (r->VarOffset[
i] & 0xffffff) |
3951 (((r->VarOffset[i] >> 24) - shifts[r->VarOffset[
i] & 0xffffff]) << 24);
3959 unsigned long divmask = 1;
3964 divmask |= (((
unsigned long) 1) << (
unsigned long) i);
3979 const char *TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
3980 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
3983 Print(
"ExpL_Size:%d ",r->ExpL_Size);
3984 Print(
"CmpL_Size:%d ",r->CmpL_Size);
3985 Print(
"VarL_Size:%d\n",r->VarL_Size);
3986 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
3987 Print(
"divmask=%lx\n", r->divmask);
3988 Print(
"BitsPerExp=%d ExpPerLong=%d MinExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->MinExpPerLong, r->VarL_Offset[0]);
3990 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
3991 PrintS(
"VarL_Offset:\n");
3994 for(j = 0; j < r->VarL_Size; j++)
3995 Print(
" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
4002 for(j=0;j<=r->N;j++)
4003 Print(
" v%d at e-pos %d, bit %d\n",
4004 j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4006 for(j=0;j<r->CmpL_Size;j++)
4007 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4008 Print(
"OrdSgn:%d\n",r->OrdSgn);
4010 for(j=0;j<r->OrdSize;j++)
4012 Print(
" typ %s", TYP[r->typ[j].ord_typ]);
4013 if (r->typ[j].ord_typ==
ro_syz)
4015 const short place = r->typ[
j].data.syz.place;
4016 const int limit = r->typ[
j].data.syz.limit;
4017 const int curr_index = r->typ[
j].data.syz.curr_index;
4018 const int* syz_index = r->typ[
j].data.syz.syz_index;
4020 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4022 if( syz_index ==
NULL )
4027 for( i=0; i <= limit; i++ )
4028 Print(
"%d ", syz_index[i]);
4035 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4038 else if (r->typ[j].ord_typ==
ro_is)
4040 Print(
" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4044 Print(
" limit %d",r->typ[j].data.is.limit);
4051 else if (r->typ[j].ord_typ==
ro_am)
4053 Print(
" place %d",r->typ[j].data.am.place);
4054 Print(
" start %d",r->typ[j].data.am.start);
4055 Print(
" end %d",r->typ[j].data.am.end);
4056 Print(
" len_gen %d",r->typ[j].data.am.len_gen);
4059 for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4060 Print(
" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4061 l=r->typ[
j].data.am.end+1;
4062 int ll=r->typ[
j].data.am.weights[l-r->typ[
j].data.am.start];
4064 for(
int lll=l+1;lll<l+ll+1;lll++)
4065 Print(
" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4069 Print(
" place %d",r->typ[j].data.dp.place);
4073 Print(
" start %d",r->typ[j].data.dp.start);
4074 Print(
" end %d",r->typ[j].data.dp.end);
4075 if ((r->typ[j].ord_typ==
ro_wp)
4079 for(
int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;
l++)
4080 Print(
" %d",r->typ[j].data.wp.weights[
l-r->typ[j].data.wp.start]);
4082 else if (r->typ[j].ord_typ==
ro_wp64)
4086 for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4087 Print(
" %ld",(
long)(((
int64*)r->typ[j].data.wp64.weights64)+l-r->typ[j].data.wp64.start));
4093 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4094 Print(
"OrdSize:%d\n",r->OrdSize);
4095 PrintS(
"--------------------\n");
4096 for(j=0;j<r->ExpL_Size;j++)
4099 if (j< r->CmpL_Size)
4100 Print(
"ordsgn %ld ", r->ordsgn[j]);
4106 if( (r->VarOffset[i] & 0xffffff) == j )
4107 {
Print(
"v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4108 r->VarOffset[i] >>24 ); }
4110 if( r->pCompIndex==j )
PrintS(
"v0; ");
4111 for(i=0;i<r->OrdSize;i++)
4113 if (r->typ[i].data.dp.place == j)
4115 Print(
"ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4116 r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4120 if (j==r->pOrdIndex)
4125 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4127 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4128 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4130 for(j = 0; j < r->NegWeightL_Size; j++)
4131 Print(
" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4142 Print(
"p_Spec : %s, %s, %s\n", field, length, ord);
4144 for (i=0; i<(
int) (
sizeof(
p_Procs_s)/
sizeof(
void*)); i++)
4146 Print(
" %s,\n", ((
char**) &proc_names)[i]);
4152 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4158 Print(
"(%p)", r->pFDeg);
4161 Print(
"pLDeg : (%p)", r->pLDeg);
4169 if (r->p_Setm==p_Setm_General)
PrintS(
"p_Setm_General\n");
4170 else if (r->p_Setm==p_Setm_Dummy)
PrintS(
"p_Setm_Dummy\n");
4171 else if (r->p_Setm==p_Setm_TotalDegree)
PrintS(
"p_Setm_Totaldegree\n");
4172 else if (r->p_Setm==p_Setm_WFirstTotalDegree)
PrintS(
"p_Setm_WFirstTotalDegree\n");
4173 else Print(
"%p\n",r->p_Setm);
4183 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4184 for(i=0;i<r->ExpL_Size;i++)
4185 Print(
"%ld ",p->exp[i]);
4192 if (j==0) {
PrintS(
"...\n");
break; }
4201 Print(
"\nexp[0..%d]\n", R->ExpL_Size - 1);
4202 for(
int i = 0;
i < R->ExpL_Size;
i++)
4203 Print(
"%09lx ", p->exp[
i]);
4223 if( (p !=
NULL) && (nTerms > 0) )
4234 for(
int j = nTerms - 1; (q !=
NULL) && (
j > 0);
pIter(q), --
j)
4257 for(
int j = (F->ncols*F->nrows) - 1;
j >= 0;
j-- )
4271 Print(
"gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]);
4274 p_SetComp(
p, MIN + (*V)[ c - MIN - 1 ], r );
4299 r->typ[1].data.syzcomp.Components = currComponents;
4306 *currShiftedComponents = r->typ[1].data.syzcomp.ShiftedComponents;
4307 *currComponents = r->typ[1].data.syzcomp.Components;
4317 r->typ[1].data.syzcomp.length = length;
4327 *length = r->typ[1].data.syzcomp.length;
4328 rNGetSComps( currComponents, currShiftedComponents, r);
4344 rDBGetSComps(currComponents, currShiftedComponents, length, r);
4346 rNGetSComps(currComponents, currShiftedComponents, r);
4364 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4372 res->order=(
int *)
omAlloc((i+1)*
sizeof(
int));
4375 int ** wvhdl =(
int **)
omAlloc0((i+1)*
sizeof(
int**));
4378 res->order[
j]=r->order[j-1];
4379 res->block0[
j]=r->block0[j-1];
4380 res->block1[
j]=r->block1[j-1];
4381 if (r->wvhdl[j-1] !=
NULL)
4383 wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[j-1]);
4400 WarnS(
"error in nc_rComplete");
4412 if (r->qideal!=
NULL)
4445 for(i=r->OrdSize-1;i>=0;i--)
4447 if ((r->typ[i].ord_typ==
ro_dp)
4448 && (r->typ[i].data.dp.start==start_var)
4449 && (r->typ[i].data.dp.end==end_var))
4451 pos=r->typ[
i].data.dp.place;
4467 res->ExpL_Size=r->ExpL_Size+1;
4470 res->ordsgn=(
long *)
omAlloc0(res->ExpL_Size*
sizeof(
long));
4471 for(j=0;j<r->CmpL_Size;j++)
4473 res->ordsgn[
j] = r->ordsgn[
j];
4475 res->OrdSize=r->OrdSize+1;
4480 memcpy(res->typ,r->typ,r->OrdSize*
sizeof(
sro_ord));
4483 res->typ[res->OrdSize-1].ord_typ=
ro_dp;
4484 res->typ[res->OrdSize-1].data.dp.start=start_var;
4485 res->typ[res->OrdSize-1].data.dp.end=end_var;
4486 res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4487 pos=res->ExpL_Size-1;
4504 WarnS(
"error in nc_rComplete");
4510 if (r->qideal!=
NULL)
4540 if (r->order[i] == 0)
4549 new_r->wvhdl=(
int **)
omAlloc0(i *
sizeof(
int *));
4550 new_r->order = (
int *)
omAlloc0(i *
sizeof(
int));
4551 new_r->block0 = (
int *)
omAlloc0(i *
sizeof(
int));
4552 new_r->block1 = (
int *)
omAlloc0(i *
sizeof(
int));
4553 memcpy(new_r->order,r->order,(i-1) *
sizeof(
int));
4554 memcpy(new_r->block0,r->block0,(i-1) *
sizeof(
int));
4555 memcpy(new_r->block1,r->block1,(i-1) *
sizeof(
int));
4556 for (
int j=0;
j<=last_block;
j++)
4558 if (r->wvhdl[
j]!=
NULL)
4560 new_r->wvhdl[
j] = (
int*)
omMemDup(r->wvhdl[
j]);
4577 WarnS(
"error in nc_rComplete");
4589 int last_block =
rBlocks(r) - 2;
4596 for (i=0; i< last_block; i++)
4607 for (i=c_pos+1; i<=last_block; i++)
4609 new_r->order[i-1] = new_r->order[
i];
4610 new_r->block0[i-1] = new_r->block0[
i];
4611 new_r->block1[i-1] = new_r->block1[
i];
4612 new_r->wvhdl[i-1] = new_r->wvhdl[
i];
4614 new_r->order[last_block] = r->order[c_pos];
4615 new_r->block0[last_block] = r->block0[c_pos];
4616 new_r->block1[last_block] = r->block1[c_pos];
4617 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4628 WarnS(
"error in nc_rComplete");
4653 if (new_r_1 != new_r && new_r_1 != old_r)
rDelete(new_r_1);
4661 # ifndef SING_NDEBUG
4662 WarnS(
"error in nc_rComplete");
4669 if (old_r->qideal !=
NULL)
4671 new_r->qideal =
idrCopyR(old_r->qideal, old_r, new_r);
4679 WarnS(
"error in nc_SetupQuotient");
4704 if ((r_blocks == 3) &&
4705 (r->order[0] == b1) &&
4706 (r->order[1] == b2) &&
4710 res->order = (
int*)
omAlloc0(3*
sizeof(
int));
4711 res->block0 = (
int*)
omAlloc0(3*
sizeof(
int));
4712 res->block1 = (
int*)
omAlloc0(3*
sizeof(
int));
4713 res->wvhdl = (
int**)
omAlloc0(3*
sizeof(
int*));
4719 res->block1[1] = r->N;
4724 res->block1[0] = r->N;
4733 WarnS(
"error in nc_rComplete");
4746 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete,
sgn);
4763 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
4771 res->block0[
j] = res->block1[
j] = 0;
4775 for(
int i = 0; (
i <=
n) && (r->order[
i] != 0);
i++, j++)
4777 res->order [
j] = r->order [
i];
4778 res->block0[
j] = r->block0[
i];
4779 res->block1[
j] = r->block1[
i];
4781 if (r->wvhdl[
i] !=
NULL)
4789 res->block0[
j] = res->block1[
j] =
sgn;
4800 assume(res->order[j]==0);
4813 WarnS(
"error in nc_rComplete");
4825 if (r->qideal!=
NULL)
4877 Print(
"rIsIS(p: %d)\nF:", p);
4888 for(
int pos = 0; pos < r->OrdSize; pos++ )
4889 if( r->typ[pos].ord_typ ==
ro_is)
4911 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4920 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4925 if( i != r->typ[pos].data.is.limit )
4926 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
4932 if( r->typ[pos].data.is.F !=
NULL)
4935 PrintS(
"Deleting old reference set F... \n");
4938 r->typ[pos].data.is.F =
NULL;
4943 r->typ[pos].data.is.F = FF;
4945 r->typ[pos].data.is.limit =
i;
4969 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
4971 if( k == r->typ[0].data.syz.limit )
4975 if (r->typ[0].data.syz.limit == 0)
4977 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((k+1)*
sizeof(
int));
4978 r->typ[0].data.syz.syz_index[0] = 0;
4979 r->typ[0].data.syz.curr_index = 1;
4983 r->typ[0].data.syz.syz_index = (
int*)
4985 (r->typ[0].data.syz.limit+1)*
sizeof(
int),
4988 for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
4990 r->typ[0].data.syz.syz_index[
i] =
4991 r->typ[0].data.syz.curr_index;
4993 if(k < r->typ[0].data.syz.limit)
4996 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
4998 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5002 r->typ[0].data.syz.limit =
k;
5003 r->typ[0].data.syz.curr_index++;
5012 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!", k);
5029 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5030 r->typ[0].data.syz.limit > 0 && i > 0)
5032 assume(i <= r->typ[0].data.syz.limit);
5034 for (j=0; j<r->typ[0].data.syz.limit; j++)
5036 if (r->typ[0].data.syz.syz_index[j] == i &&
5037 r->typ[0].data.syz.syz_index[j+1] != i)
5039 assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5043 return r->typ[0].data.syz.limit;
5055 for (i=0; i<nb; i++)
5057 if (r->wvhdl[i] !=
NULL)
5059 int length = r->block1[
i] - r->block0[
i];
5060 int* wvhdl = r->wvhdl[
i];
5064 for (j=0; j< length; j++)
5066 if (wvhdl[j] != 0 && wvhdl[j] != 1)
return FALSE;
5082 return (r->cf->type);
5106 while((r->typ[i].ord_typ!=
ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5108 return (
int64*)(r->typ[
i].data.wp64.weights64);
5116 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*
sizeof(
int64));
5123 r->order=(
int*)
omReallocSize(r->order, size*
sizeof(
int), (size+1)*
sizeof(
int));
5124 r->block0=(
int*)
omReallocSize(r->block0, size*
sizeof(
int), (size+1)*
sizeof(
int));
5125 r->block1=(
int*)
omReallocSize(r->block1, size*
sizeof(
int), (size+1)*
sizeof(
int));
5126 r->wvhdl=(
int **)
omReallocSize(r->wvhdl,size*
sizeof(
int *), (size+1)*
sizeof(
int *));
5127 for(
int k=size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5132 #if 0 // currently unused
5133 static int rReallocM1(ring
r,
int size,
int pos)
5135 r->order=(
int*)
omReallocSize(r->order, size*
sizeof(
int), (size-1)*
sizeof(
int));
5136 r->block0=(
int*)
omReallocSize(r->block0, size*
sizeof(
int), (size-1)*
sizeof(
int));
5137 r->block1=(
int*)
omReallocSize(r->block1, size*
sizeof(
int), (size-1)*
sizeof(
int));
5138 r->wvhdl=(
int **)
omReallocSize(r->wvhdl,size*
sizeof(
int *), (size-1)*
sizeof(
int *));
5139 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5147 for(
int j=0;
j<=i2;
j++)
5155 #define rOppVar(R,I) (rVar(R)+1-I)
5181 int i2 = (
rVar(r)-1)/2;
5182 for(i=i2; i>=0; i--)
5188 p = r->names[
rVar(r)-1-
i];
5189 r->names[
rVar(r)-1-
i] = r->names[
i];
5204 for (i=
rVar(r)-1; i>=0; i--)
5206 char *
p=r->names[
i];
5207 if(isupper(*p)) *p = tolower(*p);
5208 else *p = toupper(*p);
5255 for(i=0; src->order[
i]!=0; i++)
5257 switch (src->order[i])
5262 r->order[
j]=src->order[
i];
5266 r->block0[
j]=
rOppVar(r, src->block1[i]);
5267 r->block1[
j]=
rOppVar(r, src->block0[i]);
5271 r->block0[
j]=
rOppVar(r, src->block1[i]);
5272 r->block1[
j]=
rOppVar(r, src->block0[i]);
5278 r->block0[
j]=
rOppVar(r, src->block1[i]);
5279 r->block1[
j]=
rOppVar(r, src->block0[i]);
5280 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[j]-r->block0[j]+1)*
sizeof(
int));
5281 for(
int k=r->block0[j]; k<=r->block1[j];
k++)
5282 r->wvhdl[
j][
k-r->block0[
j]]=1;
5285 r->block0[
j]=
rOppVar(r, src->block1[i]);
5286 r->block1[
j]=
rOppVar(r, src->block0[i]);
5294 r->block0[
j]=
rOppVar(r, src->block1[i]);
5295 r->block1[
j]=
rOppVar(r, src->block0[i]);
5296 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[j]-r->block0[j]+1)*
sizeof(
int));
5297 for(
int k=r->block0[j]; k<=r->block1[j];
k++)
5298 r->wvhdl[
j][
k-r->block0[
j]]=1;
5301 r->block0[
j]=
rOppVar(r, src->block1[i]);
5302 r->block1[
j]=
rOppVar(r, src->block0[i]);
5310 r->block0[
j]=
rOppVar(r, src->block1[i]);
5311 r->block1[
j]=
rOppVar(r, src->block0[i]);
5312 r->wvhdl[
j]=r->wvhdl[j+1]; r->wvhdl[j+1]=
NULL;
5313 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5316 r->block0[
j]=
rOppVar(r, src->block1[i]);
5317 r->block1[
j]=
rOppVar(r, src->block0[i]);
5325 r->block0[
j]=
rOppVar(r, src->block1[i]);
5326 r->block1[
j]=
rOppVar(r, src->block0[i]);
5327 r->wvhdl[
j]=r->wvhdl[j+1]; r->wvhdl[j+1]=
NULL;
5328 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5331 r->block0[
j]=
rOppVar(r, src->block1[i]);
5332 r->block1[
j]=
rOppVar(r, src->block0[i]);
5339 r->block0[
j]=
rOppVar(r, src->block1[i]);
5340 r->block1[
j]=
rOppVar(r, src->block0[i]);
5341 int n=r->block1[
j]-r->block0[
j];
5343 for (
int nn=0; nn<=
n; nn++)
5352 r->block0[
j]=
rOppVar(r, src->block1[i]);
5353 r->block1[
j]=
rOppVar(r, src->block0[i]);
5354 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5409 int *par_perm =
NULL;
5412 for(i=1; i<=r->N; i++)
5420 for (i=1; i<
rVar(r); i++)
5422 for (j=i+1; j<=
rVar(r); j++)
5428 MATELEM(C,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5431 MATELEM(D,nj,ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r, nMap,par_perm,
rPar(src));
5439 WarnS(
"Error initializing non-commutative multiplication!");
5447 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5454 if (src->qideal !=
NULL)
5459 r->qideal =
idOppose(src, src->qideal, r);
5461 r->qideal =
id_Copy(src->qideal, r);
5491 int stat =
rSum(R, Ropp, Renv);
5493 WarnS(
"Error in rEnvelope at rSum");
5516 const int N = dest->N;
5525 const ring srcBase = src;
5532 matrix C0 = src->GetNC()->C;
5533 matrix D0 = src->GetNC()->D;
5536 for (
int i = 1;
i <
N;
i++)
5538 for (
int j =
i + 1;
j <=
N;
j++)
5583 while(r->order[i]!=0)
5590 for(j=r->block1[i]-r->block0[i];j>=0;j--)
5592 r->wvhdl[
i]=(
int*)w64;
5593 omFreeSize(w,(r->block1[i]-r->block0[i]+1)*
sizeof(
int));
5626 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
static void rHighSet(ring r, int o_r, int o)
for idElimination, like a, except pFDeg, pWeigths ignore it
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
n_coeffType rFieldType(ring r)
ideal SCAQuotient(const ring r)
void p_Setm_General(poly p, const ring r)
const CanonicalForm int s
void p_DebugPrint(poly p, const ring r)
#define omCheckAddrSize(addr, size)
static void rOptimizeLDeg(ring r)
long pLDeg1(poly p, int *l, const ring r)
only used if HAVE_RINGS is defined: ?
#define omcheckAddrSize(addr, size)
poly rGetVar(const int varIndex, const ring r)
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
non-simple ordering as specified by currRing
simple ordering, exponent vector has priority < component is compatible with exp-vector order ...
static void rSetNegWeight(ring r)
poly prCopyR(poly p, ring src_r, ring dest_r)
static BOOLEAN rField_is_Zp_a(const ring r)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
rOrderType_t rGetOrderType(ring r)
only used if HAVE_RINGS is defined: ?
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static int min(int a, int b)
BOOLEAN rRing_is_Homog(ring r)
static void rSetFirstWv(ring r, int i, int *order, int *block1, int **wvhdl)
static BOOLEAN rField_is_Ring_PtoM(const ring r)
int sgn(const Rational &a)
long pLDeg1c(poly p, int *l, const ring r)
static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
size_t omSizeOfAddr(const void *addr)
ideal id_Copy(ideal h1, const ring r)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
static int rPar(const ring r)
(r->cf->P)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
static BOOLEAN rField_is_Ring_ModN(const ring r)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
struct p_Procs_s p_Procs_s
static BOOLEAN rField_is_R(const ring r)
static int rRealloc1(ring r, int size, int pos)
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
BOOLEAN rIsPolyVar(int v, const ring r)
returns TRUE if var(i) belongs to p-block
#define omFreeSize(addr, size)
static BOOLEAN rShortOut(const ring r)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
#define omfreeSize(addr, size)
static void m_DebugPrint(const poly p, const ring R)
debug-print monomial poly/vector p, assuming that it lives in the ring R
long pLDeg0c(poly p, int *l, const ring r)
void nc_rKill(ring r)
complete destructor
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
static void rOppWeight(int *w, int l)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
#define omUnGetSpecBin(bin_ptr)
static BOOLEAN rField_is_Q_a(const ring r)
static void rO_Syz(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
static long p_Totaldegree(poly p, const ring r)
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos)
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
simple ordering, component has priority
void WerrorS(const char *s)
void p_Setm_TotalDegree(poly p, const ring r)
static BOOLEAN rField_is_GF(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
long * currShiftedComponents
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - ...
BOOLEAN rDBTest(ring r, const char *fn, const int l)
ring rAssure_HasComp(const ring r)
long pLDeg1_Deg(poly p, int *l, const ring r)
static bool rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rCanShortOut(const ring r)
int int kStrategy strat if(h==NULL) return NULL
BOOLEAN rHasSimpleOrder(const ring r)
BOOLEAN rHas_c_Ordering(const ring r)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
BOOLEAN rHasSimpleOrderAA(ring r)
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
static void rSetOption(ring r)
real floating point (GMP) numbers
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
simple ordering, exponent vector has priority < component not compatible with exp-vector order ...
long pLDeg1c_Deg(poly p, int *l, const ring r)
ring rAssure_SyzComp_CompLastBlock(const ring r, BOOLEAN)
makes sure that c/C ordering is last ordering and SyzIndex is first
int rSum(ring r1, ring r2, ring &sum)
int rTypeOfMatrixOrder(intvec *order)
static void rSetDegStuff(ring r)
#define omReallocSize(addr, o_size, size)
bool sca_Force(ring rGR, int b, int e)
static void rO_LexVars_neg(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
static void rO_Align(int &place, int &bitplace)
single prescision (6,6) real numbers
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
static int rBlocks(ring r)
int r_IsRingVar(const char *n, char **names, int N)
long p_Deg(poly a, const ring r)
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
const CanonicalForm CFMap CFMap & N
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
only used if HAVE_RINGS is defined: ?
BOOLEAN rCheckIV(intvec *iv)
The main handler for Singular numbers which are suitable for Singular polynomials.
long p_WFirstTotalDegree(poly p, const ring r)
void StringSetS(const char *st)
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
void StringAppendS(const char *st)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
long pLDeg0(poly p, int *l, const ring r)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
ring rAssure_dp_C(const ring r)
BEGIN_NAMESPACE_SINGULARXX const ring const ring const int nTerms
complex floating point (GMP) numbers
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
const char * rSimpleOrdStr(int ord)
gmp_float sqrt(const gmp_float &a)
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
void p_Setm_Dummy(poly p, const ring r)
static long p_FDeg(const poly p, const ring r)
int rOrderName(char *ordername)
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...
ring rDefault(const coeffs cf, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
only used if HAVE_RINGS is defined: ?
static int si_max(const int a, const int b)
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
Induced (Schreyer) ordering.
void PrintS(const char *s)
static BOOLEAN rField_is_Q(const ring r)
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
void rWrite(ring r, BOOLEAN details)
void rKillModified_Wp_Ring(ring r)
static void rSetOutParams(ring r)
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well
void mp_Delete(matrix *a, const ring r)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
static short scaFirstAltVar(ring r)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static BOOLEAN rField_is_long_C(const ring r)
void rSetSyzComp(int k, const ring r)
p_SetmProc p_GetSetmProc(ring r)
static BOOLEAN rField_is_Zp(const ring r)
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
void p_Write0(poly p, ring lmRing, ring tailRing)
static void p_Delete(poly *p, const ring r)
#define omGetSpecBin(size)
ideal idInit(int idsize, int rank)
void rSetWeightVec(ring r, int64 *wv)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
const Variable & v
< [in] a sqrfree bivariate poly
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
int64 * rGetWeightVec(ring r)
BOOLEAN rHasSimpleLexOrder(const ring r)
returns TRUE, if simple lp or ls ordering
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
long pLDegb(poly p, int *l, const ring r)
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static BOOLEAN rField_is_Ring_2toM(const ring r)
static BOOLEAN rField_is_Ring(const ring r)
ring rAssure_dp_S(const ring r)
static const char *const ringorder_name[]
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
void rDelete(ring r)
unconditionally deletes fields in r
ring rAssure_C_dp(const ring r)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete=TRUE, int sgn=1)
static BOOLEAN rField_is_Ring_Z(const ring r)
ring nc_rCreateNCcomm_rCopy(ring r)
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
static BOOLEAN rField_is_long_R(const ring r)
static short scaLastAltVar(ring r)
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p)
Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r...
void rModify_a_to_A(ring r)
static bool rIsSCA(const ring r)
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
void rKillModifiedRing(ring r)
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
static void p_Setm(poly p, const ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
static nc_type & ncRingType(nc_struct *p)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
int dReportError(const char *fmt,...)
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
#define TEST_RINGDEP_OPTS
long p_WTotaldegree(poly p, const ring r)
#define omCheckAddr(addr)
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
void p_Write(poly p, ring lmRing, ring tailRing)
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
static void rCheckOrdSgn(ring r, int i)
#define omFreeBin(addr, bin)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
BOOLEAN rRing_has_CompLastBlock(ring r)
void rKillModifiedRing_Simple(ring r)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
void nKillChar(coeffs r)
undo all initialisations
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
void Werror(const char *fmt,...)
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
#define UPMATELEM(i, j, nVar)
#define MATELEM(mat, i, j)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL