40#define BITS_PER_LONG 8*SIZEOF_LONG
111 r->names = (
char **)
omAlloc0(
N *
sizeof(
char *));
125 if (bitmask!=0) r->wanted_maxExp=bitmask;
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");
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;
249 PrintS(
"// coefficients: ");
304 Print(
"// number of vars : %d",r->N);
312 Print(
"\n// block %3d : ",
l+1);
319 assume( r->block0[
l] == r->block1[
l] );
320 const int s = r->block0[
l];
328 Print(
" syz_comp: %d",r->block0[
l]);
340 for (
i = r->block0[
l]-1;
i<r->block1[
l];
i++)
347 if (r->wvhdl[
l]!=
NULL)
359 Warn(
"should not have wvhdl entry at pos. %d",
l);
362 int bl=r->block1[
l]-r->block0[
l]+1;
364 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
367 PrintS(
"\n// : weights ");
368 for (
i = 0;
i<=r->block1[
l]-r->block0[
l];
i++)
386 int m=r->wvhdl[
l][
bl];
387 Print(
"\n// : %d module weights ",
m);
396 PrintS(
"\n// noncommutative relations:");
402 for (
i = 1;
i<r->N;
i++)
404 for (
j =
i+1;
j<=r->N;
j++)
409 Print(
"\n// %s%s=",r->names[
j-1],r->names[
i-1]);
420 Print(
"\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
425 PrintS(
"\n// quotient of sca by ideal");
438 Print(
"\n// letterplace ring (block size %d, ncgen count %d)",r->isLPring, r->LPncGenCount);
443 PrintS(
"\n// quotient ring from ideal");
456 if (r ==
NULL)
return;
461 if( r->qideal !=
NULL )
476 if (r->order !=
NULL)
487 if (r->wvhdl[
j]!=
NULL)
500 for (
i=0;
i<r->N;
i++)
548 if (r->wvhdl[
l]!=
NULL)
560 Warn(
"should not have wvhdl entry at pos. %d",
l);
568 j<(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1);
575 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
584 for (
i = 0;
i<r->block1[
l]-r->block0[
l];
i++)
594 if (
j+
i+1==(r->block1[
l]-r->block0[
l]+1)*(r->block1[
l]-r->block0[
l]+1))
605 assume( r->block0[
l] == r->block1[
l] );
606 const int s = r->block0[
l];
614 if (r->wanted_maxExp!=0)
616 long mm=r->wanted_maxExp;
633 for (
i=0;
i<r->N;
i++)
639 for (
i=0;
i<r->N-1;
i++)
731 for(
int i=1;
i<r->N;
i++)
732 for(
int j=
i+1;
j<=r->N;
j++)
736 WarnS(
"Error initializing multiplication!");
791 && (
mpz_cmp(
r1->cf->modNumber,
r2->cf->extRing->cf->modNumber)==0))
824 if (
r1->cf->extRing->cf==
r2->cf)
834 WerrorS (
"coeff sum of two extension fields not implemented");
840 WerrorS(
"coeff sum not yet implemented");
847 char **names=(
char **)
omAlloc0(
l*
sizeof(
char *));
852 for (
i=0;
i<
r1->N;
i++)
856 if (*(
r1->names[
i]) ==
'\0')
888 if (*(
r2->names[
i]) ==
'\0')
980 if ((
r2->block0[0]==1)
987 tmpR.order[1]=
r2->order[0];
993 int l=
r2->block1[0]-
r2->block0[0]+1;
998 l+=
r2->wvhdl[1][
r2->block1[0]-
r2->block0[0]+1]+1;
1069 WarnS(
"rSum: weights not implemented");
1075 for (
i=0;
r1->order[
i]!=0;
i++)
1085 int l=
r1->block1[
i]-
r1->block0[
i]+1;
1090 l+=
r1->wvhdl[
i][
r1->block1[
i]-
r1->block0[
i]+1]+1;
1105 for (
i=0;
r2->order[
i]!=0;
i++)
1119 int l=
r2->block1[
i]-
r2->block0[
i]+1;
1124 l+=
r2->wvhdl[
i][
r2->block1[
i]-
r2->block0[
i]+1]+1;
1134 if((
r1->OrdSgn==-1)||(
r2->OrdSgn==-1))
1160 int l=
r1->block1[
i]-
r1->block0[
i]+1;
1165 l+=
r1->wvhdl[
i][
r1->block1[
i]-
r1->block0[
i]+1]+1;
1266 MATELEM(C,
i,
j) =
p_PermPoly(
MATELEM(
C1,
i,
j),
perm1,
R1,
sum,
nMap1,
par_perm1,
rPar(
R1));
1269 MATELEM(
D,
i,
j) =
p_PermPoly(
MATELEM(
D1,
i,
j),
perm1,
R1,
sum,
nMap1,
par_perm1,
rPar(
R1));
1282 MATELEM(C,
rVar(
R1)+
i,
rVar(
R1)+
j) =
p_PermPoly(
MATELEM(
C2,
i,
j),
perm2,
R2,
sum,
nMap2,
par_perm2,
rPar(
R2));
1285 MATELEM(
D,
rVar(
R1)+
i,
rVar(
R1)+
j) =
p_PermPoly(
MATELEM(
D2,
i,
j),
perm2,
R2,
sum,
nMap2,
par_perm2,
rPar(
R2));
1293 WarnS(
"Error initializing non-commutative multiplication!");
1302 Print(
"\nRefs: R1: %d, R2: %d\n",
R1->GetNC()->ref,
R2->GetNC()->ref);
1431 res->options=r->options;
1446 res->firstBlockEnds=r->firstBlockEnds;
1448 res->real_var_start=r->real_var_start;
1449 res->real_var_end=r->real_var_end;
1453 res->isLPring=r->isLPring;
1454 res->LPncGenCount=r->LPncGenCount;
1457 res->VectorOut=r->VectorOut;
1458 res->ShortOut=r->ShortOut;
1459 res->CanShortOut=r->CanShortOut;
1475 res->bitmask=r->bitmask;
1476 res->divmask=r->divmask;
1477 res->BitsPerExp = r->BitsPerExp;
1478 res->ExpPerLong = r->ExpPerLong;
1499 res->LexOrder=r->LexOrder;
1500 res->MixedOrder=r->MixedOrder;
1508 if (r->wvhdl[
j]!=
NULL)
1514 int l=r->block1[
j]-r->block0[
j]+1;
1519 l+=r->wvhdl[
j][r->block1[
j]-r->block0[
j]+1]+1;
1530 memcpy(
res->block0,r->block0,
i *
sizeof(
int));
1531 memcpy(
res->block1,r->block1,
i *
sizeof(
int));
1546 if (r->qideal!=
NULL)
1575 res->options=r->options;
1590 res->firstBlockEnds=r->firstBlockEnds;
1592 res->real_var_start=r->real_var_start;
1593 res->real_var_end=r->real_var_end;
1597 res->isLPring=r->isLPring;
1598 res->LPncGenCount=r->LPncGenCount;
1601 res->VectorOut=r->VectorOut;
1602 res->ShortOut=r->ShortOut;
1603 res->CanShortOut=r->CanShortOut;
1604 res->LexOrder=r->LexOrder;
1605 res->MixedOrder=r->MixedOrder;
1621 res->bitmask=r->bitmask;
1622 res->divmask=r->divmask;
1623 res->BitsPerExp = r->BitsPerExp;
1624 res->ExpPerLong = r->ExpPerLong;
1650 for (
j=0;
j<
i-1;
j++)
1652 if (r->wvhdl[
j]!=
NULL)
1658 int l=r->block1[
j]-r->block0[
j]+1;
1663 l+=r->wvhdl[
j][r->block1[
j]-r->block0[
j]+1]+1;
1674 memcpy(&(
res->block0[1]),r->block0,(
i-1) *
sizeof(
int));
1675 memcpy(&(
res->block1[1]),r->block1,(
i-1) *
sizeof(
int));
1693 res->wvhdl[0]=(
int *)
A;
1703 if (r->qideal!=
NULL)
1709 WerrorS(
"internal error: rCopy0(Q,TRUE,FALSE)");
1714 WarnS(
"internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1755 if (
r1->bitmask!=
r2->bitmask)
return FALSE;
1756 #ifdef HAVE_SHIFTBBA
1757 if (
r1->isLPring!=
r2->isLPring)
return FALSE;
1758 if (
r1->LPncGenCount!=
r2->LPncGenCount)
return FALSE;
1810 if ((
r1->cf !=
r2->cf)
1812 || (
r1->OrdSgn !=
r2->OrdSgn))
1816 while (
r1->order[
i] != 0)
1818 if (
r2->order[
i] == 0)
return FALSE;
1819 if ((
r1->order[
i] !=
r2->order[
i])
1820 || (
r1->block0[
i] !=
r2->block0[
i])
1821 || (
r1->block1[
i] !=
r2->block1[
i]))
1827 for (
j=0;
j<
r1->block1[
i]-
r1->block0[
i]+1;
j++)
1828 if (
r2->wvhdl[
i][
j] !=
r1->wvhdl[
i][
j])
1834 if (
r2->order[
i] != 0)
return FALSE;
1928 if ((r->block0[
s]!=1)||(r->block1[
s]!=r->N))
2019 for (pos=0;pos<r->OrdSize;pos++)
2037 return ((
rVar(r) > 1) &&
2043 ((r->order[1]!=0) &&
2051 return ((
rVar(r) > 1) &&
2053 &&(r->block0[ord]==1)
2054 &&(r->block1[ord]==r->N));
2061 return ((
rVar(r) > 1) &&
2063 &&(r->block0[ord]==1)
2064 &&(r->block1[ord]==r->N));
2071 return ((
rVar(r) > 1) &&
2073 &&(r->block0[ord]==1)
2074 &&(r->block1[ord]==r->N));
2081 return ((
rVar(r) > 1) &&
2100 if (r->N == 0)
return TRUE;
2102 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2114 for(
int j=0;
j<=
i;
j++)
2117 dError(
"wrong order in r->order");
2128 if (r->VarOffset ==
NULL)
2130 dReportError(
"Null ring VarOffset -- no rComplete (?) in n %s:%d",
fn,
l);
2135 if ((r->OrdSize==0)!=(r->typ==
NULL))
2137 dReportError(
"mismatch OrdSize and typ-pointer in %s:%d");
2143 for(
i=0;
i<=r->N;
i++)
2147 for(
j=0;
j<r->OrdSize;
j++)
2151 const int p = r->typ[
j].data.isTemp.suffixpos;
2158 if(r->typ[
p].ord_typ !=
ro_is)
2159 dReportError(
"ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",
j,
p);
2162 if(r->typ[
j].data.isTemp.pVarOffset[
i] != -1)
2168 else if (r->typ[
j].ord_typ ==
ro_is)
2171 if(r->typ[
j].data.is.pVarOffset[
i] != -1)
2179 if (r->typ[
j].ord_typ==
ro_cp)
2181 if(((
short)r->VarOffset[
i]) == r->typ[
j].data.cp.place)
2186 && (r->VarOffset[
i] == r->typ[
j].data.dp.place))
2192 tmp=r->VarOffset[
i] & 0xffffff;
2193 #if SIZEOF_LONG == 8
2194 if ((r->VarOffset[
i] >> 24) >63)
2196 if ((r->VarOffset[
i] >> 24) >31)
2198 dReportError(
"bit_start out of range:%d",r->VarOffset[
i] >> 24);
2199 if (
i > 0 && ((
tmp<0) ||(
tmp>r->ExpL_Size-1)))
2206 for(
j=0;
j<r->OrdSize;
j++)
2208 if ((r->typ[
j].ord_typ==
ro_dp)
2209 || (r->typ[
j].ord_typ==
ro_wp)
2212 if (r->typ[
j].data.dp.start > r->typ[
j].data.dp.end)
2214 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end);
2215 if ((r->typ[
j].data.dp.start < 1)
2216 || (r->typ[
j].data.dp.end > r->N))
2217 dReportError(
"in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",
j,
2218 r->typ[
j].data.dp.start, r->typ[
j].data.dp.end,r->N);
2282 while((start<end) && (weights[0]==0)) { start++; weights++; }
2283 while((start<end) && (weights[end-start]==0)) { end--; }
2286 for(
i=start;
i<=end;
i++)
2288 if(weights[
i-start]!=1)
2308 for(
i=start;
i<=end;
i++)
2310 if(weights[
i-start]<0)
2332 ord_struct.data.am.weights_m = weights + (end-start+1);
2333 ord_struct.data.am.len_gen=weights[end-start+1];
2368 while((start<end) && (weights[0]==0)) { start++; weights++; }
2369 while((start<end) && (weights[end-start]==0)) { end--; }
2380 for(
i=start;
i<=end;
i++)
2382 if(weights[
i-start]<0)
2552 int *pVarOffset =
tmp_typ[
typ_j].data.isTemp.pVarOffset;
2570 for(
int i = 0;
i <=
N;
i++ )
2573 if(
v[
i] != pVarOffset[
i] )
2575 pVarOffset[
i] =
v[
i];
2577 assume( pVarOffset[
i] != -1 );
2583 if( pVarOffset[0] != -1 )
2584 pVarOffset[0] &= 0x0fff;
2625 bits=16; bitmask=0xffff;
2627 else if (bitmask <= 1L)
2629 bits=1; bitmask = 1L;
2631 else if (bitmask <= 3L)
2633 bits=2; bitmask = 3L;
2635 else if (bitmask <= 7L)
2639 else if (bitmask <= 0xfL)
2641 bits=4; bitmask=0xfL;
2643 else if (bitmask <= 0x1fL)
2645 bits=5; bitmask=0x1fL;
2647 else if (bitmask <= 0x3fL)
2649 bits=6; bitmask=0x3fL;
2652 else if (bitmask <= 0x7fL)
2654 bits=7; bitmask=0x7fL;
2657 else if (bitmask <= 0xffL)
2659 bits=8; bitmask=0xffL;
2662 else if (bitmask <= 0x1ffL)
2664 bits=9; bitmask=0x1ffL;
2667 else if (bitmask <= 0x3ffL)
2669 bits=10; bitmask=0x3ffL;
2672 else if (bitmask <= 0xfffL)
2674 bits=12; bitmask=0xfff;
2677 else if (bitmask <= 0xffffL)
2679 bits=16; bitmask=0xffffL;
2682 else if (bitmask <= 0xfffffL)
2684 bits=20; bitmask=0xfffffL;
2686 else if (bitmask <= 0xffffffffL)
2688 bits=32; bitmask=0xffffffffL;
2690 else if (bitmask <= 0x7fffffffffffffffL)
2692 bits=63; bitmask=0x7fffffffffffffffL;
2696 bits=63; bitmask=0x7fffffffffffffffL;
2699 else if (bitmask <= 0x7fffffff)
2701 bits=31; bitmask=0x7fffffff;
2705 bits=31; bitmask=0x7fffffffL;
2776 if (r->block0[
i]==r->block1[
i])
2801 Warn(
"Error: unhandled ordering in rModifyRing: ringorder_S = [%d]",
r_ord);
2880 block0[
j]=r->block0[
i];
2881 block1[
j]=r->block1[
i];
2882 wvhdl[
j]=r->wvhdl[
i];
2908 res->wanted_maxExp=r->wanted_maxExp;
2915 if (r->pFDegOrig !=
res->pFDegOrig &&
2920 res->firstwv = r->firstwv;
2921 res->firstBlockEnds = r->firstBlockEnds;
2925 res->pLDeg = r->pLDegOrig;
2934 res->typ[0] = r->typ[0];
2936 if (r->typ[0].data.syz.limit > 0)
2938 res->typ[0].data.syz.syz_index
2939 = (
int*)
omAlloc((r->typ[0].data.syz.limit +1)*
sizeof(
int));
2940 memcpy(
res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2941 (r->typ[0].data.syz.limit +1)*
sizeof(
int));
2954 r->typ[
i].data.is.limit,
2965 res->OrdSgn=r->OrdSgn;
2974 WarnS(
"error in nc_rComplete");
2987 WarnS(
"error in sca_Force!");
3013 res->block1[0] = r->N;
3014 res->wvhdl[0] = weights;
3029 WarnS(
"error in nc_rComplete");
3080 res->wanted_maxExp=r->wanted_maxExp;
3091 WarnS(
"error in nc_rComplete");
3136 r->CanShortOut=
FALSE;
3139 r->CanShortOut =
TRUE;
3147 r->CanShortOut=
FALSE;
3155 for (
i=(
N-1);
i>=0;
i--)
3159 r->CanShortOut=
FALSE;
3165 r->ShortOut = r->CanShortOut;
3167 assume( !( !r->CanShortOut && r->ShortOut ) );
3175 if(block1[
i]!=r->N) r->LexOrder=
TRUE;
3176 r->firstBlockEnds=block1[
i];
3177 r->firstwv = wvhdl[
i];
3186 for(
j=block1[
i]-block0[
i];
j>=0;
j--)
3188 if (r->firstwv[
j]==0) r->LexOrder=
TRUE;
3195 for(
j=block1[
i]-block0[
i];
j>=0;
j--)
3197 if (
w[
j]==0) r->LexOrder=
TRUE;
3204 if (r->pFDeg ==
p_Deg)
3225 r->pLDegOrig = r->pLDeg;
3239 if (r->order[
i]==0)
break;
3249 int* block0 = r->block0;
3250 int* block1 = r->block1;
3251 int** wvhdl = r->wvhdl;
3260 r->LexOrder =
FALSE;
3267 for(
int ii=block0[0];
ii<=block1[0];
ii++)
3268 if (wvhdl[0][
ii-1]<0) { r->MixedOrder=2;
break;}
3270 for(
int ii=block0[0];
ii<=block1[0];
ii++)
3271 if (wvhdl[0][
ii-1]==0) { r->LexOrder=
TRUE;
break;}
3272 if ((block0[0]==1)&&(block1[0]==r->N))
3283 r->firstwv = wvhdl[0];
3295 if (r->OrdSgn == -1) r->pLDeg =
pLDeg0c;
3314 for(
int ii=block0[0];
ii<=block1[0];
ii++)
3316 if (wvhdl[0][
ii-1]<0) { r->MixedOrder=2;
break;}
3318 if (r->MixedOrder==0)
3320 if ((block0[0]==1)&&(block1[0]==r->N))
3328 r->firstBlockEnds=block1[0];
3329 r->firstwv = wvhdl[0];
3348 r->firstBlockEnds=block1[1];
3349 if (wvhdl!=
NULL) r->firstwv = wvhdl[1];
3357 for(
int ii=block0[1];
ii<=block1[1];
ii++)
3358 if (wvhdl[1][
ii-1]<0) { r->MixedOrder=2;
break;}
3359 if (r->MixedOrder==
FALSE)
3392 if(r->MixedOrder==
FALSE)
3407 r->pFDegOrig = r->pFDeg;
3422 for(
i=0;
i<r->OrdSize;
i++)
3425 ||(r->typ[
i].ord_typ==
ro_am))
3430 r->NegWeightL_Size=
l;
3431 r->NegWeightL_Offset=(
int *)
omAlloc(
l*
sizeof(
int));
3433 for(
i=0;
i<r->OrdSize;
i++)
3437 r->NegWeightL_Offset[
l]=r->typ[
i].data.wp.place;
3440 else if(r->typ[
i].ord_typ==
ro_am)
3442 r->NegWeightL_Offset[
l]=r->typ[
i].data.am.place;
3449 r->NegWeightL_Size = 0;
3450 r->NegWeightL_Offset =
NULL;
3462 if ( (r->cf->extRing!=
NULL)
3472 if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=
NULL))
3487 r->pLexOrder=r->LexOrder;
3495static inline int sign(
int x) {
return (
x > 0) - (
x < 0);}
3526 r->BitsPerExp =
bits;
3534 for(
i=r->N;
i>=0 ;
i--)
3551 switch (r->order[
i])
3575 r->ComponentOrder=1;
3581 r->ComponentOrder=-1;
3587 k=r->block1[
i]-r->block0[
i]+1;
3592 r->wvhdl[
i]+(r->block1[
i]-r->block0[
i]+1)*
l);
3619 if (r->block0[
i]==r->block1[
i])
3635 if (r->block0[
i]==r->block1[
i])
3651 if (r->block0[
i]==r->block1[
i])
3667 if (r->block0[
i]==r->block1[
i])
3683 if (r->block0[
i]==r->block1[
i])
3705 for(
jj=r->block1[
i]-r->block0[
i];
jj>=0;
jj--)
3716 if (r->block1[
i]!=r->block0[
i])
3730 for(
jj=r->block1[
i]-r->block0[
i];
jj>=0;
jj--)
3741 if (r->block1[
i]!=r->block0[
i])
3752 if (r->block1[
i]!=r->block0[
i])
3763 if (r->block1[
i]!=r->block0[
i])
3775 r->ComponentOrder=-1;
3783 r->ComponentOrder=-1;
3790 assume( r->block0[
i] == r->block1[
i] );
3791 const int s = r->block0[
i];
3837 for(
i=1 ;
i<=r->N ;
i++)
3864 r->ordsgn=(
long *)
omAlloc0(r->ExpL_Size*
sizeof(
long));
3866 for(
j=0;
j<r->CmpL_Size;
j++)
3891 r->pCompIndex=(r->VarOffset[0] & 0xffff);
3894 if (
i==r->pCompIndex)
i++;
3903 if (
i==r->pCompIndex)
i++;
3941 for(
int i=1;
i<=r->N;
i++)
3948 if ((r->block0[
j]<=
i)&&(r->block1[
j]>=
i))
3968 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3974 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3985 if(r->wvhdl[
j][
i-r->block0[
j]]<0)
3991 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
3999 int add=r->block1[
j]-r->block0[
j]+1;
4004 if (r->wvhdl[
j][
i-r->block0[
j]]<0)
4010 else if(r->wvhdl[
j][
i-r->block0[
j]]>0)
4040 if (
nonneg>0) r->MixedOrder=1;
4051 if (r ==
NULL)
return;
4052 if (r->VarOffset !=
NULL)
4054 if (r->OrdSize!=0 && r->typ !=
NULL)
4056 for(
int i = 0;
i < r->OrdSize;
i++)
4057 if( r->typ[
i].ord_typ ==
ro_is)
4061 if( r->typ[
i].data.is.pVarOffset !=
NULL )
4066 else if (r->typ[
i].ord_typ ==
ro_syz)
4068 if(r->typ[
i].data.syz.limit > 0)
4069 omFreeSize(r->typ[
i].data.syz.syz_index, ((r->typ[
i].data.syz.limit) +1)*
sizeof(
int));
4073 assume( r->typ[
i].data.syzcomp.ShiftedComponents ==
NULL );
4074 assume( r->typ[
i].data.syzcomp.Components ==
NULL );
4084 if (r->PolyBin !=
NULL)
4090 if (r->ordsgn !=
NULL && r->CmpL_Size != 0)
4095 if (r->p_Procs !=
NULL)
4100 omfreeSize(r->VarL_Offset, r->VarL_Size*
sizeof(
int));
4101 r->VarL_Offset=
NULL;
4103 if (r->NegWeightL_Offset!=
NULL)
4105 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*
sizeof(
int));
4106 r->NegWeightL_Offset=
NULL;
4119 for (
i=1;
i<=r->N;
i++)
4125 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
4140 r->VarL_Offset = (
int*)
omAlloc(r->VarL_Size*
sizeof(
int));
4141 r->VarL_LowIndex = 0;
4144 for (
i=0,
j=0;
i<r->ExpL_Size;
i++)
4148 r->VarL_Offset[
j] =
i;
4149 if (
j > 0 && r->VarL_Offset[
j-1] != r->VarL_Offset[
j] - 1)
4150 r->VarL_LowIndex = -1;
4154 if (r->VarL_LowIndex >= 0)
4155 r->VarL_LowIndex = r->VarL_Offset[0];
4159 j = r->VarL_Offset[
min_j];
4160 r->VarL_Offset[
min_j] = r->VarL_Offset[0];
4161 r->VarL_Offset[0] =
j;
4171 for (
i=0;
i<r->ExpL_Size;
i++)
4175 for (
i=1;
i<=r->N;
i++)
4177 if (
shifts[r->VarOffset[
i] & 0xffffff] > r->VarOffset[
i] >> 24)
4178 shifts[r->VarOffset[
i] & 0xffffff] = r->VarOffset[
i] >> 24;
4181 for (
i=1;
i<=r->N;
i++)
4183 if (
shifts[r->VarOffset[
i] & 0xffffff] != 0)
4185 = (r->VarOffset[
i] & 0xffffff) |
4186 (((r->VarOffset[
i] >> 24) -
shifts[r->VarOffset[
i] & 0xffffff]) << 24);
4194 unsigned long divmask = 1;
4199 divmask |= (((
unsigned long) 1) << (
unsigned long)
i);
4214 const char *
TYP[]={
"ro_dp",
"ro_wp",
"ro_am",
"ro_wp64",
"ro_wp_neg",
"ro_cp",
4215 "ro_syzcomp",
"ro_syz",
"ro_isTemp",
"ro_is",
"ro_none"};
4218 Print(
"ExpL_Size:%d ",r->ExpL_Size);
4219 Print(
"CmpL_Size:%d ",r->CmpL_Size);
4220 Print(
"VarL_Size:%d\n",r->VarL_Size);
4221 Print(
"bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4222 Print(
"divmask=%lx\n", r->divmask);
4223 Print(
"BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4225 Print(
"VarL_LowIndex: %d\n", r->VarL_LowIndex);
4226 PrintS(
"VarL_Offset:\n");
4229 for(
j = 0;
j < r->VarL_Size;
j++)
4230 Print(
" VarL_Offset[%d]: %d ",
j, r->VarL_Offset[
j]);
4237 for(
j=0;
j<=r->N;
j++)
4238 Print(
" v%d at e-pos %d, bit %d\n",
4239 j,r->VarOffset[
j] & 0xffffff, r->VarOffset[
j] >>24);
4241 for(
j=0;
j<r->CmpL_Size;
j++)
4242 Print(
" ordsgn %ld at pos %d\n",r->ordsgn[
j],
j);
4243 Print(
"OrdSgn:%d\n",r->OrdSgn);
4245 for(
j=0;
j<r->OrdSize;
j++)
4247 Print(
" typ %s",
TYP[r->typ[
j].ord_typ]);
4248 if (r->typ[
j].ord_typ==
ro_syz)
4250 const short place = r->typ[
j].data.syz.place;
4251 const int limit = r->typ[
j].data.syz.limit;
4252 const int curr_index = r->typ[
j].data.syz.curr_index;
4253 const int* syz_index = r->typ[
j].data.syz.syz_index;
4255 Print(
" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4257 if( syz_index ==
NULL )
4262 for(
i=0;
i <= limit;
i++ )
4263 Print(
"%d ", syz_index[
i]);
4270 Print(
" start (level) %d, suffixpos: %d, VO: ",r->typ[
j].data.isTemp.start, r->typ[
j].data.isTemp.suffixpos);
4273 else if (r->typ[
j].ord_typ==
ro_is)
4275 Print(
" start %d, end: %d: ",r->typ[
j].data.is.start, r->typ[
j].data.is.end);
4279 Print(
" limit %d",r->typ[
j].data.is.limit);
4286 else if (r->typ[
j].ord_typ==
ro_am)
4288 Print(
" place %d",r->typ[
j].data.am.place);
4289 Print(
" start %d",r->typ[
j].data.am.start);
4290 Print(
" end %d",r->typ[
j].data.am.end);
4291 Print(
" len_gen %d",r->typ[
j].data.am.len_gen);
4294 for(
l=r->typ[
j].data.am.start;
l<=r->typ[
j].data.am.end;
l++)
4295 Print(
" %d",r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start]);
4296 l=r->typ[
j].data.am.end+1;
4297 int ll=r->typ[
j].data.am.weights[
l-r->typ[
j].data.am.start];
4300 Print(
" %d",r->typ[
j].data.am.weights[
lll-r->typ[
j].data.am.start]);
4304 Print(
" place %d",r->typ[
j].data.dp.place);
4308 Print(
" start %d",r->typ[
j].data.dp.start);
4309 Print(
" end %d",r->typ[
j].data.dp.end);
4310 if ((r->typ[
j].ord_typ==
ro_wp)
4314 for(
int l=r->typ[
j].data.wp.start;
l<=r->typ[
j].data.wp.end;
l++)
4315 Print(
" %d",r->typ[
j].data.wp.weights[
l-r->typ[
j].data.wp.start]);
4317 else if (r->typ[
j].ord_typ==
ro_wp64)
4321 for(
l=r->typ[
j].data.wp64.start;
l<=r->typ[
j].data.wp64.end;
l++)
4322 Print(
" %ld",(
long)(r->typ[
j].data.wp64.weights64+
l-r->typ[
j].data.wp64.start));
4328 Print(
"pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4329 Print(
"OrdSize:%d\n",r->OrdSize);
4330 PrintS(
"--------------------\n");
4331 for(
j=0;
j<r->ExpL_Size;
j++)
4335 Print(
"ordsgn %ld ", r->ordsgn[
j]);
4341 if( (r->VarOffset[
i] & 0xffffff) ==
j )
4342 {
Print(
"v%d at e[%d], bit %d; ",
i,r->VarOffset[
i] & 0xffffff,
4343 r->VarOffset[
i] >>24 ); }
4345 if( r->pCompIndex==
j )
PrintS(
"v0; ");
4346 for(
i=0;
i<r->OrdSize;
i++)
4348 if (r->typ[
i].data.dp.place ==
j)
4350 Print(
"ordrec:%s (start:%d, end:%d) ",
TYP[r->typ[
i].ord_typ],
4351 r->typ[
i].data.dp.start, r->typ[
i].data.dp.end);
4355 if (
j==r->pOrdIndex)
4360 Print(
"LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4362 Print(
"NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4363 if (r->NegWeightL_Offset==
NULL)
PrintS(
" NULL");
4365 for(
j = 0;
j < r->NegWeightL_Size;
j++)
4366 Print(
" [%d]: %d ",
j, r->NegWeightL_Offset[
j]);
4387#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4393 Print(
"(%p)", r->pFDeg);
4396 Print(
"pLDeg : (%p)", r->pLDeg);
4408 else Print(
"%p\n",r->p_Setm);
4418 Print(
"\nexp[0..%d]\n",r->ExpL_Size-1);
4419 for(
i=0;
i<r->ExpL_Size;
i++)
4427 if (
j==0) {
PrintS(
"...\n");
break; }
4436 Print(
"\nexp[0..%d]\n",
R->ExpL_Size - 1);
4437 for(
int i = 0;
i <
R->ExpL_Size;
i++)
4526 WarnS(
"rAssure_SyzComp: input ring has an IS-ordering!");
4537 int ** wvhdl =(
int **)
omAlloc0((
i+1)*
sizeof(
int**));
4540 res->order[
j]=r->order[
j-1];
4541 res->block0[
j]=r->block0[
j-1];
4542 res->block1[
j]=r->block1[
j-1];
4543 if (r->wvhdl[
j-1] !=
NULL)
4549 int l=r->block1[
j-1]-r->block0[
j-1]+1;
4554 l+=r->wvhdl[
j-1][r->block1[
j-1]-r->block0[
j-1]+1]+1;
4557 memcpy(wvhdl[
j],r->wvhdl[
j-1],
l*
sizeof(
int));
4575 WarnS(
"error in nc_rComplete");
4585 if (r->qideal!=
NULL)
4615 pos=r->VarL_LowIndex;
4620 for(
int i=r->OrdSize-1;
i>=0;
i--)
4622 if ((r->typ[
i].ord_typ==
ro_dp)
4623 && (r->typ[
i].data.dp.start==1)
4624 && (r->typ[
i].data.dp.end==r->N))
4626 pos=r->typ[
i].data.dp.place;
4645 res->ExpL_Size=r->ExpL_Size+1;
4649 for(
j=0;
j<r->CmpL_Size;
j++)
4651 res->ordsgn[
j] = r->ordsgn[
j];
4653 res->OrdSize=r->OrdSize+1;
4662 res->typ[
res->OrdSize-1].data.dp.start=1;
4663 res->typ[
res->OrdSize-1].data.dp.end=
res->N;
4664 res->typ[
res->OrdSize-1].data.dp.place=
res->ExpL_Size-1;
4665 pos=
res->ExpL_Size-1;
4681 WarnS(
"error in nc_rComplete");
4687 if (r->qideal!=
NULL)
4717 if (r->order[
i] == 0)
4735 if (r->wvhdl[
j]!=
NULL)
4741 int l=r->block1[
j]-r->block0[
j]+1;
4746 l+=r->wvhdl[
j][r->block1[
j]-r->block0[
j]+1]+1;
4768 WarnS(
"error in nc_rComplete");
4819 WarnS(
"error in nc_rComplete");
4853 WarnS(
"error in nc_rComplete");
4870 WarnS(
"error in nc_SetupQuotient");
4896 (r->order[0] ==
b1) &&
4897 (r->order[1] ==
b2) &&
4910 res->block1[1] = r->N;
4915 res->block1[0] = r->N;
4925 WarnS(
"error in nc_rComplete");
4944 for(
int i=0;
i<r->N;
i++)
4946 if ((*
w)[
i]!=r->wvhdl[0][
i]) { ok=
FALSE;
break;}
4958 res->block1[1] = r->N;
4959 res->wvhdl[0]=(
int*)
omAlloc(r->N*
sizeof(
int));
4960 for(
int i=0;
i<r->N;
i++)
4962 r->wvhdl[0][
i]=(*w)[
i];
4972 WarnS(
"error in nc_rComplete");
4985 Print(
"rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete,
sgn);
5002 int ** wvhdl =(
int **)
omAlloc0((n+2)*
sizeof(
int**));
5010 res->block0[
j] =
res->block1[
j] = 0;
5014 for(
int i = 0; (
i <= n) && (r->order[
i] != 0);
i++,
j++)
5016 res->order [
j] = r->order [
i];
5017 res->block0[
j] = r->block0[
i];
5018 res->block1[
j] = r->block1[
i];
5020 if (r->wvhdl[
i] !=
NULL)
5026 int l=(r->block1[
i]-r->block0[
i]+1);
5031 l+=r->wvhdl[
i][r->block1[
i]-r->block0[
i]+1]+1;
5034 memcpy(wvhdl[
j],r->wvhdl[
i],
l*
sizeof(
int));
5066 WarnS(
"error in nc_rComplete");
5078 if (r->qideal!=
NULL)
5140 Print(
"rIsIS(p: %d)\nF:",
p);
5151 for(
int pos = 0; pos < r->OrdSize; pos++ )
5152 if( r->typ[pos].ord_typ ==
ro_is)
5174 dReportError(
"Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
5183 dReportError(
"Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
5188 if(
i != r->typ[pos].data.is.limit )
5189 Print(
"Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit,
i);
5195 if( r->typ[pos].data.is.F !=
NULL)
5198 PrintS(
"Deleting old reference set F... \n");
5201 r->typ[pos].data.is.F =
NULL;
5206 r->typ[pos].data.is.F =
FF;
5208 r->typ[pos].data.is.limit =
i;
5232 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz))
5234 r->block0[0]=r->block1[0] =
k;
5235 if(
k == r->typ[0].data.syz.limit )
5239 if (r->typ[0].data.syz.limit == 0)
5241 r->typ[0].data.syz.syz_index = (
int*)
omAlloc0((
k+1)*
sizeof(
int));
5242 r->typ[0].data.syz.syz_index[0] = 0;
5243 r->typ[0].data.syz.curr_index = 1;
5247 r->typ[0].data.syz.syz_index = (
int*)
5249 (r->typ[0].data.syz.limit+1)*
sizeof(
int),
5252 for (
i=r->typ[0].data.syz.limit + 1;
i<=
k;
i++)
5254 r->typ[0].data.syz.syz_index[
i] =
5255 r->typ[0].data.syz.curr_index;
5257 if(
k < r->typ[0].data.syz.limit)
5260 Warn(
"rSetSyzComp called with smaller limit (%d) as before (%d)",
k, r->typ[0].data.syz.limit);
5262 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[
k];
5266 r->typ[0].data.syz.limit =
k;
5267 r->typ[0].data.syz.curr_index++;
5276 Warn(
"rSetSyzComp(%d) in an IS ring! Be careful!",
k);
5281 r->block0[0] = r->block1[0] =
k;
5296 if ((r->typ!=
NULL) && (r->typ[0].ord_typ==
ro_syz) &&
5297 r->typ[0].data.syz.limit > 0 &&
i > 0)
5301 for (
j=0;
j<r->typ[0].data.syz.limit;
j++)
5303 if (r->typ[0].data.syz.syz_index[
j] ==
i &&
5304 r->typ[0].data.syz.syz_index[
j+1] !=
i)
5306 assume(r->typ[0].data.syz.syz_index[
j+1] ==
i+1);
5310 return r->typ[0].data.syz.limit;
5315 WarnS(
"rGetMaxSyzComp: order c");
5330 if ((r->order[0]==
ringorder_dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5333 && ((r->order[1]==
ringorder_dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5340 if ((r->order[0]==
ringorder_Dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5343 && ((r->order[1]==
ringorder_Dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5350 if ((r->order[0]==
ringorder_lp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5353 && ((r->order[1]==
ringorder_lp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5363 while((r->typ[
i].ord_typ!=
ro_wp64) && (r->typ[
i].ord_typ>0))
i++;
5365 return r->typ[
i].data.wp64.weights64;
5373 memcpy(r->typ[0].data.wp64.weights64,
wv,r->N*
sizeof(
int64));
5384 for(
int k=
size;
k>pos;
k--) r->wvhdl[
k]=r->wvhdl[
k-1];
5396 for(
int k=pos+1;
k<
size;
k++) r->wvhdl[
k]=r->wvhdl[
k+1];
5406 for(
int j=0;
j<=
i2;
j++)
5414#define rOppVar(R,I) (rVar(R)+1-I)
5432 if (src->qideal !=
NULL)
5440 for(
i=
i2;
i>=0;
i--)
5446 p = r->names[
rVar(r)-1-
i];
5447 r->names[
rVar(r)-1-
i] = r->names[
i];
5465 char *
p=r->names[
i];
5518 for(
i=0; src->order[
i]!=0;
i++)
5520 switch (src->order[
i])
5525 r->order[
j]=src->order[
i];
5529 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5530 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5534 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5535 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5541 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5542 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5543 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(
int));
5544 for(
int k=r->block0[
j];
k<=r->block1[
j];
k++)
5545 r->wvhdl[
j][
k-r->block0[
j]]=1;
5548 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5549 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5557 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5558 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5559 r->wvhdl[
j]=(
int*)
omAlloc((r->block1[
j]-r->block0[
j]+1)*
sizeof(
int));
5560 for(
int k=r->block0[
j];
k<=r->block1[
j];
k++)
5561 r->wvhdl[
j][
k-r->block0[
j]]=1;
5564 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5565 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5573 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5574 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5575 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5579 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5580 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5588 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5589 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5590 r->wvhdl[
j]=r->wvhdl[
j+1]; r->wvhdl[
j+1]=
NULL;
5594 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5595 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5602 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5603 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5604 int n=r->block1[
j]-r->block0[
j];
5606 for (
int nn=0;
nn<=n;
nn++)
5615 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5616 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5661 for(
i=0; src->order[
i]!=0;
i++)
5663 switch (src->order[
i])
5668 r->order[
j]=src->order[
i];
5672 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5673 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5677 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5678 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5683 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5684 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5690 r->block0[
j]=
rOppVar(r, src->block1[
i]);
5691 r->block1[
j]=
rOppVar(r, src->block0[
i]);
5740 for(
i=1;
i<=r->N;
i++)
5756 MATELEM(C,
nj,
ni) =
p_PermPoly(
MATELEM(src->GetNC()->C,
i,
j),perm,src,r,
nMap,
par_perm,
rPar(src));
5759 MATELEM(
D,
nj,
ni) =
p_PermPoly(
MATELEM(src->GetNC()->D,
i,
j),perm,src,r,
nMap,
par_perm,
rPar(src));
5767 WarnS(
"Error initializing non-commutative multiplication!");
5775 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5782 if (src->qideal !=
NULL)
5785 r->qideal =
idOppose(src, src->qideal, r);
5787 r->qideal =
id_Copy(src->qideal, r);
5819 WarnS(
"Error in rEnvelope at rSum");
5842 const int N = dest->N;
5862 for (
int i = 1;
i <
N;
i++)
5864 for (
int j =
i + 1;
j <=
N;
j++)
5867 const poly
p =
p_NSet(n, dest);
5929 Werror(
"n_IsParam: IsParam is not to be used for (coeff_type = %d)",
getCoeffType(C));
5938 WerrorS(
"only for rings with an ordering of one block");
5955 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5958 for(
int i=r->N-1;
i>=0;
i--)
5962 Werror(
"duplicate variable name >>%s<<",
v);
5968 #ifdef HAVE_SHIFTBBA
5971 R->isLPring=r->isLPring+1;
5972 R->N=((r->N)/r->isLPring)+r->N;
5976 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5979 for(
int i=
R->isLPring-1;
i>0;
i--)
5980 names[
i+
b*
R->isLPring]=
R->names[
i-1+
b*r->isLPring];
5985 for(
int b=0;
b<((r->N)/r->isLPring);
b++)
5988 for(
int i=
R->isLPring-2;
i>=0;
i--)
5989 names[
i+
b*
R->isLPring]=
R->names[
i+
b*r->isLPring];
6001 for(
int i=
R->N-1;
i>0;
i--) names[
i]=
R->names[
i-1];
6006 for(
int i=
R->N-2;
i>=0;
i--) names[
i]=
R->names[
i];
6020 WerrorS(
"only for rings with an ordering of one block");
6037 WerrorS(
"ordering must be dp,Dp,lp,rp,ds,Ds or ls");
6048 for(
int j=
i;
j<
R->N;
j++)
R->names[
j]=
R->names[
j+1];
int sgn(const Rational &a)
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
static int si_max(const int a, const int b)
const CanonicalForm CFMap CFMap & N
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
@ n_R
single prescision (6,6) real numbers
@ n_polyExt
used to represent polys as coefficients
@ n_Q
rational (GMP) numbers
@ n_Znm
only used if HAVE_RINGS is defined
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_Zn
only used if HAVE_RINGS is defined
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
void nKillChar(coeffs r)
undo all initialisations
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
static int min(int a, int b)
void WerrorS(const char *s)
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static BOOLEAN length(leftv result, leftv arg)
static bool rIsSCA(const ring r)
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
static nc_type & ncRingType(nc_struct *p)
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,...
void nc_rKill(ring r)
complete destructor
#define UPMATELEM(i, j, nVar)
bool sca_Force(ring rGR, int b, int e)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
void mp_Delete(matrix *a, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
#define MATELEM(mat, i, j)
1-based access to matrix
STATIC_VAR unsigned add[]
int dReportError(const char *fmt,...)
gmp_float sqrt(const gmp_float &a)
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omFreeSize(addr, size)
#define omCheckAddr(addr)
#define omReallocSize(addr, o_size, size)
#define omCheckAddrSize(addr, size)
#define omFreeBin(addr, bin)
#define omcheckAddrSize(addr, size)
#define omfreeSize(addr, size)
#define omGetSpecBin(size)
#define omUnGetSpecBin(bin_ptr)
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
long pLDegb(poly p, int *l, const ring r)
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
long p_WFirstTotalDegree(poly p, const ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
void p_Setm_Dummy(poly p, const ring r)
void p_Setm_TotalDegree(poly p, const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
long pLDeg1c_Deg(poly p, int *l, const ring r)
long pLDeg1(poly p, int *l, const ring r)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
long pLDeg1_Deg(poly p, int *l, const ring r)
long p_WTotaldegree(poly p, const ring r)
p_SetmProc p_GetSetmProc(const ring r)
void p_Setm_General(poly p, const ring r)
long pLDeg1c(poly p, int *l, const ring r)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
long pLDeg0c(poly p, int *l, const ring r)
long pLDeg0(poly p, int *l, const ring r)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
long p_Deg(poly a, const ring r)
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static long p_FDeg(const poly p, const ring r)
void p_Write(poly p, ring lmRing, ring tailRing)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static void p_Setm(poly p, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
static void p_Delete(poly *p, const ring r)
void p_Write0(poly p, ring lmRing, ring tailRing)
static long p_Totaldegree(poly p, const ring r)
poly prCopyR(poly p, ring src_r, ring dest_r)
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
void StringSetS(const char *st)
void StringAppendS(const char *st)
void PrintS(const char *s)
void Werror(const char *fmt,...)
static void rSetNegWeight(ring r)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
int rSum(ring r1, ring r2, ring &sum)
ring rAssure_TDeg(ring r, int &pos)
void rWrite(ring r, BOOLEAN details)
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
BOOLEAN rRing_ord_pure_Dp(const ring r)
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
BOOLEAN rHasSimpleOrderAA(ring r)
void rSetWeightVec(ring r, int64 *wv)
BOOLEAN rHasBlockOrder(const ring r)
static void rSetOption(ring r)
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
int r_IsRingVar(const char *n, char **names, int N)
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong!...
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
BOOLEAN rHasSimpleLexOrder(const ring r)
returns TRUE, if simple lp or ls ordering
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
void p_DebugPrint(poly p, const ring r)
void rKillModifiedRing(ring r)
BOOLEAN rRing_ord_pure_dp(const ring r)
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
const char * rSimpleOrdStr(int ord)
ring rAssure_Wp_C(const ring r, intvec *w)
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
ring rAssure_c_dp(const ring r)
static void rSetOutParams(ring r)
static void rSetDegStuff(ring r)
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
rOrderType_t rGetOrderType(ring r)
int rTypeOfMatrixOrder(const intvec *order)
ring nc_rCreateNCcomm_rCopy(ring r)
static void rOppWeight(int *w, int l)
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
void rKillModified_Wp_Ring(ring r)
ring rMinusVar(const ring r, char *v)
undo rPlusVar
BOOLEAN rRing_has_CompLastBlock(const ring r)
ring rAssure_Dp_C(const ring r)
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
ring rAssure_C_dp(const ring r)
BOOLEAN rHasSimpleOrder(const ring r)
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p)
Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r,...
ring rAssure_HasComp(const ring r)
BOOLEAN rOrd_is_Ds(const ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
BOOLEAN rHas_c_Ordering(const ring r)
static int rRealloc1(ring r, int size, int pos)
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
void rDebugPrint(const ring r)
static void rCheckOrdSgn(ring r, int i)
BOOLEAN rRing_ord_pure_lp(const ring r)
poly rGetVar(const int varIndex, const ring r)
BOOLEAN rOrd_is_dp(const ring r)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
static void m_DebugPrint(const poly p, const ring R)
debug-print monomial poly/vector p, assuming that it lives in the ring R
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
static void rOptimizeLDeg(ring r)
BOOLEAN rCheckIV(const intvec *iv)
rRingOrder_t rOrderName(char *ordername)
void rDelete(ring r)
unconditionally deletes fields in r
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord &ord_struct)
static void rO_Align(int &place, int &bitplace)
ring rAssure_dp_S(const ring r)
BOOLEAN rOrd_is_ds(const ring r)
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
static void rSetFirstWv(ring r, int i, rRingOrder_t *order, int *block0, int *block1, int **wvhdl)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering,...
void rSetSyzComp(int k, const ring r)
static const char *const ringorder_name[]
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
int64 * rGetWeightVec(const ring r)
static void rO_LexVars_neg(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
ring rAssure_dp_C(const ring r)
BOOLEAN rDBTest(ring r, const char *fn, const int l)
struct p_Procs_s p_Procs_s
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static int rBlocks(const ring r)
static ring rIncRefCnt(ring r)
static int rPar(const ring r)
(r->cf->P)
static BOOLEAN rIsLPRing(const ring r)
@ ringorder_a64
for int64 weights
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_is
opposite of ls
@ ringorder_IS
Induced (Schreyer) ordering.
static BOOLEAN rField_is_Q(const ring r)
static BOOLEAN rShortOut(const ring r)
@ rOrderType_CompExp
simple ordering, component has priority
@ rOrderType_Exp
simple ordering, exponent vector has priority component is compatible with exp-vector order
@ rOrderType_General
non-simple ordering as specified by currRing
@ rOrderType_ExpComp
simple ordering, exponent vector has priority component not compatible with exp-vector order
static BOOLEAN rIsNCRing(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
static BOOLEAN rCanShortOut(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
#define rField_is_Ring(R)
ideal SCAQuotient(const ring r)
static short scaLastAltVar(ring r)
static short scaFirstAltVar(ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
EXTERN_VAR long * currShiftedComponents
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,