12 #include <factory/factory.h> 112 case LE:
return "<=";
113 case GE:
return ">=";
122 if (s[1]==
'\0')
return s[0];
123 else if (s[2]!=
'\0')
return 0;
126 case '.':
if (s[1]==
'.')
return DOTDOT;
132 case '+':
if (s[1]==
'+')
return PLUSPLUS;
136 case '<':
if (s[1]==
'=')
return LE;
137 else if (s[1]==
'>')
return NOTEQUAL;
139 case '>':
if (s[1]==
'=')
return GE;
141 case '!':
if (s[1]==
'=')
return NOTEQUAL;
153 if(fullname) sprintf(buf2,
"%s::%s",
"",
IDID(h));
154 else sprintf(buf2,
"%s",
IDID(h));
192 && (strlen(
IDPROC(h)->libname)>0))
205 if ((s=strchr(buffer,
'\n'))!=
NULL)
211 if((s!=
NULL) ||(l>20))
213 Print(
"..., %d char(s)",l);
229 { number2 n=(number2)
IDDATA(h);
235 Print(
" %d x %d (%s)",
368 && (((ring)d)->idroot!=
NULL))
419 package savePack=currPack;
426 if (strcmp(what,
"all")==0)
438 if (iterate)
list1(prefix,h,
TRUE,fullname);
461 Werror(
"%s is undefined",what);
495 package save_p=currPack;
529 Warn(
"Gerhard, use the option command");
591 WerrorS(
"write: need at least two arguments");
599 if ((l!=
NULL)&&(l->name!=
NULL)) s=l->name;
601 Werror(
"cannot write to %s",s);
628 Werror(
"can not map from ground field of %s to current ground field",
632 if (
IDELEMS(theMap)<src_ring->N)
636 (src_ring->N)*
sizeof(
poly));
637 for(i=
IDELEMS(theMap);i<src_ring->N;i++)
643 WerrorS(
"argument of a map must have a name");
650 memset(&tmpW,0,
sizeof(
sleftv));
655 save_r=
IDMAP(w)->preimage;
656 IDMAP(w)->preimage=0;
665 ideal
id=(ideal)tmpW.
data;
667 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
673 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
675 if (theMap->m[
j]!=
NULL)
679 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
682 if ((p!=
NULL) && (degs[i]!=0) &&
683 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)degs[i])/2)))
695 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
697 if (theMap->m[
j]!=
NULL)
703 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)deg)/2)))
712 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
728 char *tmp = theMap->preimage;
729 theMap->preimage=(
char*)1L;
732 theMap->preimage=tmp;
740 if (save_r!=
NULL)
IDMAP(w)->preimage=save_r;
747 IDMAP(w)->preimage=save_r;
755 Werror(
"%s undefined in %s",what,theMap->preimage);
760 Werror(
"cannot find preimage %s",theMap->preimage);
772 char *
s=(
char *)
omAlloc(strlen(name)+5);
776 sprintf(s,
"%s(%d)",name,i+1);
786 Print(
"//defining: %s as %d-th syzygy module\n",s,i+1);
791 Warn(
"cannot define %s",s);
871 int add_row_shift = 0;
874 if (weights!=
NULL) add_row_shift=weights->
min_in();
889 memset(&tmp,0,
sizeof(tmp));
909 memset(&tmp2,0,
sizeof(tmp2));
934 add_row_shift = ww->
min_in();
935 (*weights) -= add_row_shift;
942 res->
data=(
void*)res_im;
945 for(
int i=1;
i<=res_im->
rows();
i++)
947 if (
IMATELEM(*res_im,1,
i)==0) { add_row_shift--; }
952 if (weights!=
NULL)
delete weights;
970 add_row_shift = ww->
min_in();
971 (*weights) -= add_row_shift;
976 if (weights!=
NULL)
delete weights;
979 return reg+1+add_row_shift;
983 #define BREAK_LINE_LENGTH 80 1010 else if(strncmp(s,
"cont;",5)==0)
1017 strcat( s,
"\n;~\n");
1088 res->
m[
i].
data = (
void *)save->set;
1098 for (i=hMu;i<hMu+
hMu2;i++)
1100 res->
m[
i].
data = (
void *)save->set;
1125 const char *
id = name->
name;
1127 memset(sy,0,
sizeof(
sleftv));
1130 WerrorS(
"object to declare is not a name");
1169 if (iiCurrProc!=
NULL)
1174 memset(&tmp,0,
sizeof(
sleftv));
1184 WerrorS(
"branchTo can only occur in a proc");
1192 if (ll!=(l-1))
return FALSE;
1195 short *t=(
short*)
omAlloc(l*
sizeof(
short));
1199 for(i=1;i<
l;i++,h=h->
next)
1204 Werror(
"arg %d is not a string",i);
1208 b=
IsCmd((
char *)h->Data(),tt);
1213 Werror(
"arg %d is not a type name",i);
1220 Werror(
"last arg (%d) is not a proc(%d), nest=%d",i,h->Typ(),
myynest);
1225 if (b && (h->rtyp==
IDHDL) && (h->e==
NULL))
1231 if(
pi->data.s.body==
NULL )
1248 pi,
pi->data.s.body_lineno-(iiCurrArgs==
NULL) );
1257 if (iiCurrArgs!=
NULL)
1259 if (err==0)
Warn(
"too many arguments for %s",
IDID(iiCurrProc));
1281 if (iiCurrArgs==
NULL)
1283 if (strcmp(p->
name,
"#")==0)
1292 if (strcmp(p->
name,
"#")==0)
1294 is_default_list=
TRUE;
1302 if (is_default_list)
1360 if (keepring)
IDRING(h)->ref--;
1372 Warn(
"'%s': no such identifier\n", v->
name);
1375 package frompack=v->req_packhdl;
1390 if (h==frompack->idroot)
1392 frompack->idroot=h->
next;
1396 idhdl hh=frompack->idroot;
1397 while ((hh!=
NULL) && (hh->
next!=h))
1407 h->
next=rootpack->idroot;
1543 WarnS(
"package not found\n");
1577 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1578 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1597 if (h!=
NULL)
return h;
1599 if (h!=
NULL)
return h;
1606 if (h!=
NULL)
return h;
1614 if (h!=
NULL)
return h;
1633 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1639 for(i=0; i<r->N; i++)
1645 L->
m[1].
data=(
void *)LL;
1662 if (r->block1[i]-r->block0[i] >=0 )
1664 j=r->block1[
i]-r->block0[
i];
1667 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1669 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][
j];
1671 else switch (r->order[i])
1678 for(;j>=0; j--) (*iv)[
j]=1;
1688 LLL->
m[1].
data=(
void *)iv;
1689 LL->
m[
i].
data=(
void *)LLL;
1692 L->
m[2].
data=(
void *)LL;
1702 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1703 L->
m[3].
data=(
void *)q;
1722 L->
m[0].
data=(
void *)0;
1732 L->
m[1].
data=(
void *)LL;
1756 L->
m[0].
data=(
void *)0;
1766 L->
m[1].
data=(
void *)LL;
1800 LL->
m[1].
data=(
void *) C->modExponent;
1802 L->
m[1].
data=(
void *)LL;
1827 LL->
m[0].
data=
nlMapGMP((number) R->cf->modBase, R->cf, R->cf);
1829 LL->
m[1].
data=(
void *) R->cf->modExponent;
1831 L->
m[1].
data=(
void *)LL;
1845 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1858 else if ( C->extRing!=
NULL )
1868 Lc->
m[0].
data=(
void*)(
long)C->m_nfCharQ;
1875 Lc->
m[1].
data=(
void*)Lv;
1886 Loo->
m[1].
data=(
void *)iv;
1889 Lo->
m[0].
data=(
void*)Loo;
1892 Lc->
m[2].
data=(
void*)Lo;
1898 res->
data=(
void*)Lc;
1903 res->
data=(
void *)(
long)C->ch;
1924 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1942 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
1948 for(i=0; i<r->N; i++)
1951 LL->m[
i].data=(
void *)
omStrDup(r->names[i]);
1954 L->
m[1].
data=(
void *)LL;
1974 assume( r->block0[i] == r->block1[i] );
1975 const int s = r->block0[
i];
1976 assume( -2 < s && s < 2);
1981 else if (r->block1[i]-r->block0[i] >=0 )
1983 int bl=j=r->block1[
i]-r->block0[
i];
1991 j+=r->wvhdl[
i][bl+1];
1994 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1996 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
1998 else switch (r->order[i])
2005 for(;j>=0; j--) (*iv)[
j]=1;
2015 LLL->
m[1].
data=(
void *)iv;
2016 LL->m[
i].data=(
void *)LLL;
2019 L->
m[2].
data=(
void *)LL;
2023 if (r->qideal==
NULL)
2028 #ifdef HAVE_PLURAL // NC! in rDecompose 2049 || (r->qideal !=
NULL)
2056 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2081 else if ( r->cf->extRing!=
NULL )
2091 Lc->
m[0].
data=(
void*)(
long)r->cf->m_nfCharQ;
2098 Lc->
m[1].
data=(
void*)Lv;
2109 Loo->
m[1].
data=(
void *)iv;
2112 Lo->
m[0].
data=(
void*)Loo;
2115 Lc->
m[2].
data=(
void*)Lo;
2121 L->
m[0].
data=(
void*)Lc;
2126 L->
m[0].
data=(
void *)(
long)r->cf->ch;
2133 for(i=0; i<r->N; i++)
2139 L->
m[1].
data=(
void *)LL;
2159 assume( r->block0[i] == r->block1[i] );
2160 const int s = r->block0[
i];
2161 assume( -2 < s && s < 2);
2166 else if (r->block1[i]-r->block0[i] >=0 )
2168 int bl=j=r->block1[
i]-r->block0[
i];
2176 j+=r->wvhdl[
i][bl+1];
2179 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
2181 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
2183 else switch (r->order[i])
2190 for(;j>=0; j--) (*iv)[
j]=1;
2200 LLL->
m[1].
data=(
void *)iv;
2201 LL->
m[
i].
data=(
void *)LLL;
2204 L->
m[2].
data=(
void *)LL;
2208 if (r->qideal==
NULL)
2213 #ifdef HAVE_PLURAL // NC! in rDecompose 2232 WerrorS(
"invalid coeff. field description, expecting 0");
2240 WerrorS(
"invalid coeff. field description, expecting precision list");
2250 WerrorS(
"invalid coeff. field description list");
2253 int r1=(int)(
long)LL->
m[0].
data;
2254 int r2=(int)(
long)LL->
m[1].
data;
2276 R->cf->float_len=
si_min(r1,32767);
2277 R->cf->float_len2=
si_min(r2,32767);
2286 WerrorS(
"invalid coeff. field description, expecting parameter name");
2302 mpz_ptr modBase =
NULL;
2303 unsigned int modExponent = 1;
2305 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
2308 mpz_init_set_ui(modBase,0);
2319 number tmp= (number) LL->
m[0].
data;
2325 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2329 mpz_init_set_ui(modBase,0);
2333 modExponent = (
unsigned long) LL->
m[1].
data;
2341 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
2343 WerrorS(
"Wrong ground ring specification (module is 1)");
2346 if (modExponent < 1)
2348 WerrorS(
"Wrong ground ring specification (exponent smaller than 1)");
2352 if (mpz_cmp_ui(modBase, 0) == 0)
2357 else if (modExponent > 1)
2360 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2372 info.
exp= modExponent;
2383 info.
exp= modExponent;
2396 for(i=0;i<R->N-1;i++)
2398 for(j=i+1;j<R->N;j++)
2400 if (strcmp(R->names[i],R->names[j])==0)
2403 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",i+1,j+1,R->names[i],R->names[i]);
2405 R->names[
j]=(
char *)
omAlloc(2+strlen(R->names[i]));
2406 sprintf(R->names[j],
"@%s",R->names[i]);
2412 for(i=0;i<
rPar(R); i++)
2418 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",i+1,j+1,R->names[j],i+1);
2424 sprintf(R->names[j],
"@@(%d)",i+1);
2456 Werror(
"var name %d must be a string or a ring variable",i+1);
2462 Werror(
"var name %d must be `string`",i+1);
2469 WerrorS(
"variable must be given as `list`");
2485 for (
int j=0;
j < n-1;
j++)
2492 &&(strcmp((
char*)vv->
m[0].
Data(),
"L")==0))
2494 number nn=(number)vv->
m[1].
Data();
2501 Werror(
"illegal argument for pseudo ordering L: %d",vv->
m[1].
Typ());
2508 if (bitmask!=0) n--;
2512 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2513 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2516 for (j_in_R= n-2; j_in_R>=0; j_in_R--)
2519 for(j_in_R=0,j_in_L=0;j_in_R<n-1;j_in_R++,j_in_L++)
2524 WerrorS(
"ordering must be list of lists");
2531 if (strcmp((
char*)vv->
m[0].
Data(),
"L")==0)
2539 WerrorS(
"ordering name must be a (string,intvec)(1)");
2544 if (j_in_R==0) R->block0[0]=1;
2561 if (jj<0) R->block0[j_in_R]=1;
2562 else R->block0[j_in_R]=R->block1[jj]+1;
2570 R->block1[j_in_R]=
si_max(R->block0[j_in_R],R->block0[j_in_R]+iv_len-1);
2571 if (R->block1[j_in_R]>R->N)
2573 R->block1[j_in_R]=R->N;
2574 iv_len=R->block1[j_in_R]-R->block0[j_in_R]+1;
2578 switch (R->order[j_in_R])
2587 R->wvhdl[j_in_R] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2588 for (i=0; i<iv_len;i++)
2590 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2594 R->wvhdl[j_in_R] =(
int *)
omAlloc((iv->
length()+1)*
sizeof(
int));
2595 for (i=0; i<iv_len;i++)
2597 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2599 R->wvhdl[j_in_R][
i]=iv->
length() - iv_len;
2601 for (; i<iv->
length(); i++)
2603 R->wvhdl[j_in_R][i+1]=(*iv)[
i];
2607 R->wvhdl[j_in_R] =(
int *)
omAlloc((iv->
length())*
sizeof(
int));
2608 for (i=0; i<iv->
length();i++) R->wvhdl[j_in_R][i]=(*iv)[
i];
2609 R->block1[j_in_R]=
si_max(R->block0[j_in_R],R->block0[j_in_R]+(
int)
sqrt((
double)(iv->
length()-1)));
2610 if (R->block1[j_in_R]>R->N)
2612 WerrorS(
"ordering matrix too big");
2630 R->block1[j_in_R]=R->block0[j_in_R]=0;
2638 R->block1[j_in_R] = R->block0[j_in_R] = 0;
2641 const int s = (*iv)[0];
2642 assume( -2 < s && s < 2 );
2643 R->block1[j_in_R] = R->block0[j_in_R] =
s;
2656 WerrorS(
"ordering name must be a (string,intvec)");
2665 if (R->block1[j_in_R] != R->N)
2676 R->block0[j_in_R] <= R->N)
2678 R->block1[j_in_R] = R->N;
2682 Werror(
"ordering incomplete: size (%d) should be %d",R->block1[j_in_R],R->N);
2686 if (R->block0[j_in_R]>R->N)
2688 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",R->N,j_in_R+1);
2689 for(
int ii=0;ii<=j_in_R;ii++)
2690 Werror(
"ord[%d]: %s from v%d to v%d",ii+1,
rSimpleOrdStr(R->order[ii]),R->block0[ii],R->block1[ii]);
2705 R->block0=(
int*)
omRealloc0Size(R->block0,n*
sizeof(
int),(n+1)*
sizeof(
int));
2706 R->block1=(
int*)
omRealloc0Size(R->block1,n*
sizeof(
int),(n+1)*
sizeof(
int));
2718 WerrorS(
"ordering must be given as `list`");
2721 if (bitmask!=0) R->bitmask=bitmask*2;
2754 int ch = (int)(
long)L->
m[0].
Data();
2764 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch, l);
2787 int ch = (int)(
long)LL->
m[0].
Data();
2788 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2789 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2810 WerrorS(
"could not create the specified coefficient field");
2814 if( extRing->qideal !=
NULL )
2818 extParam.
r = extRing;
2825 extParam.
r = extRing;
2835 WerrorS(
"coefficient field must be described by `int` or `list`");
2841 WerrorS(
"could not create coefficient field described by the input!");
2859 ideal q=(ideal)L->
m[3].
Data();
2865 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2872 int par_perm_size=0;
2891 par_perm_size=
rPar(orig_ring);
2901 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2905 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(int));
2906 if (par_perm_size!=0)
2907 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2911 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2920 else if (par_perm_size!=0)
2925 for(i=
IDELEMS(q)-1; i>=0; i--)
2928 par_perm,par_perm_size);
2930 pTest(dest_id->m[i]);
2946 WerrorS(
"q-ideal must be given as `ideal`");
2974 while (i>=0) {
omfree(R->names[i]); i--; }
2995 ideal
id=(ideal)a->
Data();
2998 for (i=1; i<=
IDELEMS(
id); i++)
3005 res->
data=(
char *)result;
3015 int n=(int)(
long)b->
Data();
3016 int d=(int)(
long)c->
Data();
3023 if ((d>n) || (d<1) || (n<1))
3028 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
3032 temp=(ideal)id->
Data();
3045 if (choise[l-1]<=
IDELEMS(temp))
3047 p =
pCopy(temp->m[choise[l-1]-1]);
3048 if (sign == -1) p =
pNeg(p);
3059 res->
data=(
char *)result;
3074 int add_row_shift=0;
3080 add_row_shift = ww->
min_in();
3081 (*weights) -= add_row_shift;
3094 memset(&tmp,0,
sizeof(tmp));
3108 const int length = syzstr->
length;
3110 if ((fullres==
NULL) && (minres==
NULL))
3136 for (
int i=(length)-1;
i>=0;
i--)
3148 for (
int i=length-1;
i>=0;
i--)
3223 ideal F=(ideal)id->
Data();
3229 res->
data=(
char *)iv;
3233 double wNsqr = (double)2.0 / (
double)n;
3235 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(int));
3237 for (i = n; i!=0; i--)
3238 (*iv)[i-1] = x[i + n + 1];
3256 res->
data=(
void *)b;
3274 #ifdef HAVE_SPECTRUM 3282 spec.
mu = (int)(
long)(l->
m[0].
Data( ));
3283 spec.
pg = (int)(
long)(l->
m[1].
Data( ));
3284 spec.
n = (int)(
long)(l->
m[2].
Data( ));
3292 for(
int i=0;
i<spec.
n;
i++ )
3295 spec.
w[
i] = (*mul)[
i];
3326 for(
int i=0;
i<spec.
n;
i++ )
3330 (*mult)[
i] = spec.
w[
i];
3340 L->
m[0].
data = (
void*)(
long)spec.
mu;
3341 L->
m[1].
data = (
void*)(
long)spec.
pg;
3342 L->
m[2].
data = (
void*)(
long)spec.
n;
3343 L->
m[3].
data = (
void*)num;
3344 L->
m[4].
data = (
void*)den;
3345 L->
m[5].
data = (
void*)mult;
3393 WerrorS(
"the list is too short" );
3396 WerrorS(
"the list is too long" );
3400 WerrorS(
"first element of the list should be int" );
3403 WerrorS(
"second element of the list should be int" );
3406 WerrorS(
"third element of the list should be int" );
3409 WerrorS(
"fourth element of the list should be intvec" );
3412 WerrorS(
"fifth element of the list should be intvec" );
3415 WerrorS(
"sixth element of the list should be intvec" );
3419 WerrorS(
"first element of the list should be positive" );
3422 WerrorS(
"wrong number of numerators" );
3425 WerrorS(
"wrong number of denominators" );
3428 WerrorS(
"wrong number of multiplicities" );
3432 WerrorS(
"the Milnor number should be positive" );
3435 WerrorS(
"the geometrical genus should be nonnegative" );
3438 WerrorS(
"all numerators should be positive" );
3441 WerrorS(
"all denominators should be positive" );
3444 WerrorS(
"all multiplicities should be positive" );
3448 WerrorS(
"it is not symmetric" );
3451 WerrorS(
"it is not monotonous" );
3455 WerrorS(
"the Milnor number is wrong" );
3458 WerrorS(
"the geometrical genus is wrong" );
3462 WerrorS(
"unspecific error" );
3498 ( fast==2 ? 2 : 1 ) );
3508 ( fast==0 || (*node)->weight<=smax ) )
3530 cmp =
pCmp( (*node)->mon,f );
3553 (*node)->nf = search->
nf;
3557 while( cmp<0 && f!=(
poly)NULL );
3559 search = search->
next;
3570 if( (*node)->weight<=(
Rational)1 ) pg++;
3571 if( (*node)->weight==smax ) z++;
3572 if( (*node)->weight>weight_prev ) n++;
3574 weight_prev = (*node)->weight;
3575 node = &((*node)->next);
3597 cmp =
pCmp( (*node)->mon,f );
3612 search = search->
next;
3626 n = ( z > 0 ? 2*n - 1 : 2*n );
3641 ( fast==0 || search->
weight<=smax );
3642 search=search->
next )
3667 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3670 (*den) [n2] = (*den)[n1];
3671 (*mult)[n2] = (*mult)[n1];
3679 if( fast==0 || fast==1 )
3683 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3685 if( (*mult)[n1]!=(*mult)[n2] ||
3686 (*den) [n1]!= (*den)[n2] ||
3693 if( symmetric==
FALSE )
3703 (*L)->m[0].data = (
void*)(
long)
mu;
3720 (*L)->m[0].data = (
void*)(
long)
mu;
3721 (*L)->m[1].data = (
void*)(
long)pg;
3722 (*L)->m[2].data = (
void*)(
long)n;
3723 (*L)->m[3].data = (
void*)nom;
3724 (*L)->m[4].data = (
void*)den;
3725 (*L)->m[5].data = (
void*)mult;
3734 #ifdef SPECTRUM_DEBUG 3735 #ifdef SPECTRUM_PRINT 3736 #ifdef SPECTRUM_IOSTREAM 3737 cout <<
"spectrumCompute\n";
3738 if( fast==0 ) cout <<
" no optimization" << endl;
3739 if( fast==1 ) cout <<
" weight optimization" << endl;
3740 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3742 fprintf( stdout,
"spectrumCompute\n" );
3743 if( fast==0 ) fprintf( stdout,
" no optimization\n" );
3744 if( fast==1 ) fprintf( stdout,
" weight optimization\n" );
3745 if( fast==2 ) fprintf( stdout,
" symmetry optimization\n" );
3789 #ifdef SPECTRUM_DEBUG 3790 #ifdef SPECTRUM_PRINT 3791 #ifdef SPECTRUM_IOSTREAM 3792 cout <<
"\n computing the Jacobi ideal...\n";
3794 fprintf( stdout,
"\n computing the Jacobi ideal...\n" );
3803 #ifdef SPECTRUM_DEBUG 3804 #ifdef SPECTRUM_PRINT 3805 #ifdef SPECTRUM_IOSTREAM 3808 fprintf( stdout,
" " );
3819 #ifdef SPECTRUM_DEBUG 3820 #ifdef SPECTRUM_PRINT 3821 #ifdef SPECTRUM_IOSTREAM 3823 cout <<
" computing a standard basis..." << endl;
3825 fprintf( stdout,
"\n" );
3826 fprintf( stdout,
" computing a standard basis...\n" );
3834 #ifdef SPECTRUM_DEBUG 3835 #ifdef SPECTRUM_PRINT 3836 for( i=0; i<
IDELEMS(stdJ); i++ )
3838 #ifdef SPECTRUM_IOSTREAM 3841 fprintf( stdout,
" " );
3886 #ifdef SPECTRUM_DEBUG 3887 #ifdef SPECTRUM_PRINT 3888 #ifdef SPECTRUM_IOSTREAM 3889 cout <<
"\n computing the highest corner...\n";
3891 fprintf( stdout,
"\n computing the highest corner...\n" );
3900 if( hc!=(
poly)NULL )
3915 #ifdef SPECTRUM_DEBUG 3916 #ifdef SPECTRUM_PRINT 3917 #ifdef SPECTRUM_IOSTREAM 3920 fprintf( stdout,
" " );
3930 #ifdef SPECTRUM_DEBUG 3931 #ifdef SPECTRUM_PRINT 3932 #ifdef SPECTRUM_IOSTREAM 3933 cout <<
"\n computing the newton polygon...\n";
3935 fprintf( stdout,
"\n computing the newton polygon...\n" );
3942 #ifdef SPECTRUM_DEBUG 3943 #ifdef SPECTRUM_PRINT 3952 #ifdef SPECTRUM_DEBUG 3953 #ifdef SPECTRUM_PRINT 3954 #ifdef SPECTRUM_IOSTREAM 3955 cout <<
"\n computing the weight corner...\n";
3957 fprintf( stdout,
"\n computing the weight corner...\n" );
3967 #ifdef SPECTRUM_DEBUG 3968 #ifdef SPECTRUM_PRINT 3969 #ifdef SPECTRUM_IOSTREAM 3972 fprintf( stdout,
" " );
3982 #ifdef SPECTRUM_DEBUG 3983 #ifdef SPECTRUM_PRINT 3984 #ifdef SPECTRUM_IOSTREAM 3985 cout <<
"\n computing NF...\n" << endl;
3987 fprintf( stdout,
"\n computing NF...\n" );
3996 #ifdef SPECTRUM_DEBUG 3997 #ifdef SPECTRUM_PRINT 3999 #ifdef SPECTRUM_IOSTREAM 4002 fprintf( stdout,
"\n" );
4027 WerrorS(
"polynomial is zero" );
4030 WerrorS(
"polynomial has constant term" );
4033 WerrorS(
"not a singularity" );
4036 WerrorS(
"the singularity is not isolated" );
4039 WerrorS(
"highest corner cannot be computed" );
4042 WerrorS(
"principal part is degenerate" );
4048 WerrorS(
"unknown error occurred" );
4065 WerrorS(
"only works for local orderings" );
4073 WerrorS(
"does not work in quotient rings" );
4086 result->
data = (
char*)L;
4119 WerrorS(
"only works for local orderings" );
4124 WerrorS(
"does not work in quotient rings" );
4137 result->
data = (
char*)L;
4183 else if( l->
nr > 5 )
4221 int mu = (int)(
long)(l->
m[0].
Data( ));
4222 int pg = (int)(
long)(l->
m[1].
Data( ));
4223 int n = (int)(
long)(l->
m[2].
Data( ));
4234 if( n != num->
length( ) )
4238 else if( n != den->
length( ) )
4242 else if( n != mul->
length( ) )
4262 for( i=0; i<n; i++ )
4264 if( (*num)[
i] <= 0 )
4268 if( (*den)[
i] <= 0 )
4272 if( (*mul)[
i] <= 0 )
4284 for( i=0, j=n-1; i<=
j; i++,j-- )
4287 (*den)[
i] != (*den)[
j] ||
4288 (*mul)[
i] != (*mul)[
j] )
4298 for( i=0, j=1; i<n/2; i++,j++ )
4300 if( (*num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
4310 for( mu=0, i=0; i<n; i++ )
4315 if( mu != (
int)(long)(l->
m[0].
Data( )) )
4324 for( pg=0, i=0; i<n; i++ )
4326 if( (*num)[
i]<=(*den)[
i] )
4332 if( pg != (
int)(long)(l->
m[1].
Data( )) )
4361 WerrorS(
"first argument is not a spectrum:" );
4366 WerrorS(
"second argument is not a spectrum:" );
4399 int k = (int)(
long)second->
Data( );
4403 WerrorS(
"first argument is not a spectrum" );
4408 WerrorS(
"second argument should be positive" );
4445 WerrorS(
"first argument is not a spectrum" );
4450 WerrorS(
"second argument is not a spectrum" );
4474 memset(&tmp,0,
sizeof(tmp));
4493 WerrorS(
"Ground field not implemented!");
4513 LP->
m= (int)(
long)(v->
Data());
4519 LP->
n= (int)(
long)(v->
Data());
4525 LP->
m1= (int)(
long)(v->
Data());
4531 LP->
m2= (int)(
long)(v->
Data());
4537 LP->
m3= (int)(
long)(v->
Data());
4539 #ifdef mprDEBUG_PROT 4540 Print(
"m (constraints) %d\n",LP->
m);
4541 Print(
"n (columns) %d\n",LP->
n);
4565 lres->
m[4].
data=(
void*)(
long)LP->
m;
4568 lres->
m[5].
data=(
void*)(
long)LP->
n;
4570 res->
data= (
void*)lres;
4577 ideal gls = (ideal)(arg1->
Data());
4578 int imtype= (int)(
long)arg2->
Data();
4603 int howclean= (int)(
long)arg3->
Data();
4610 WerrorS(
"Ground field not implemented!");
4617 unsigned long int ii = (
unsigned long int)arg2->
Data();
4623 WerrorS(
"Input polynomial is constant!");
4649 if ( (vpos != i) && (
pGetExp( piter, i ) != 0) )
4651 WerrorS(
"The input polynomial must be univariate!");
4659 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4661 for ( i= deg; i >= 0; i-- )
4675 #ifdef mprDEBUG_PROT 4676 for (i=deg; i >= 0; i--)
4684 roots->
solver( howclean );
4691 rlist->
Init( elem );
4695 for ( j= 0; j < elem; j++ )
4704 for ( j= 0; j < elem; j++ )
4708 rlist->
m[
j].
data=(
void *)dummy;
4722 res->
data= (
void*)rlist;
4731 p= (ideal)arg1->
Data();
4732 w= (ideal)arg2->
Data();
4743 int tdg= (int)(
long)arg3->
Data();
4750 WerrorS(
"Last input parameter must be > 0!");
4758 if ( m != (
int)
pow((
double)tdg+1,(
double)n) )
4760 Werror(
"Size of second input ideal must be equal to %d!",
4761 (
int)
pow((
double)tdg+1,(
double)n));
4768 WerrorS(
"Ground field not implemented!");
4773 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4774 for ( i= 0; i < n; i++ )
4783 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4792 WerrorS(
"Elements of first input ideal must be numbers!");
4795 pevpoint[
i]=
nCopy( tmp );
4799 number *wresults= (number *)
omAlloc( m *
sizeof( number ) );
4800 for ( i= 0; i <
m; i++ )
4809 WerrorS(
"Elements of second input ideal must be numbers!");
4824 res->
data= (
void*)rpoly;
4839 else gls= (ideal)(v->
Data());
4845 else imtype= (int)(
long)v->
Data();
4850 ideal test_id=
idInit(1,1);
4852 for(j=
IDELEMS(gls)-1;j>=0;j--)
4854 if (gls->m[j]!=
NULL)
4856 test_id->m[0]=gls->m[
j];
4860 WerrorS(
"Newton polytope not of expected dimension");
4874 unsigned long int ii=(
unsigned long int)v->
Data();
4882 else howclean= (int)(
long)v->
Data();
4911 WerrorS(
"Error occurred during matrix setup!");
4919 #ifdef mprDEBUG_PROT 4924 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4930 if ( interpolate_det )
4936 if ( interpolate_det )
4941 #ifdef mprDEBUG_PROT 4943 for (i=0; i < c; i++)
pWrite(iproots[i]->getPoly());
4945 for (i=0; i < c; i++)
pWrite(muiproots[i]->getPoly());
4949 arranger=
new rootArranger( iproots, muiproots, howclean );
4960 WerrorS(
"Solver was unable to find any roots!");
4966 for (i=0; i <
count; i++)
delete iproots[i];
4969 for (i=0; i <
count; i++)
delete muiproots[i];
4976 res->
data= (
void *)listofroots;
4988 int count=
self->roots[0]->getAnzRoots();
4989 int elem=
self->roots[0]->getAnzElems();
4993 if ( self->found_roots )
4995 listofroots->
Init( count );
4997 for (i=0; i <
count; i++)
5000 onepoint->
Init(elem);
5001 for ( j= 0; j < elem; j++ )
5017 listofroots->
m[
i].
data=(
void *)onepoint;
5025 listofroots->
Init( 0 );
5039 if (rg==
NULL)
return;
5059 Warn(
"deleting denom_list for ring change to %s",
IDID(h));
5071 if ((rg!=
NULL) && (rg->idroot==
NULL))
5099 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5104 (*iv)[
i]= - (*iv)[
i];
5113 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5118 (*iv)[
i]= -(*iv)[
i];
5127 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5133 (*iv2)[2]=iv->
length()-2;
5145 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5151 (*iv2)[2]=iv->
length()-2;
5185 (*iv)[2] += (*iv2)[2];
5192 if (!change) h=h->
next;
5200 int last = 0, o=0, n = 1,
i=0, typ = 1,
j;
5212 R->bitmask=(*iv)[2];
5225 WerrorS(
"invalid combination of orderings");
5233 WerrorS(
"more than one ordering c/C specified");
5239 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
5240 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
5243 int *weights=(
int*)
omAlloc0((R->N+1)*
sizeof(int));
5246 for (
j=0;
j < n-1;
j++)
5277 R->block0[n] = last+1;
5280 R->wvhdl[n][
i-2] = (*iv)[
i];
5282 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5284 R->block1[n] =
si_min(last,R->N);
5295 R->block0[n] = last+1;
5296 if (iv->
length() == 3) last+=(*iv)[2];
5297 else last += (*iv)[0];
5298 R->block1[n] =
si_min(last,R->N);
5302 if (weights[
i]==0) weights[
i]=typ;
5314 const int s = (*iv)[2];
5324 const int s = (*iv)[2];
5326 if( 1 < s || s < -1 )
return TRUE;
5342 R->block0[n] = last+1;
5347 R->wvhdl[n][
i-2]=(*iv)[
i];
5349 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5351 last=R->block0[n]-1;
5356 R->block0[n] = last+1;
5359 if (R->block1[n]- R->block0[n]+2>=iv->
length())
5360 WarnS(
"missing module weights");
5361 for (
i=2;
i<=(R->block1[n]-R->block0[n]+2);
i++)
5363 R->wvhdl[n][
i-2]=(*iv)[
i];
5365 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5367 R->wvhdl[n][
i-2]=iv->
length() -3 -(R->block1[n]- R->block0[n]);
5370 R->wvhdl[n][
i-1]=(*iv)[
i];
5372 last=R->block0[n]-1;
5377 R->block0[n] = last+1;
5385 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5387 last=R->block0[n]-1;
5393 if (Mtyp==0)
return TRUE;
5394 if (Mtyp==-1) typ = -1;
5398 R->wvhdl[n][
i-2]=(*iv)[
i];
5400 R->block0[n] = last+1;
5402 R->block1[n] =
si_min(last,R->N);
5403 for(
i=R->block1[n];
i>=R->block0[n];
i--)
5405 if (weights[
i]==0) weights[
i]=typ;
5415 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5422 Werror(
"mismatch of number of vars (%d) and ordering (>=%d vars)",
5430 for(
i=1;
i<=R->N;
i++)
5431 {
if (weights[
i]<0) { R->OrdSgn=-1;
break; }}
5445 if (R->block1[n] != R->N)
5456 R->block0[n] <= R->N)
5458 R->block1[n] = R->N;
5462 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5481 *p = (
char*)sl->
name;
5522 mpz_ptr modBase =
NULL;
5523 unsigned int modExponent = 1;
5554 WerrorS(
"parameter expected");
5560 extParam.
r =
rDefault( cf, pars, names);
5561 for(
int i=pars-1;
i>=0;
i--)
5573 int ch = (int)(
long)pn->
Data();
5584 if ((ch<2)||(ch!=ch2))
5586 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5601 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5613 if ((ch!=0) && (ch!=
IsPrime(ch)))
5615 WerrorS(
"too many parameters");
5623 WerrorS(
"parameter expected");
5629 extParam.
r =
rDefault( ch, pars, names);
5630 for(
int i=pars-1;
i>=0;
i--)
5643 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5646 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5649 float_len=(int)(
long)pnn->
Data();
5650 float_len2=float_len;
5654 float_len2=(int)(
long)pnn->
Data();
5673 if (param.
float_len < SHORT_REAL_LENGTH)
5689 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5692 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
5693 mpz_init_set_si(modBase, 0);
5700 mpz_set_ui(modBase, (
int)(
long) pnn->
Data());
5704 modExponent = (long) pnn->
Data();
5709 mpz_mul_ui(modBase, modBase, (
int)(
long) pnn->
Data());
5722 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5724 WerrorS(
"Wrong ground ring specification (module is 1)");
5727 if (modExponent < 1)
5729 WerrorS(
"Wrong ground ring specification (exponent smaller than 1");
5734 if (modExponent > 1 && cf ==
NULL)
5736 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5747 if (mpz_cmp_ui(modBase,0)==0)
5749 WerrorS(
"modulus must not be 0 or parameter not allowed");
5755 info.
exp= modExponent;
5760 else if (cf ==
NULL)
5762 if (mpz_cmp_ui(modBase,0)==0)
5764 WerrorS(
"modulus must not be 0 or parameter not allowed");
5770 info.
exp= modExponent;
5780 extParam.
r = (ring)pn->
Data();
5792 WerrorS(
"Wrong or unknown ground field specification");
5798 Print(
"pn[%p]: type: %d [%s]: %p, name: %s", (
void*)p, p->
Typ(),
Tok2Cmdname(p->Typ()), p->Data(), (p->name ==
NULL?
"NULL" : p->name) );
5820 WerrorS(
"Invalid ground field specification");
5836 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5844 WerrorS(
"name of ring variable expected");
5897 int *
perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(int));
5905 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5914 WerrorS(
"name of ring variable expected");
5924 for(;
i<org_ring->N;
i++)
5926 if (strcmp(org_ring->names[
i],R->names[
j])==0)
5934 Werror(
"variable %d (%s) not in basering",
j+1,R->names[
j]);
5947 for(
j=R->block0[
i];j<=R->block1[
i];
j++)
5951 if (min_var==-1) min_var=perm[
j];
5959 R->block0[
i]=min_var;
5960 R->block1[
i]=max_var;
5961 if (R->wvhdl[
i]!=
NULL)
5964 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(int));
5965 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
5969 R->wvhdl[
i][perm[
j]-R->block0[
i]]=
5970 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
5996 R->order[
j-1]=R->order[
j];
5997 R->block0[
j-1]=R->block0[
j];
5998 R->block1[
j-1]=R->block1[
j];
6000 R->wvhdl[
j-1]=R->wvhdl[
j];
6008 while (R->order[n]==0) n--;
6011 if (R->block1[n] != R->N)
6022 R->block0[n] <= R->N)
6024 R->block1[n] = R->N;
6028 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
6029 R->N,R->block1[n],n);
6035 R->OrdSgn = org_ring->OrdSgn;
6058 if ((r->ref<=0)&&(r->order!=
NULL))
6063 if (r->qideal!=
NULL)
6073 if (j==0)
WarnS(
"killing the basering for level 0");
6078 while (r->idroot!=
NULL)
6081 killhdl2(r->idroot,&(r->idroot),r);
6176 resid=(ideal)(res.
data);
6229 ideal I=(ideal)u->
Data();
6232 for(i=I->nrows*I->ncols-1;i>=0;i--)
6244 switch (p->language)
6252 if(p->libname!=
NULL)
6253 Print(
",%s", p->libname);
6266 memset(&tmp_in,0,
sizeof(tmp_in));
6268 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6272 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6276 Werror(
"apply fails at index %d",
i+1);
6279 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6284 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6306 for(
int i=0;
i<=aa->
nr;
i++)
6308 memset(&tmp_in,0,
sizeof(tmp_in));
6309 tmp_in.
Copy(&(aa->
m[
i]));
6313 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6318 Werror(
"apply fails at index %d",
i+1);
6321 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6326 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6333 memset(res,0,
sizeof(
sleftv));
6349 WerrorS(
"first argument to `apply` must allow an index");
6359 char assume_yylinebuf[80];
6361 int lev=(long)a->
Data();
6368 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6382 char *ss=(
char*)
omAlloc(strlen(a)+strlen(s)+30);
6384 int end_s=strlen(s);
6385 while ((end_s>0) && ((s[end_s]<=
' ')||(s[end_s]==
';'))) end_s--;
6387 char *
name=(
char *)
omAlloc(strlen(a)+strlen(s)+30);
6388 sprintf(name,
"%s->%s",a,s);
6390 int start_s=end_s-1;
6391 while ((start_s>=0) && (s[start_s]!=
';')) start_s--;
6394 sprintf(ss,
"parameter def %s;return(%s);\n",a,s);
6399 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6401 memset(r,0,
sizeof(*r));
6421 memset(&tmp,0,
sizeof(tmp));
6439 memset(&n,0,
sizeof(n));
6457 sprintf(buf,
"wrong length of parameters(%d), expected ",t);
6459 sprintf(buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6460 for(
int i=1;
i<=T[0];
i++)
6465 if (i<T[0]) strcat(buf,
",");
6474 if (type_list[0]==0)
return TRUE;
6477 if (report)
WerrorS(
"no arguments expected");
6482 if (l!=(
int)type_list[0])
6487 for(
int i=1;
i<=
l;
i++,args=args->
next)
6489 short t=type_list[
i];
6493 || (t!=args->Typ()))
int status int void size_t count
BOOLEAN jjCHARSERIES(leftv res, leftv u)
for idElimination, like a, except pFDeg, pWeigths ignore it
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
complex root finder for univariate polynomials based on laguers algorithm
#define omRealloc0Size(addr, o_size, size)
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
const CanonicalForm int s
int iiTestConvert(int inputType, int outputType)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
unsigned char * proc[NUM_PROC]
#define omCheckAddrSize(addr, size)
void atSet(idhdl root, const char *name, void *data, int typ)
Class used for (list of) interpreter objects.
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
number * interpolateDense(const number *q)
Solves the Vandermode linear system {i=1}^{n} x_i^k-1 w_i = q_k, k=1,..,n.
matrix mapToMatrix(matrix m)
ring rSubring(ring org_ring, sleftv *rv)
Base class for solving 0-dim poly systems using u-resultant.
only used if HAVE_RINGS is defined
void mu(int **points, int sizePoints)
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
#define SHORT_REAL_LENGTH
vandermonde system solver for interpolating polynomials from their values
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
#define idDelete(H)
delete an ideal
static BOOLEAN rField_is_Zp_a(const ring r)
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
static BOOLEAN rComposeVar(const lists L, ring R)
ring rCompose(const lists L, const BOOLEAN check_comp)
only used if HAVE_RINGS is defined
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
static int si_min(const int a, const int b)
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Linear Programming / Linear Optimization using Simplex - Algorithm.
Compatiblity layer for legacy polynomial operations (over currRing)
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
int exprlist_length(leftv v)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
void syMinimizeResolvente(resolvente res, int length, int first)
static int rPar(const ring r)
(r->cf->P)
spectrum spectrumFromList(lists l)
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
static BOOLEAN rField_is_R(const ring r)
void list_error(semicState state)
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
resMatrixBase * accessResMat()
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
#define omFreeSize(addr, size)
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
static int * multiplicity
poly singclap_resultant(poly f, poly g, poly x, const ring r)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
intvec * id_QHomWeight(ideal id, const ring r)
BOOLEAN nuVanderSys(leftv res, leftv arg1, leftv arg2, leftv arg3)
COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consi...
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
BOOLEAN spectrumProc(leftv result, leftv first)
static BOOLEAN rField_is_Q_a(const ring r)
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
denominator_list DENOMINATOR_LIST
uResultant::resMatType determineMType(int imtype)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
BOOLEAN iiAssignCR(leftv r, leftv arg)
static long p_Totaldegree(poly p, const ring r)
poly iiHighCorner(ideal I, int ak)
bool solver(const int polishmode=PM_NONE)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
BOOLEAN hasConstTerm(poly h, const ring r)
void WerrorS(const char *s)
static BOOLEAN rField_is_GF(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
void nlGMP(number &i, number n, const coeffs r)
char * lString(lists l, BOOLEAN typed, int dim)
ring rAssure_HasComp(const ring r)
ideal loNewtonPolytope(const ideal id)
void killlocals_rec(idhdl *root, int v, ring r)
syStrategy syConvList(lists li)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
void hRadical(scfmon rad, int *Nrad, int Nvar)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
int hasOne(ideal J, const ring r)
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
poly numvec2poly(const number *q)
void rComposeC(lists L, ring R)
static void jjINT_S_TO_ID(int n, int *e, leftv res)
BOOLEAN iiBranchTo(leftv res, leftv args)
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Creation data needed for finite fields.
BOOLEAN iiExport(leftv v, int toLev)
idhdl rDefault(const char *s)
static BOOLEAN idIsZeroDim(ideal i)
idhdl get(const char *s, int lev)
real floating point (GMP) numbers
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
BOOLEAN iiParameter(leftv p)
short float_len2
additional char-flags, rInit
#define pGetVariables(p, e)
void rDecomposeRing_41(leftv h, const coeffs C)
#define nPrint(a)
only for debug, over any initalized currRing
lists getList(spectrum &spec)
int iiRegularity(lists L)
void rDecomposeCF(leftv h, const ring r, const ring R)
void hDelete(scfmon ev, int ev_length)
BOOLEAN iiTestAssume(leftv a, leftv b)
semicState list_is_spectrum(lists l)
BOOLEAN kWeight(leftv res, leftv id)
#define omReallocSize(addr, o_size, size)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetExp(p, i)
Exponent.
single prescision (6,6) real numbers
void killhdl2(idhdl h, idhdl *ih, ring r)
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
BOOLEAN hasLinearTerm(poly h, const ring r)
static int rBlocks(ring r)
BOOLEAN syBetti1(leftv res, leftv u)
spectrumState spectrumStateFromList(spectrumPolyList &speclist, lists *L, int fast)
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
short float_len
additional char-flags, rInit
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)
Coefficient rings, fields and other domains suitable for Singular polynomials.
BOOLEAN killlocals_list(int v, lists L)
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
void hKill(monf xmem, int Nvar)
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...
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
ideal maMapIdeal(const ideal map_id, const ring preimage_r, const ideal image_id, const ring image_r, const nMapFunc nMap)
polynomial map for ideals/module/matrix map_id: the ideal to map map_r: the base ring for map_id imag...
BOOLEAN mapFromMatrix(matrix m)
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
void computeNF(ideal stdJ, poly hc, poly wc, spectrumPolyList *NF, const ring r)
only used if HAVE_RINGS is defined
static long pTotaldegree(poly p)
static leftv rOptimizeOrdAsSleftv(leftv ord)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN iiNoKeepRing
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
int status int void * buf
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
const ExtensionInfo & info
< [in] sqrfree poly
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static void rDecomposeC(leftv h, const ring R)
BOOLEAN hasAxis(ideal J, int k, const ring r)
complex floating point (GMP) numbers
static FORCE_INLINE char * nCoeffName(const coeffs cf)
const char * rSimpleOrdStr(int ord)
int mult_spectrumh(spectrum &)
gmp_float sqrt(const gmp_float &a)
static resolvente iiCopyRes(resolvente r, int l)
BOOLEAN nuUResSolve(leftv res, leftv args)
solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing-...
static void iiReportTypes(int nr, int t, const short *T)
BOOLEAN rCheckIV(const intvec *iv)
const unsigned short fftable[]
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define pIsConstant(p)
like above, except that Comp might be != 0
struct for passing initialization parameters to naInitChar
only used if HAVE_RINGS is defined
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
void spectrumPrintError(spectrumState state)
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
const char * iiTwoOps(int t)
static int si_max(const int a, const int b)
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
virtual ideal getMatrix()
ring rInit(leftv pn, leftv rv, leftv ord)
Induced (Schreyer) ordering.
void PrintS(const char *s)
matrix singclap_irrCharSeries(ideal I, const ring r)
static BOOLEAN rField_is_Q(const ring r)
lists rDecompose(const ring r)
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
BOOLEAN spectrumfProc(leftv result, leftv first)
char name(const Variable &v)
gmp_complex * getRoot(const int i)
idhdl rFindHdl(ring r, idhdl n)
static unsigned pLength(poly a)
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
BOOLEAN slWrite(si_link l, leftv v)
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
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
spectrumState spectrumCompute(poly h, lists *L, int fast)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
static void rRenameVars(ring R)
static void rDecomposeC_41(leftv h, const coeffs C)
static BOOLEAN rField_is_long_C(const ring r)
#define rHasLocalOrMixedOrdering_currRing()
void rChangeCurrRing(ring r)
static BOOLEAN rField_is_Zp(const ring r)
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
INLINE_THIS void Init(int l=0)
matrix mpNew(int r, int c)
create a r x c zero-matrix
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
void paPrint(const char *n, package p)
BOOLEAN iiCheckRing(int i)
ideal idInit(int idsize, int rank)
initialise an ideal / module
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
BOOLEAN kQHWeight(leftv res, leftv v)
static BOOLEAN iiInternalExport(leftv v, int toLev)
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
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 rComposeRing(lists L, ring R)
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
#define BREAK_LINE_LENGTH
static BOOLEAN rField_is_Ring(const ring r)
void rDecomposeRing(leftv h, const ring R)
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
BOOLEAN iiDefaultParameter(leftv p)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
struct for passing initialization parameters to naInitChar
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
BOOLEAN semicProc(leftv res, leftv u, leftv v)
void rDelete(ring r)
unconditionally deletes fields in r
BOOLEAN nuMPResMat(leftv res, leftv arg1, leftv arg2)
returns module representing the multipolynomial resultant matrix Arguments 2: ideal i...
const char * Tok2Cmdname(int tok)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
BOOLEAN iiWRITE(leftv, leftv v)
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
BOOLEAN jjBETTI(leftv res, leftv u)
coeffs basecoeffs() const
static BOOLEAN rField_is_Ring_Z(const ring r)
void pNorm(poly p, const ring R=currRing)
static BOOLEAN rField_is_long_R(const ring r)
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
int rTypeOfMatrixOrder(const intvec *order)
int iiOpsTwoChar(const char *s)
BOOLEAN jjMINRES(leftv res, leftv v)
void CleanUp(ring r=currRing)
void Clean(ring r=currRing)
const char * par_name
parameter name
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
lists rDecompose_list_cf(const ring r)
static int rInternalChar(const ring r)
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
rRingOrder_t rOrderName(char *ordername)
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
number nlMapGMP(number from, const coeffs src, const coeffs dst)
BOOLEAN iiARROW(leftv r, char *a, char *s)
BOOLEAN ringIsLocal(const ring r)
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
leftv iiMap(map theMap, const char *what)
idhdl packFindHdl(package r)
#define omCheckAddr(addr)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void iiCheckPack(package &p)
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
virtual IStateType initState() const
#define omFreeBin(addr, bin)
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Rational pow(const Rational &a, int e)
char * iiGetLibProcBuffer(procinfo *pi, int part)
#define IMATELEM(M, I, J)
static poly p_Init(const ring r, omBin bin)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
void syKillEmptyEntres(resolvente res, int length)
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
int mult_spectrum(spectrum &)
lists listOfRoots(rootArranger *self, const unsigned int oprec)
static BOOLEAN rField_is_numeric(const ring r)
BOOLEAN lRingDependend(lists L)
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
void copy_deep(spectrum &spec, lists l)
void delete_node(spectrumPolyNode **)
void Werror(const char *fmt,...)
virtual number getSubDet()
ideal kGroebner(ideal F, ideal Q)
void syKillComputation(syStrategy syzstr, ring r=currRing)
const char * lastreserved
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
static void killlocals0(int v, idhdl *localhdl, const ring r)
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
#define pCopy(p)
return a copy of the poly
#define MATELEM(mat, i, j)
poly computeWC(const newtonPolygon &np, Rational max_weight, const ring r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
syStrategy syForceMin(lists li)
int IsCmd(const char *n, int &tok)
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
BOOLEAN mpJacobi(leftv res, leftv a)