10 #include "factory/factory.h"
110 case LE:
return "<=";
111 case GE:
return ">=";
120 if (
s[1]==
'\0')
return s[0];
121 else if (
s[2]!=
'\0')
return 0;
124 case '.':
if (
s[1]==
'.')
return DOTDOT;
130 case '+':
if (
s[1]==
'+')
return PLUSPLUS;
134 case '<':
if (
s[1]==
'=')
return LE;
137 case '>':
if (
s[1]==
'=')
return GE;
139 case '!':
if (
s[1]==
'=')
return NOTEQUAL;
151 if(fullname) sprintf(
buf2,
"%s::%s",
"",
IDID(
h));
195 && (strlen(
IDPROC(
h)->libname)>0))
208 if ((
s=strchr(buffer,
'\n'))!=
NULL)
216 Print(
"..., %d char(s)",
l);
232 { number2 n=(number2)
IDDATA(
h);
238 Print(
" %d x %d (%s)",
264 ((
intvec*)(
v->Data()))->cols());
break;
268 case MODUL_CMD:
Print(
", rk %d\n", (
int)(((ideal)(
v->Data()))->rank));
break;
371 && (((ring)d)->idroot!=
NULL))
397 if (((ring)
h->data)->idroot!=
NULL)
422 package savePack=currPack;
429 if (strcmp(what,
"all")==0)
464 Werror(
"%s is undefined",what);
498 package save_p=currPack;
532 WarnS(
"Gerhard, use the option command");
562 rc += ((
intvec *)(
v->Data()))->length();
573 rc+=((
lists)
v->Data())->nr+1;
594 WerrorS(
"write: need at least two arguments");
604 Werror(
"cannot write to %s",
s);
631 Werror(
"can not map from ground field of %s to current ground field",
635 if (
IDELEMS(theMap)<src_ring->N)
639 (src_ring->N)*
sizeof(poly));
646 WerrorS(
"argument of a map must have a name");
653 memset(&tmpW,0,
sizeof(
sleftv));
658 save_r=
IDMAP(
w)->preimage;
668 ideal
id=(ideal)tmpW.
data;
676 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
678 if (theMap->m[
j]!=
NULL)
685 if ((
p!=
NULL) && (degs[
i]!=0) &&
686 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)degs[
i])/2)))
698 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
700 if (theMap->m[
j]!=
NULL)
703 poly
p=(poly)tmpW.
data;
706 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)deg)/2)))
715 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
731 char *tmp = theMap->preimage;
732 theMap->preimage=(
char*)1L;
735 theMap->preimage=tmp;
750 IDMAP(
w)->preimage=save_r;
758 Werror(
"%s undefined in %s",what,theMap->preimage);
763 Werror(
"cannot find preimage %s",theMap->preimage);
779 sprintf(
s,
"%s(%d)",
name,
i+1);
786 h->data.uideal=(ideal)L->
m[
i].
data;
789 Print(
"//defining: %s as %d-th syzygy module\n",
s,
i+1);
794 Warn(
"cannot define %s",
s);
874 int add_row_shift = 0;
877 if (weights!=
NULL) add_row_shift=weights->
min_in();
892 memset(&tmp,0,
sizeof(tmp));
906 l->m[0].rtyp=u->
Typ();
907 l->m[0].data=u->
Data();
910 l->m[0].attribute=*a;
917 l->m[0].attribute=
NULL;
937 add_row_shift = ww->
min_in();
938 (*weights) -= add_row_shift;
945 res->data=(
void*)res_im;
948 for(
int i=1;
i<=res_im->
rows();
i++)
950 if (
IMATELEM(*res_im,1,
i)==0) { add_row_shift--; }
955 if (weights!=
NULL)
delete weights;
973 add_row_shift = ww->
min_in();
974 (*weights) -= add_row_shift;
979 if (weights!=
NULL)
delete weights;
982 return reg+1+add_row_shift;
986 #define BREAK_LINE_LENGTH 80
1013 else if(strncmp(
s,
"cont;",5)==0)
1020 strcat(
s,
"\n;~\n");
1091 res->m[
i].data = (
void *)save->set;
1103 res->m[
i].data = (
void *)save->set;
1128 const char *
id =
name->name;
1130 memset(sy,0,
sizeof(
sleftv));
1133 WerrorS(
"object to declare is not a name");
1177 memset(&tmp,0,
sizeof(
sleftv));
1187 WerrorS(
"branchTo can only occur in a proc");
1195 if (ll!=(
l-1))
return FALSE;
1198 short *t=(
short*)
omAlloc(
l*
sizeof(
short));
1202 for(
i=1;
i<
l;
i++,
h=
h->next)
1207 Werror(
"arg %d is not a string",
i);
1211 b=
IsCmd((
char *)
h->Data(),tt);
1216 Werror(
"arg %d is not a type name",
i);
1223 Werror(
"last(%d.) arg.(%s) is not a proc(but %s(%d)), nesting=%d",
1235 if(
pi->data.s.body==
NULL )
1287 if (strcmp(
p->name,
"#")==0)
1296 if (strcmp(
p->name,
"#")==0)
1298 is_default_list=
TRUE;
1306 if (is_default_list)
1364 if (keepring)
IDRING(
h)->ref--;
1376 Warn(
"'%s': no such identifier\n",
v->
name);
1379 package frompack=v->req_packhdl;
1393 v->req_packhdl=rootpack;
1394 if (
h==frompack->idroot)
1396 frompack->idroot=
h->next;
1400 idhdl hh=frompack->idroot;
1407 Werror(
"`%s` not found",
v->Name());
1411 h->next=rootpack->idroot;
1425 Werror(
"cannot export:%s of internal type %d",
v->
name,
v->rtyp);
1454 Werror(
"cannot export:%s of internal type %d",
v->
name,
v->rtyp);
1467 else if (
IDTYP(old)==
v->Typ())
1547 WarnS(
"package not found\n");
1569 #ifndef TEST_ZN_AS_ZP
1573 mpz_init_set_ui(modBase, (
long)32003);
1580 r->cf->has_simple_Inverse=1;
1593 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1594 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1649 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1655 for(
i=0;
i<r->N;
i++)
1661 L->
m[1].
data=(
void *)LL;
1678 if (r->block1[
i]-r->block0[
i] >=0 )
1680 j=r->block1[
i]-r->block0[
i];
1683 if ((r->wvhdl!=
NULL) && (r->wvhdl[
i]!=
NULL))
1685 for(;
j>=0;
j--) (*iv)[
j]=r->wvhdl[
i][
j];
1687 else switch (r->order[
i])
1694 for(;
j>=0;
j--) (*iv)[
j]=1;
1704 LLL->
m[1].
data=(
void *)iv;
1705 LL->
m[
i].
data=(
void *)LLL;
1708 L->
m[2].
data=(
void *)LL;
1718 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1719 L->
m[3].
data=(
void *)q;
1738 L->
m[0].
data=(
void *)0;
1748 L->
m[1].
data=(
void *)LL;
1772 L->
m[0].
data=(
void *)0;
1782 L->
m[1].
data=(
void *)LL;
1816 LL->
m[1].
data=(
void *) C->modExponent;
1818 L->
m[1].
data=(
void *)LL;
1845 LL->
m[1].
data=(
void *)
R->cf->modExponent;
1847 L->
m[1].
data=(
void *)LL;
1861 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1874 else if ( C->extRing!=
NULL )
1884 Lc->m[0].data=(
void*)(
long)C->m_nfCharQ;
1891 Lc->m[1].data=(
void*)Lv;
1902 Loo->
m[1].
data=(
void *)iv;
1905 Lo->
m[0].
data=(
void*)Loo;
1908 Lc->m[2].data=(
void*)Lo;
1914 res->data=(
void*)
Lc;
1919 res->data=(
void *)(
long)C->ch;
1940 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1958 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
1964 for(
i=0;
i<r->N;
i++)
1970 L->
m[1].
data=(
void *)LL;
1990 assume( r->block0[
i] == r->block1[
i] );
1991 const int s = r->block0[
i];
1997 else if (r->block1[
i]-r->block0[
i] >=0 )
1999 int bl=
j=r->block1[
i]-r->block0[
i];
2007 j+=r->wvhdl[
i][bl+1];
2010 if ((r->wvhdl!=
NULL) && (r->wvhdl[
i]!=
NULL))
2012 for(;
j>=0;
j--) (*iv)[
j]=r->wvhdl[
i][
j+(
j>bl)];
2014 else switch (r->order[
i])
2021 for(;
j>=0;
j--) (*iv)[
j]=1;
2031 LLL->
m[1].
data=(
void *)iv;
2032 LL->m[
i].data=(
void *)LLL;
2035 L->
m[2].
data=(
void *)LL;
2039 if (r->qideal==
NULL)
2065 || (r->qideal !=
NULL)
2072 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2097 else if ( r->cf->extRing!=
NULL )
2107 Lc->m[0].data=(
void*)(
long)r->cf->m_nfCharQ;
2114 Lc->m[1].data=(
void*)Lv;
2125 Loo->
m[1].
data=(
void *)iv;
2128 Lo->
m[0].
data=(
void*)Loo;
2131 Lc->m[2].data=(
void*)Lo;
2142 L->
m[0].
data=(
void *)(
long)r->cf->ch;
2149 for(
i=0;
i<r->N;
i++)
2155 L->
m[1].
data=(
void *)LL;
2176 assume( r->block0[
i] == r->block1[
i] );
2177 const int s = r->block0[
i];
2183 else if (r->block1[
i]-r->block0[
i] >=0 )
2185 int bl=
j=r->block1[
i]-r->block0[
i];
2193 j+=r->wvhdl[
i][bl+1];
2196 if ((r->wvhdl!=
NULL) && (r->wvhdl[
i]!=
NULL))
2198 for(;
j>=0;
j--) (*iv)[
j]=r->wvhdl[
i][
j+(
j>bl)];
2200 else switch (r->order[
i])
2207 for(;
j>=0;
j--) (*iv)[
j]=1;
2217 LLL->
m[1].
data=(
void *)iv;
2218 LL->
m[
i].
data=(
void *)LLL;
2221 L->
m[2].
data=(
void *)LL;
2225 if (r->qideal==
NULL)
2249 WerrorS(
"invalid coeff. field description, expecting 0");
2257 WerrorS(
"invalid coeff. field description, expecting precision list");
2267 WerrorS(
"invalid coeff. field description list");
2270 int r1=(int)(
long)LL->
m[0].
data;
2271 int r2=(int)(
long)LL->
m[1].
data;
2293 R->cf->float_len=
si_min(r1,32767);
2294 R->cf->float_len2=
si_min(r2,32767);
2303 WerrorS(
"invalid coeff. field description, expecting parameter name");
2320 unsigned int modExponent = 1;
2324 mpz_init_set_ui(modBase,0);
2335 number tmp= (number) LL->
m[0].
data;
2342 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2346 mpz_init_set_ui(modBase,0);
2350 modExponent = (
unsigned long) LL->
m[1].
data;
2358 if ((mpz_cmp_ui(modBase, 1) == 0) && (
mpz_sgn1(modBase) < 0))
2360 WerrorS(
"Wrong ground ring specification (module is 1)");
2363 if (modExponent < 1)
2365 WerrorS(
"Wrong ground ring specification (exponent smaller than 1)");
2374 else if (modExponent > 1)
2377 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2388 info.exp= modExponent;
2399 info.exp= modExponent;
2413 for(
i=0;
i<
R->N-1;
i++)
2415 for(
j=
i+1;
j<
R->N;
j++)
2417 if (strcmp(
R->names[
i],
R->names[
j])==0)
2420 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",
i+1,
j+1,
R->names[
i],
R->names[
i]);
2422 R->names[
j]=(
char *)
omAlloc(2+strlen(
R->names[
i]));
2423 sprintf(
R->names[
j],
"@%s",
R->names[
i]);
2435 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",
i+1,
j+1,
R->names[
j],
i+1);
2441 sprintf(
R->names[
j],
"@@(%d)",
i+1);
2467 poly
p=(poly)
v->m[
i].Data();
2473 Werror(
"var name %d must be a string or a ring variable",
i+1);
2479 Werror(
"var name %d must be `string` (not %d)",
i+1,
v->m[
i].Typ());
2486 WerrorS(
"variable must be given as `list`");
2502 for (
int j=0;
j < n-1;
j++)
2509 &&(strcmp((
char*)vv->
m[0].
Data(),
"L")==0))
2511 number nn=(number)vv->
m[1].
Data();
2518 Werror(
"illegal argument for pseudo ordering L: %d",vv->
m[1].
Typ());
2525 if (bitmask!=0) n--;
2529 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2530 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2533 for (j_in_R= n-2; j_in_R>=0; j_in_R--)
2536 for(j_in_R=0,j_in_L=0;j_in_R<n-1;j_in_R++,j_in_L++)
2541 WerrorS(
"ordering must be list of lists");
2548 if (strcmp((
char*)vv->
m[0].
Data(),
"L")==0)
2556 WerrorS(
"ordering name must be a (string,intvec)(1)");
2561 if (j_in_R==0)
R->block0[0]=1;
2578 if (jj<0)
R->block0[j_in_R]=1;
2579 else R->block0[j_in_R]=
R->block1[jj]+1;
2591 R->block1[j_in_R]=
si_max(
R->block0[j_in_R],
R->block0[j_in_R]+iv_len-1);
2592 if (
R->block1[j_in_R]>
R->N)
2594 if (
R->block0[j_in_R]>
R->N)
2599 R->block1[j_in_R]=
R->N;
2600 iv_len=
R->block1[j_in_R]-
R->block0[j_in_R]+1;
2605 switch (
R->order[j_in_R])
2614 R->wvhdl[j_in_R] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2615 for (
i=0;
i<iv_len;
i++)
2617 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2622 for (
i=0;
i<iv_len;
i++)
2624 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2626 R->wvhdl[j_in_R][
i]=iv->
length() - iv_len;
2630 R->wvhdl[j_in_R][
i+1]=(*iv)[
i];
2635 for (
i=0;
i<iv->
length();
i++)
R->wvhdl[j_in_R][
i]=(*iv)[
i];
2636 R->block1[j_in_R]=
si_max(
R->block0[j_in_R],
R->block0[j_in_R]+(
int)
sqrt((
double)(iv->
length()-1)));
2637 if (
R->block1[j_in_R]>
R->N)
2639 WerrorS(
"ordering matrix too big");
2657 R->block1[j_in_R]=
R->block0[j_in_R]=0;
2661 R->block1[j_in_R]=
R->block0[j_in_R]=(*iv)[0];
2667 R->block1[j_in_R] =
R->block0[j_in_R] = 0;
2670 const int s = (*iv)[0];
2672 R->block1[j_in_R] =
R->block0[j_in_R] =
s;
2681 WerrorS(
"ring order not implemented");
2689 WerrorS(
"ordering name must be a (string,intvec)");
2698 if (
R->block1[j_in_R] !=
R->N)
2709 R->block0[j_in_R] <=
R->N)
2711 R->block1[j_in_R] =
R->N;
2715 Werror(
"ordering incomplete: size (%d) should be %d",
R->block1[j_in_R],
R->N);
2719 if (
R->block0[j_in_R]>
R->N)
2721 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",
R->N,j_in_R+1);
2722 for(
int ii=0;ii<=j_in_R;ii++)
2751 WerrorS(
"ordering must be given as `list`");
2754 if (bitmask!=0)
R->bitmask=bitmask*2;
2786 int ch = (int)(
long)L->
m[0].
Data();
2796 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch,
l);
2799 #ifndef TEST_ZN_AS_ZP
2803 mpz_init_set_ui(modBase,(
long) ch);
2810 R->cf->has_simple_Inverse=1;
2831 int ch = (int)(
long)LL->
m[0].
Data();
2832 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2833 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2854 WerrorS(
"could not create the specified coefficient field");
2858 if( extRing->qideal !=
NULL )
2862 extParam.
r = extRing;
2869 extParam.
r = extRing;
2879 WerrorS(
"coefficient field must be described by `int` or `list`");
2885 WerrorS(
"could not create coefficient field described by the input!");
2897 #ifdef HAVE_SHIFTBBA
2900 R->isLPring=isLetterplace;
2905 if (bitmask!=0x7fff)
R->bitmask=bitmask*2;
2912 ideal q=(ideal)L->
m[3].
Data();
2918 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2925 int par_perm_size=0;
2945 par_perm_size=
rPar(orig_ring);
2955 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2959 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(int));
2960 if (par_perm_size!=0)
2961 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2965 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2974 else if (par_perm_size!=0)
2982 par_perm,par_perm_size);
3000 WerrorS(
"q-ideal must be given as `ideal`");
3049 ideal
id=(ideal)a->
Data();
3069 int n=(int)(
long)
b->Data();
3070 int d=(int)(
long)c->
Data();
3077 if ((d>n) || (d<1) || (n<1))
3082 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
3086 temp=(ideal)id->
Data();
3101 p =
pCopy(temp->m[choise[
l-1]-1]);
3127 BOOLEAN minim=(int)(
long)
w->Data();
3129 int add_row_shift=0;
3135 add_row_shift = ww->
min_in();
3136 (*weights) -= add_row_shift;
3149 memset(&tmp,0,
sizeof(tmp));
3165 if ((fullres==
NULL) && (minres==
NULL))
3277 ideal F=(ideal)id->
Data();
3283 res->data=(
char *)iv;
3287 double wNsqr = (double)2.0 / (
double)n;
3289 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(int));
3291 for (
i = n;
i!=0;
i--)
3292 (*iv)[
i-1] =
x[
i + n + 1];
3310 res->data=(
void *)
b;
3328 #ifdef HAVE_SPECTRUM
3336 spec.
mu = (int)(
long)(
l->m[0].Data( ));
3337 spec.
pg = (int)(
long)(
l->m[1].Data( ));
3338 spec.
n = (int)(
long)(
l->m[2].Data( ));
3346 for(
int i=0;
i<spec.
n;
i++ )
3349 spec.
w[
i] = (*mul)[
i];
3380 for(
int i=0;
i<spec.
n;
i++ )
3384 (*mult)[
i] = spec.
w[
i];
3394 L->
m[0].
data = (
void*)(
long)spec.
mu;
3395 L->
m[1].
data = (
void*)(
long)spec.
pg;
3396 L->
m[2].
data = (
void*)(
long)spec.
n;
3447 WerrorS(
"the list is too short" );
3450 WerrorS(
"the list is too long" );
3454 WerrorS(
"first element of the list should be int" );
3457 WerrorS(
"second element of the list should be int" );
3460 WerrorS(
"third element of the list should be int" );
3463 WerrorS(
"fourth element of the list should be intvec" );
3466 WerrorS(
"fifth element of the list should be intvec" );
3469 WerrorS(
"sixth element of the list should be intvec" );
3473 WerrorS(
"first element of the list should be positive" );
3476 WerrorS(
"wrong number of numerators" );
3479 WerrorS(
"wrong number of denominators" );
3482 WerrorS(
"wrong number of multiplicities" );
3486 WerrorS(
"the Milnor number should be positive" );
3489 WerrorS(
"the geometrical genus should be nonnegative" );
3492 WerrorS(
"all numerators should be positive" );
3495 WerrorS(
"all denominators should be positive" );
3498 WerrorS(
"all multiplicities should be positive" );
3502 WerrorS(
"it is not symmetric" );
3505 WerrorS(
"it is not monotonous" );
3509 WerrorS(
"the Milnor number is wrong" );
3512 WerrorS(
"the geometrical genus is wrong" );
3516 WerrorS(
"unspecific error" );
3552 ( fast==2 ? 2 : 1 ) );
3562 ( fast==0 || (*node)->weight<=smax ) )
3584 cmp =
pCmp( (*node)->mon,
f );
3607 (*node)->nf =
search->nf;
3611 while( cmp<0 &&
f!=(poly)
NULL );
3624 if( (*node)->weight<=(
Rational)1 ) pg++;
3625 if( (*node)->weight==smax ) z++;
3626 if( (*node)->weight>weight_prev ) n++;
3628 weight_prev = (*node)->weight;
3629 node = &((*node)->next);
3651 cmp =
pCmp( (*node)->mon,
f );
3664 while( cmp<0 &&
f!=(poly)
NULL );
3680 n = ( z > 0 ? 2*n - 1 : 2*n );
3695 ( fast==0 ||
search->weight<=smax );
3721 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3724 (*den) [n2] = (*den)[n1];
3725 (*mult)[n2] = (*mult)[n1];
3733 if( fast==0 || fast==1 )
3737 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3740 (*
den) [n1]!= (*
den)[n2] ||
3747 if( symmetric==
FALSE )
3757 (*L)->m[0].data = (
void*)(
long)
mu;
3774 (*L)->m[0].data = (
void*)(
long)
mu;
3775 (*L)->m[1].data = (
void*)(
long)pg;
3776 (*L)->m[2].data = (
void*)(
long)n;
3777 (*L)->m[3].data = (
void*)nom;
3778 (*L)->m[4].data = (
void*)
den;
3779 (*L)->m[5].data = (
void*)
mult;
3788 #ifdef SPECTRUM_DEBUG
3789 #ifdef SPECTRUM_PRINT
3790 #ifdef SPECTRUM_IOSTREAM
3791 cout <<
"spectrumCompute\n";
3792 if( fast==0 ) cout <<
" no optimization" << endl;
3793 if( fast==1 ) cout <<
" weight optimization" << endl;
3794 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3796 fputs(
"spectrumCompute\n",stdout );
3797 if( fast==0 ) fputs(
" no optimization\n", stdout );
3798 if( fast==1 ) fputs(
" weight optimization\n", stdout );
3799 if( fast==2 ) fputs(
" symmetry optimization\n", stdout );
3843 #ifdef SPECTRUM_DEBUG
3844 #ifdef SPECTRUM_PRINT
3845 #ifdef SPECTRUM_IOSTREAM
3846 cout <<
"\n computing the Jacobi ideal...\n";
3848 fputs(
"\n computing the Jacobi ideal...\n",stdout );
3857 #ifdef SPECTRUM_DEBUG
3858 #ifdef SPECTRUM_PRINT
3859 #ifdef SPECTRUM_IOSTREAM
3862 fputs(
" ", stdout );
3873 #ifdef SPECTRUM_DEBUG
3874 #ifdef SPECTRUM_PRINT
3875 #ifdef SPECTRUM_IOSTREAM
3877 cout <<
" computing a standard basis..." << endl;
3879 fputs(
"\n", stdout );
3880 fputs(
" computing a standard basis...\n", stdout );
3888 #ifdef SPECTRUM_DEBUG
3889 #ifdef SPECTRUM_PRINT
3892 #ifdef SPECTRUM_IOSTREAM
3895 fputs(
" ",stdout );
3940 #ifdef SPECTRUM_DEBUG
3941 #ifdef SPECTRUM_PRINT
3942 #ifdef SPECTRUM_IOSTREAM
3943 cout <<
"\n computing the highest corner...\n";
3945 fputs(
"\n computing the highest corner...\n", stdout );
3950 poly hc = (poly)
NULL;
3954 if( hc!=(poly)
NULL )
3969 #ifdef SPECTRUM_DEBUG
3970 #ifdef SPECTRUM_PRINT
3971 #ifdef SPECTRUM_IOSTREAM
3974 fputs(
" ", stdout );
3984 #ifdef SPECTRUM_DEBUG
3985 #ifdef SPECTRUM_PRINT
3986 #ifdef SPECTRUM_IOSTREAM
3987 cout <<
"\n computing the newton polygon...\n";
3989 fputs(
"\n computing the newton polygon...\n", stdout );
3996 #ifdef SPECTRUM_DEBUG
3997 #ifdef SPECTRUM_PRINT
4006 #ifdef SPECTRUM_DEBUG
4007 #ifdef SPECTRUM_PRINT
4008 #ifdef SPECTRUM_IOSTREAM
4009 cout <<
"\n computing the weight corner...\n";
4011 fputs(
"\n computing the weight corner...\n", stdout );
4016 poly wc = ( fast==0 ?
pCopy( hc ) :
4021 #ifdef SPECTRUM_DEBUG
4022 #ifdef SPECTRUM_PRINT
4023 #ifdef SPECTRUM_IOSTREAM
4026 fputs(
" ", stdout );
4036 #ifdef SPECTRUM_DEBUG
4037 #ifdef SPECTRUM_PRINT
4038 #ifdef SPECTRUM_IOSTREAM
4039 cout <<
"\n computing NF...\n" << endl;
4041 fputs(
"\n computing NF...\n", stdout );
4050 #ifdef SPECTRUM_DEBUG
4051 #ifdef SPECTRUM_PRINT
4053 #ifdef SPECTRUM_IOSTREAM
4056 fputs(
"\n", stdout );
4081 WerrorS(
"polynomial is zero" );
4084 WerrorS(
"polynomial has constant term" );
4087 WerrorS(
"not a singularity" );
4090 WerrorS(
"the singularity is not isolated" );
4093 WerrorS(
"highest corner cannot be computed" );
4096 WerrorS(
"principal part is degenerate" );
4102 WerrorS(
"unknown error occurred" );
4119 WerrorS(
"only works for local orderings" );
4127 WerrorS(
"does not work in quotient rings" );
4173 WerrorS(
"only works for local orderings" );
4178 WerrorS(
"does not work in quotient rings" );
4237 else if(
l->nr > 5 )
4275 int mu = (int)(
long)(
l->m[0].Data( ));
4276 int pg = (int)(
long)(
l->m[1].Data( ));
4277 int n = (int)(
long)(
l->m[2].Data( ));
4288 if( n !=
num->length( ) )
4292 else if( n !=
den->length( ) )
4296 else if( n != mul->
length( ) )
4316 for(
i=0;
i<n;
i++ )
4318 if( (*
num)[
i] <= 0 )
4322 if( (*
den)[
i] <= 0 )
4326 if( (*mul)[
i] <= 0 )
4338 for(
i=0,
j=n-1;
i<=
j;
i++,
j-- )
4341 (*den)[
i] != (*den)[
j] ||
4342 (*mul)[
i] != (*mul)[
j] )
4352 for(
i=0,
j=1;
i<n/2;
i++,
j++ )
4354 if( (*
num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
4364 for(
mu=0,
i=0;
i<n;
i++ )
4369 if(
mu != (
int)(long)(
l->m[0].Data( )) )
4378 for( pg=0,
i=0;
i<n;
i++ )
4380 if( (*
num)[
i]<=(*den)[
i] )
4386 if( pg != (
int)(long)(
l->m[1].Data( )) )
4415 WerrorS(
"first argument is not a spectrum:" );
4420 WerrorS(
"second argument is not a spectrum:" );
4453 int k = (int)(
long)second->
Data( );
4457 WerrorS(
"first argument is not a spectrum" );
4462 WerrorS(
"second argument should be positive" );
4488 BOOLEAN qh=(((int)(
long)
w->Data())==1);
4499 WerrorS(
"first argument is not a spectrum" );
4504 WerrorS(
"second argument is not a spectrum" );
4528 memset(&tmp,0,
sizeof(tmp));
4547 WerrorS(
"Ground field not implemented!");
4567 LP->
m= (int)(
long)(
v->Data());
4573 LP->
n= (int)(
long)(
v->Data());
4579 LP->
m1= (int)(
long)(
v->Data());
4585 LP->
m2= (int)(
long)(
v->Data());
4591 LP->
m3= (int)(
long)(
v->Data());
4593 #ifdef mprDEBUG_PROT
4594 Print(
"m (constraints) %d\n",LP->
m);
4595 Print(
"n (columns) %d\n",LP->
n);
4619 lres->
m[4].
data=(
void*)(
long)LP->
m;
4622 lres->
m[5].
data=(
void*)(
long)LP->
n;
4624 res->data= (
void*)lres;
4631 ideal gls = (ideal)(arg1->
Data());
4632 int imtype= (int)(
long)arg2->
Data();
4656 gls= (poly)(arg1->
Data());
4657 int howclean= (int)(
long)arg3->
Data();
4664 WerrorS(
"Ground field not implemented!");
4671 unsigned long int ii = (
unsigned long int)arg2->
Data();
4677 WerrorS(
"Input polynomial is constant!");
4703 if ( (vpos !=
i) && (
pGetExp( piter,
i ) != 0) )
4705 WerrorS(
"The input polynomial must be univariate!");
4713 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4715 for (
i= deg;
i >= 0;
i-- )
4729 #ifdef mprDEBUG_PROT
4730 for (
i=deg;
i >= 0;
i--)
4738 roots->
solver( howclean );
4745 rlist->
Init( elem );
4749 for (
j= 0;
j < elem;
j++ )
4758 for (
j= 0;
j < elem;
j++ )
4762 rlist->
m[
j].
data=(
void *)dummy;
4776 res->data= (
void*)rlist;
4785 p= (ideal)arg1->
Data();
4786 w= (ideal)arg2->
Data();
4797 int tdg= (int)(
long)arg3->
Data();
4804 WerrorS(
"Last input parameter must be > 0!");
4812 if (
m != (
int)
pow((
double)tdg+1,(
double)n) )
4814 Werror(
"Size of second input ideal must be equal to %d!",
4815 (
int)
pow((
double)tdg+1,(
double)n));
4822 WerrorS(
"Ground field not implemented!");
4827 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4828 for (
i= 0;
i < n;
i++ )
4837 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4846 WerrorS(
"Elements of first input ideal must be numbers!");
4849 pevpoint[
i]=
nCopy( tmp );
4853 number *wresults= (number *)
omAlloc(
m *
sizeof( number ) );
4854 for (
i= 0;
i <
m;
i++ )
4863 WerrorS(
"Elements of second input ideal must be numbers!");
4878 res->data= (
void*)rpoly;
4893 else gls= (ideal)(
v->Data());
4899 else imtype= (int)(
long)
v->Data();
4904 ideal test_id=
idInit(1,1);
4908 if (gls->m[
j]!=
NULL)
4910 test_id->m[0]=gls->m[
j];
4914 WerrorS(
"Newton polytope not of expected dimension");
4928 unsigned long int ii=(
unsigned long int)
v->Data();
4936 else howclean= (int)(
long)
v->Data();
4965 WerrorS(
"Error occurred during matrix setup!");
4973 #ifdef mprDEBUG_PROT
4978 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4984 if ( interpolate_det )
4990 if ( interpolate_det )
4995 #ifdef mprDEBUG_PROT
4997 for (
i=0;
i < c;
i++)
pWrite(iproots[
i]->getPoly());
4999 for (
i=0;
i < c;
i++)
pWrite(muiproots[
i]->getPoly());
5003 arranger=
new rootArranger( iproots, muiproots, howclean );
5014 WerrorS(
"Solver was unable to find any roots!");
5020 for (
i=0;
i <
count;
i++)
delete iproots[
i];
5023 for (
i=0;
i <
count;
i++)
delete muiproots[
i];
5030 res->data= (
void *)listofroots;
5042 int count=
self->roots[0]->getAnzRoots();
5043 int elem=
self->roots[0]->getAnzElems();
5047 if ( self->found_roots )
5054 onepoint->
Init(elem);
5055 for (
j= 0;
j < elem;
j++ )
5071 listofroots->
m[
i].
data=(
void *)onepoint;
5079 listofroots->
Init( 0 );
5093 if (rg==
NULL)
return;
5118 Warn(
"deleting denom_list for ring change to %s",
IDID(
h));
5132 if ((rg!=
NULL) && (rg->idroot==
NULL))
5160 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5165 (*iv)[
i]= - (*iv)[
i];
5174 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5179 (*iv)[
i]= -(*iv)[
i];
5188 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5194 (*iv2)[2]=iv->
length()-2;
5206 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5212 (*iv2)[2]=iv->
length()-2;
5246 (*iv)[2] += (*iv2)[2];
5253 if (!change)
h=
h->next;
5261 int last = 0, o=0, n = 1,
i=0, typ = 1,
j;
5273 R->bitmask=(*iv)[2]*2+1;
5286 WerrorS(
"invalid combination of orderings");
5294 WerrorS(
"more than one ordering c/C specified");
5300 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
5301 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
5304 int *weights=(
int*)
omAlloc0((
R->N+1)*
sizeof(int));
5307 for (
j=0;
j < n-1;
j++)
5338 R->block0[n] =
last+1;
5341 R->wvhdl[n][
i-2] = (*iv)[
i];
5343 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5356 R->block0[n] =
last+1;
5358 else last += (*iv)[0];
5363 if (weights[
i]==0) weights[
i]=typ;
5375 const int s = (*iv)[2];
5385 const int s = (*iv)[2];
5387 if( 1 <
s ||
s < -1 )
return TRUE;
5403 R->block0[n] =
last+1;
5408 R->wvhdl[n][
i-2]=(*iv)[
i];
5410 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5412 last=
R->block0[n]-1;
5417 R->block0[n] =
last+1;
5420 if (
R->block1[n]-
R->block0[n]+2>=iv->
length())
5421 WarnS(
"missing module weights");
5422 for (
i=2;
i<=(
R->block1[n]-
R->block0[n]+2);
i++)
5424 R->wvhdl[n][
i-2]=(*iv)[
i];
5426 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5428 R->wvhdl[n][
i-2]=iv->
length() -3 -(
R->block1[n]-
R->block0[n]);
5431 R->wvhdl[n][
i-1]=(*iv)[
i];
5433 last=
R->block0[n]-1;
5438 R->block0[n] =
last+1;
5446 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5448 last=
R->block0[n]-1;
5454 if (Mtyp==0)
return TRUE;
5455 if (Mtyp==-1) typ = -1;
5459 R->wvhdl[n][
i-2]=(*iv)[
i];
5461 R->block0[n] =
last+1;
5464 for(
i=
R->block1[n];
i>=
R->block0[n];
i--)
5466 if (weights[
i]==0) weights[
i]=typ;
5476 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5483 Werror(
"mismatch of number of vars (%d) and ordering (>=%d vars)",
5491 for(
i=1;
i<=
R->N;
i++)
5492 {
if (weights[
i]<0) {
R->OrdSgn=-1;
break; }}
5506 if (
R->block1[n] !=
R->N)
5517 R->block0[n] <=
R->N)
5519 R->block1[n] =
R->N;
5523 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5542 *
p = (
char*)sl->
name;
5610 WerrorS(
"parameter expected");
5617 for(
int i=pars-1;
i>=0;
i--)
5629 int ch = (int)(
long)pn->
Data();
5640 if ((ch<2)||(ch!=ch2))
5642 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5645 #ifndef TEST_ZN_AS_ZP
5649 mpz_init_set_ui(modBase, (
long)ch);
5656 cf->has_simple_Inverse=1;
5669 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5681 if ((ch!=0) && (ch!=
IsPrime(ch)))
5683 WerrorS(
"too many parameters");
5691 WerrorS(
"parameter expected");
5697 extParam.
r =
rDefault( ch, pars, names);
5698 for(
int i=pars-1;
i>=0;
i--)
5711 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5714 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5717 float_len=(int)(
long)pnn->
Data();
5718 float_len2=float_len;
5722 float_len2=(int)(
long)pnn->
Data();
5757 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5761 unsigned int modExponent = 1;
5762 mpz_init_set_si(modBase, 0);
5769 mpz_set_ui(modBase, (
long) pnn->
Data());
5773 modExponent = (long) pnn->
Data();
5778 mpz_mul_ui(modBase, modBase, (
int)(
long) pnn->
Data());
5791 if ((mpz_cmp_ui(modBase, 1) == 0) && (
mpz_sgn1(modBase) < 0))
5793 WerrorS(
"Wrong ground ring specification (module is 1)");
5796 if (modExponent < 1)
5798 WerrorS(
"Wrong ground ring specification (exponent smaller than 1");
5803 if (modExponent > 1 &&
cf ==
NULL)
5805 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5816 WerrorS(
"modulus must not be 0 or parameter not allowed");
5822 info.exp= modExponent;
5831 WerrorS(
"modulus must not be 0 or parameter not allowed");
5837 info.exp= modExponent;
5848 extParam.
r = (ring)pn->
Data();
5860 WerrorS(
"Wrong or unknown ground field specification");
5866 Print(
"pn[%p]: type: %d [%s]: %p, name: %s", (
void*)
p,
p->Typ(),
Tok2Cmdname(
p->Typ()),
p->Data(), (
p->name ==
NULL?
"NULL" :
p->name) );
5888 WerrorS(
"Invalid ground field specification");
5912 WerrorS(
"name of ring variable expected");
5965 int *perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(int));
5982 WerrorS(
"name of ring variable expected");
5992 for(;
i<org_ring->N;
i++)
5994 if (strcmp(org_ring->names[
i],
R->names[
j])==0)
6002 Werror(
"variable %d (%s) not in basering",
j+1,
R->names[
j]);
6015 for(
j=
R->block0[
i];j<=R->block1[
i];
j++)
6019 if (min_var==-1) min_var=perm[
j];
6027 R->block0[
i]=min_var;
6028 R->block1[
i]=max_var;
6032 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(int));
6033 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
6037 R->wvhdl[
i][perm[
j]-
R->block0[
i]]=
6038 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
6064 R->order[
j-1]=
R->order[
j];
6065 R->block0[
j-1]=
R->block0[
j];
6066 R->block1[
j-1]=
R->block1[
j];
6068 R->wvhdl[
j-1]=
R->wvhdl[
j];
6076 while (
R->order[n]==0) n--;
6079 if (
R->block1[n] !=
R->N)
6090 R->block0[n] <=
R->N)
6092 R->block1[n] =
R->N;
6096 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
6097 R->N,
R->block1[n],n);
6103 R->OrdSgn = org_ring->OrdSgn;
6126 if ((r->ref<=0)&&(r->order!=
NULL))
6136 if (
j==0)
WarnS(
"killing the basering for level 0");
6141 while (r->idroot!=
NULL)
6144 killhdl2(r->idroot,&(r->idroot),r);
6191 Warn(
"deleting denom_list for ring change from %s",
IDID(
h));
6256 resid=(ideal)(
res.data);
6265 while ((
h!=
NULL) &&(
h->next!=new_ring))
h=
h->next;
6266 if (
h!=
NULL)
h->next=
h->next->next;
6309 ideal I=(ideal)u->
Data();
6312 for(
i=I->nrows*I->ncols-1;
i>=0;
i--)
6324 switch (
p->language)
6333 if(
p->libname!=
NULL)
6334 Print(
",%s",
p->libname);
6347 memset(&tmp_in,0,
sizeof(tmp_in));
6349 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6357 Werror(
"apply fails at index %d",
i+1);
6360 if (
i==0) { memcpy(
res,&tmp_out,
sizeof(tmp_out)); }
6365 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6387 for(
int i=0;
i<=aa->
nr;
i++)
6389 memset(&tmp_in,0,
sizeof(tmp_in));
6390 tmp_in.
Copy(&(aa->
m[
i]));
6399 Werror(
"apply fails at index %d",
i+1);
6402 if (
i==0) { memcpy(
res,&tmp_out,
sizeof(tmp_out)); }
6407 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6430 WerrorS(
"first argument to `apply` must allow an index");
6440 char assume_yylinebuf[80];
6442 int lev=(long)a->
Data();
6449 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6451 if (
b->Data()==
NULL) {
Werror(
"ASSUME failed:%s",assume_yylinebuf);
return TRUE;}
6463 char *ss=(
char*)
omAlloc(strlen(a)+strlen(
s)+30);
6465 int end_s=strlen(
s);
6466 while ((end_s>0) && ((
s[end_s]<=
' ')||(
s[end_s]==
';'))) end_s--;
6469 sprintf(
name,
"%s->%s",a,
s);
6471 int start_s=end_s-1;
6472 while ((start_s>=0) && (
s[start_s]!=
';')) start_s--;
6475 sprintf(ss,
"parameter def %s;return(%s);\n",a,
s);
6480 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,
s,
s+start_s+1);
6482 memset(r,0,
sizeof(*r));
6502 memset(&tmp,0,
sizeof(tmp));
6520 memset(&n,0,
sizeof(n));
6538 sprintf(
buf,
"wrong length of parameters(%d), expected ",t);
6540 sprintf(
buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6541 for(
int i=1;
i<=
T[0];
i++)
6546 if (
i<
T[0]) strcat(
buf,
",");
6556 if (type_list[0]==0)
return TRUE;
6559 if (
l!=(
int)type_list[0])
6564 for(
int i=1;
i<=
l;
i++,args=args->
next)
6566 short t=type_list[
i];
6570 || (t!=args->
Typ()))
Rational pow(const Rational &a, int e)
struct for passing initialization parameters to naInitChar
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
void atSet(idhdl root, char *name, void *data, int typ)
static int si_max(const int a, const int b)
static int si_min(const int a, const int b)
for(int i=0;i<=n;i++) degsf[i]
void mu(int **points, int sizePoints)
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
unsigned char * proc[NUM_PROC]
poly singclap_resultant(poly f, poly g, poly x, const ring r)
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
matrix singclap_irrCharSeries(ideal I, const ring r)
idhdl get(const char *s, int lev)
virtual number getSubDet()
virtual ideal getMatrix()
virtual IStateType initState() const
complex root finder for univariate polynomials based on laguers algorithm
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
gmp_complex * getRoot(const int i)
bool solver(const int polishmode=PM_NONE)
Linear Programming / Linear Optimization using Simplex - Algorithm.
BOOLEAN mapFromMatrix(matrix m)
matrix mapToMatrix(matrix m)
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
void Clean(ring r=currRing)
INLINE_THIS void Init(int l=0)
void delete_node(spectrumPolyNode **)
int mult_spectrum(spectrum &)
int mult_spectrumh(spectrum &)
Base class for solving 0-dim poly systems using u-resultant.
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
resMatrixBase * accessResMat()
vandermonde system solver for interpolating polynomials from their values
poly numvec2poly(const number *q)
number * interpolateDense(const number *q)
Solves the Vandermode linear system \sum_{i=1}^{n} x_i^k-1 w_i = q_k, k=1,..,n.
Coefficient rings, fields and other domains suitable for Singular polynomials.
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 ....
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
static FORCE_INLINE char * nCoeffName(const coeffs cf)
@ n_R
single prescision (6,6) real numbers
@ 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_long_R
real floating point (GMP) numbers
@ n_Z2m
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...
@ n_Z
only used if HAVE_RINGS is defined
@ n_long_C
complex floating point (GMP) numbers
short float_len2
additional char-flags, rInit
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
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 FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
const char * par_name
parameter name
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
const unsigned short fftable[]
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
short float_len
additional char-flags, rInit
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Creation data needed for finite fields.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
const ExtensionInfo & info
< [in] sqrfree poly
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
char name(const Variable &v)
void WerrorS(const char *s)
VAR char my_yylinebuf[80]
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
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...
const char * Tok2Cmdname(int tok)
int iiTestConvert(int inputType, int outputType)
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
void hKill(monf xmem, int Nvar)
void hDelete(scfmon ev, int ev_length)
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
void hRadical(scfmon rad, int *Nrad, int Nvar)
#define idDelete(H)
delete an ideal
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
static BOOLEAN idIsZeroDim(ideal i)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
STATIC_VAR int * multiplicity
static BOOLEAN length(leftv result, leftv arg)
#define IMATELEM(M, I, J)
intvec * ivCopy(const intvec *o)
int IsCmd(const char *n, int &tok)
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
idhdl ggetid(const char *n)
void killhdl2(idhdl h, idhdl *ih, ring r)
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
VAR proclevel * procstack
idhdl packFindHdl(package r)
EXTERN_VAR omBin sleftv_bin
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
INST_VAR sleftv iiRETURNEXPR
char * iiGetLibProcBuffer(procinfo *pi, int part)
lists rDecompose(const ring r)
@ semicListWrongNumberOfNumerators
@ semicListFirstElementWrongType
@ semicListSecondElementWrongType
@ semicListFourthElementWrongType
@ semicListWrongNumberOfDenominators
@ semicListThirdElementWrongType
@ semicListWrongNumberOfMultiplicities
@ semicListFifthElementWrongType
@ semicListSixthElementWrongType
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
lists rDecompose_list_cf(const ring r)
int iiOpsTwoChar(const char *s)
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
BOOLEAN jjMINRES(leftv res, leftv v)
BOOLEAN killlocals_list(int v, lists L)
BOOLEAN iiParameter(leftv p)
STATIC_VAR BOOLEAN iiNoKeepRing
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
static void rRenameVars(ring R)
void iiCheckPack(package &p)
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 iiApply(leftv res, leftv a, int op, leftv proc)
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
VAR BOOLEAN iiDebugMarker
ring rInit(leftv pn, leftv rv, leftv ord)
leftv iiMap(map theMap, const char *what)
int iiRegularity(lists L)
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...
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
static void rDecomposeC_41(leftv h, const coeffs C)
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
BOOLEAN iiARROW(leftv r, char *a, char *s)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
BOOLEAN syBetti1(leftv res, leftv u)
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
idhdl rDefault(const char *s)
static void rDecomposeC(leftv h, const ring R)
int exprlist_length(leftv v)
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
poly iiHighCorner(ideal I, int ak)
BOOLEAN spectrumfProc(leftv result, leftv first)
lists listOfRoots(rootArranger *self, const unsigned int oprec)
static void jjINT_S_TO_ID(int n, int *e, leftv res)
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
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...
BOOLEAN jjCHARSERIES(leftv res, leftv u)
void rDecomposeCF(leftv h, const ring r, const ring R)
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
void list_error(semicState state)
BOOLEAN mpJacobi(leftv res, leftv a)
ideal kGroebner(ideal F, ideal Q)
BOOLEAN iiBranchTo(leftv, leftv args)
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
BOOLEAN iiTestAssume(leftv a, leftv b)
BOOLEAN iiAssignCR(leftv r, leftv arg)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
spectrumState spectrumCompute(poly h, lists *L, int fast)
idhdl rFindHdl(ring r, idhdl n)
syStrategy syConvList(lists li)
BOOLEAN spectrumProc(leftv result, leftv first)
BOOLEAN iiDefaultParameter(leftv p)
void rComposeC(lists L, ring R)
BOOLEAN iiCheckRing(int i)
#define BREAK_LINE_LENGTH
spectrumState spectrumStateFromList(spectrumPolyList &speclist, lists *L, int fast)
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
ring rSubring(ring org_ring, sleftv *rv)
BOOLEAN kWeight(leftv res, leftv id)
static leftv rOptimizeOrdAsSleftv(leftv ord)
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
spectrum spectrumFromList(lists l)
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
syStrategy syForceMin(lists li)
static void iiReportTypes(int nr, int t, const short *T)
void rDecomposeRing(leftv h, const ring R)
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
static BOOLEAN iiInternalExport(leftv v, int toLev)
void copy_deep(spectrum &spec, lists l)
void killlocals_rec(idhdl *root, int v, ring r)
BOOLEAN nuMPResMat(leftv res, leftv arg1, leftv arg2)
returns module representing the multipolynomial resultant matrix Arguments 2: ideal i,...
semicState list_is_spectrum(lists l)
static void killlocals0(int v, idhdl *localhdl, const ring r)
BOOLEAN semicProc(leftv res, leftv u, leftv v)
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
const char * lastreserved
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
BOOLEAN iiWRITE(leftv, leftv v)
void paPrint(const char *n, package p)
static resolvente iiCopyRes(resolvente r, int l)
const char * iiTwoOps(int t)
BOOLEAN kQHWeight(leftv res, leftv v)
void rComposeRing(lists L, ring R)
BOOLEAN iiExport(leftv v, int toLev)
BOOLEAN jjBETTI(leftv res, leftv u)
void spectrumPrintError(spectrumState state)
lists getList(spectrum &spec)
BOOLEAN nuUResSolve(leftv res, leftv args)
solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing-...
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
void rDecomposeRing_41(leftv h, const coeffs C)
static BOOLEAN rComposeVar(const lists L, ring R)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
VAR denominator_list DENOMINATOR_LIST
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,...
BOOLEAN lRingDependend(lists L)
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
char * lString(lists l, BOOLEAN typed, int dim)
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
number nlMapGMP(number from, const coeffs src, const coeffs dst)
void nlGMP(number &i, mpz_t n, const coeffs r)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
matrix mpNew(int r, int c)
create a r x c zero-matrix
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
#define MATELEM(mat, i, j)
1-based access to matrix
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
ideal loNewtonPolytope(const ideal id)
EXTERN_VAR size_t gmp_output_digits
uResultant::resMatType determineMType(int imtype)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
gmp_float sqrt(const gmp_float &a)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
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...
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nPrint(a)
only for debug, over any initalized currRing
#define SHORT_REAL_LENGTH
#define omFreeSize(addr, size)
#define omCheckAddr(addr)
#define omReallocSize(addr, o_size, size)
#define omCheckAddrSize(addr, size)
#define omFreeBin(addr, bin)
#define omRealloc0Size(addr, o_size, size)
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)
#define __pp_Mult_nn(p, n, r)
static unsigned pLength(poly a)
static poly p_Init(const ring r, omBin bin)
static long p_Totaldegree(poly p, const ring r)
#define __p_Mult_nn(p, n, r)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatiblity layer for legacy polynomial operations (over currRing)
static long pTotaldegree(poly p)
#define pIsConstant(p)
like above, except that Comp must be 0
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
#define pGetVariables(p, e)
#define pGetExp(p, i)
Exponent.
void pNorm(poly p, const ring R=currRing)
#define pCopy(p)
return a copy of the poly
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
void PrintS(const char *s)
void Werror(const char *fmt,...)
const char * rSimpleOrdStr(int ord)
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 rTypeOfMatrixOrder(const intvec *order)
ring rAssure_HasComp(const ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
BOOLEAN rCheckIV(const intvec *iv)
rRingOrder_t rOrderName(char *ordername)
void rDelete(ring r)
unconditionally deletes fields in r
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
void rSetSyzComp(int k, const ring r)
static BOOLEAN rField_is_Ring(const ring r)
static BOOLEAN rField_is_R(const ring r)
static int rBlocks(ring r)
static BOOLEAN rField_is_Zp_a(const ring r)
static BOOLEAN rField_is_Z(const ring r)
static BOOLEAN rField_is_Zp(const ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rField_is_long_C(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
static BOOLEAN rField_is_Zn(const ring r)
static int rPar(const ring r)
(r->cf->P)
static int rInternalChar(const ring r)
@ ringorder_a64
for int64 weights
@ ringorder_rs
opposite of ls
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_IS
Induced (Schreyer) ordering.
static BOOLEAN rField_is_Q_a(const ring r)
static BOOLEAN rField_is_Q(const ring r)
static BOOLEAN rField_is_long_R(const ring r)
static BOOLEAN rField_is_numeric(const ring r)
static BOOLEAN rField_is_GF(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
int status int void size_t count
int status int void * buf
BOOLEAN slWrite(si_link l, leftv v)
ideal idInit(int idsize, int rank)
initialise an ideal / module
intvec * id_QHomWeight(ideal id, const ring r)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
BOOLEAN hasAxis(ideal J, int k, const ring r)
int hasOne(ideal J, const ring r)
BOOLEAN ringIsLocal(const ring r)
poly computeWC(const newtonPolygon &np, Rational max_weight, const ring r)
void computeNF(ideal stdJ, poly hc, poly wc, spectrumPolyList *NF, const ring r)
BOOLEAN hasLinearTerm(poly h, const ring r)
BOOLEAN hasConstTerm(poly h, const ring r)
INST_VAR sleftv sLastPrinted
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
void syMinimizeResolvente(resolvente res, int length, int first)
void syKillComputation(syStrategy syzstr, ring r=currRing)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
void syKillEmptyEntres(resolvente res, int length)
struct for passing initialization parameters to naInitChar
THREAD_VAR double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)