12 #include <factory/factory.h>
116 case LE:
return "<=";
117 case GE:
return ">=";
126 if (s[1]==
'\0')
return s[0];
127 else if (s[2]!=
'\0')
return 0;
130 case '.':
if (s[1]==
'.')
return DOTDOT;
136 case '+':
if (s[1]==
'+')
return PLUSPLUS;
140 case '<':
if (s[1]==
'=')
return LE;
141 else if (s[1]==
'>')
return NOTEQUAL;
143 case '>':
if (s[1]==
'=')
return GE;
145 case '!':
if (s[1]==
'=')
return NOTEQUAL;
157 if(fullname) sprintf(buf2,
"%s::%s",
"",
IDID(h));
158 else sprintf(buf2,
"%s",
IDID(h));
195 && (strlen(
IDPROC(h)->libname)>0))
206 if ((s=strchr(buffer,
'\n'))!=
NULL)
212 if((s!=
NULL) ||(l>20))
214 Print(
"..., %d char(s)",l);
231 { number2
n=(number2)
IDDATA(h);
237 Print(
" %d x %d (%s)",
372 && (((ring)d)->idroot!=
NULL))
424 package savePack=currPack;
431 if (strcmp(what,
"all")==0)
443 if (iterate)
list1(prefix,h,
TRUE,fullname);
467 Werror(
"%s is undefined",what);
500 package save_p=currPack;
534 Warn(
"Gerhard, use the option command");
605 unsigned end_p=(unsigned)
sqrt((
double)
p);
607 for (i=0; i<end_i; i++)
616 if (j > end_p)
return p;
635 if (p == 0)
return 0;
636 else if (p == 1)
return 1;
637 else if ((p == 2)||(p==3))
return p;
638 else if (p < 0)
return 2;
639 else if ((p & 1)==0)
return iiIsPrime0((
unsigned)(p-1));
654 WerrorS(
"write: need at least two arguments");
662 if ((l!=
NULL)&&(l->name!=
NULL)) s=l->name;
664 Werror(
"cannot write to %s",s);
691 Werror(
"can not map from ground field of %s to current ground field",
695 if (
IDELEMS(theMap)<src_ring->N)
699 (src_ring->N)*
sizeof(
poly));
700 for(i=
IDELEMS(theMap);i<src_ring->N;i++)
706 WerrorS(
"argument of a map must have a name");
713 memset(&tmpW,0,
sizeof(
sleftv));
718 save_r=
IDMAP(w)->preimage;
719 IDMAP(w)->preimage=0;
729 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
731 if (theMap->m[
j]!=
NULL)
734 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
749 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
751 if (theMap->m[
j]!=
NULL)
765 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
791 if (save_r!=
NULL)
IDMAP(w)->preimage=save_r;
797 IDMAP(w)->preimage=save_r;
805 Werror(
"%s undefined in %s",what,theMap->preimage);
810 Werror(
"cannot find preimage %s",theMap->preimage);
822 char *
s=(
char *)
omAlloc(strlen(name)+5);
826 sprintf(s,
"%s(%d)",name,i+1);
836 Print(
"//defining: %s as %d-th syzygy module\n",s,i+1);
841 Warn(
"cannot define %s",s);
921 int add_row_shift = 0;
924 if (weights!=
NULL) add_row_shift=weights->
min_in();
939 memset(&tmp,0,
sizeof(tmp));
959 memset(&tmp2,0,
sizeof(tmp2));
983 add_row_shift = ww->
min_in();
984 (*weights) -= add_row_shift;
993 if (weights!=
NULL)
delete weights;
1006 int add_row_shift=0;
1011 add_row_shift = ww->
min_in();
1012 (*weights) -= add_row_shift;
1017 if (weights!=
NULL)
delete weights;
1020 return reg+1+add_row_shift;
1024 #define BREAK_LINE_LENGTH 80
1030 iiDebugMarker=
FALSE;
1048 else if(strncmp(s,
"cont;",5)==0)
1055 strcat( s,
"\n;~\n");
1126 res->
m[
i].
data = (
void *)save->set;
1136 for (i=hMu;i<hMu+
hMu2;i++)
1138 res->
m[
i].
data = (
void *)save->set;
1163 const char *
id = name->
name;
1165 memset(sy,0,
sizeof(
sleftv));
1168 WerrorS(
"object to declare is not a name");
1205 if (iiCurrProc!=
NULL)
1210 memset(&tmp,0,
sizeof(
sleftv));
1222 if (ll!=(l-1))
return FALSE;
1224 short *t=(
short*)
omAlloc(l*
sizeof(
short));
1228 for(i=1;i<
l;i++,h=h->
next)
1233 Werror(
"arg %d is not a string",i);
1237 b=
IsCmd((
char *)h->Data(),tt);
1242 Werror(
"arg %d is not a type name",i);
1249 Werror(
"last arg (%d) is not a proc",i);
1254 if (b && (h->rtyp==
IDHDL) && (h->e==
NULL))
1260 if(
pi->data.s.body==
NULL )
1274 if (iiCurrArgs!=
NULL)
1276 if (!err)
Warn(
"too many arguments for %s",
IDID(iiCurrProc));
1287 if (iiCurrArgs==
NULL)
1289 if (strcmp(p->
name,
"#")==0)
1298 if (strcmp(p->
name,
"#")==0)
1300 is_default_list=
TRUE;
1308 if (is_default_list)
1322 if (iiCurrArgs==
NULL)
1432 #ifdef USE_IILOCALRING
1452 if (keepring)
IDRING(h)->ref--;
1464 Warn(
"'%s': no such identifier\n", v->
name);
1467 package frompack=v->req_packhdl;
1482 if (h==frompack->idroot)
1484 frompack->idroot=h->
next;
1488 idhdl hh=frompack->idroot;
1489 while ((hh!=
NULL) && (hh->
next!=h))
1499 h->
next=rootpack->idroot;
1639 WarnS(
"package not found\n");
1672 r->order = (
int *)
omAlloc(3 *
sizeof(
int *));
1673 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1674 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1693 if (h!=
NULL)
return h;
1695 if (h!=
NULL)
return h;
1702 if (h!=
NULL)
return h;
1710 if (h!=
NULL)
return h;
1729 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1735 for(i=0; i<r->N; i++)
1741 L->
m[1].
data=(
void *)LL;
1758 if (r->block1[i]-r->block0[i] >=0 )
1760 j=r->block1[
i]-r->block0[
i];
1763 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1765 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][
j];
1767 else switch (r->order[i])
1774 for(;j>=0; j--) (*iv)[
j]=1;
1784 LLL->
m[1].
data=(
void *)iv;
1785 LL->
m[
i].
data=(
void *)LLL;
1788 L->
m[2].
data=(
void *)LL;
1798 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1799 L->
m[3].
data=(
void *)q;
1818 L->
m[0].
data=(
void *)0;
1828 L->
m[1].
data=(
void *)LL;
1860 LL->
m[0].
data=
nlMapGMP((number) R->cf->modBase, R->cf, R->cf);
1862 LL->
m[1].
data=(
void *) R->cf->modExponent;
1864 L->
m[1].
data=(
void *)LL;
1878 || (r->qideal !=
NULL)
1885 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1905 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
1917 else if ( r->cf->extRing!=
NULL )
1927 Lc->
m[0].
data=(
void*)(
long)r->cf->m_nfCharQ;
1934 Lc->
m[1].
data=(
void*)Lv;
1945 Loo->
m[1].
data=(
void *)iv;
1948 Lo->
m[0].
data=(
void*)Loo;
1951 Lc->
m[2].
data=(
void*)Lo;
1957 L->
m[0].
data=(
void*)Lc;
1962 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1970 for(i=0; i<r->N; i++)
1976 L->
m[1].
data=(
void *)LL;
1996 assume( r->block0[i] == r->block1[i] );
1997 const int s = r->block0[
i];
1998 assume( -2 < s && s < 2);
2003 else if (r->block1[i]-r->block0[i] >=0 )
2005 int bl=j=r->block1[
i]-r->block0[
i];
2013 j+=r->wvhdl[
i][bl+1];
2016 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
2018 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
2020 else switch (r->order[i])
2027 for(;j>=0; j--) (*iv)[
j]=1;
2037 LLL->
m[1].
data=(
void *)iv;
2038 LL->
m[
i].
data=(
void *)LLL;
2041 L->
m[2].
data=(
void *)LL;
2045 if (r->qideal==
NULL)
2050 #ifdef HAVE_PLURAL // NC! in rDecompose
2069 Werror(
"invald coeff. field description, expecting 0");
2076 Werror(
"invald coeff. field description, expecting precision list");
2078 int r1=(
int)(long)LL->
m[0].
data;
2079 int r2=(
int)(long)LL->
m[1].
data;
2101 R->cf->float_len=
si_min(r1,32767);
2102 R->cf->float_len2=
si_min(r2,32767);
2111 Werror(
"invald coeff. field description, expecting parameter name");
2127 mpz_ptr modBase =
NULL;
2128 unsigned int modExponent = 1;
2130 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
2133 mpz_init_set_ui(modBase,0);
2144 number tmp= (number) LL->
m[0].
data;
2150 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2154 mpz_init_set_ui(modBase,0);
2158 modExponent = (
unsigned long) LL->
m[1].
data;
2166 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
2168 Werror(
"Wrong ground ring specification (module is 1)");
2171 if (modExponent < 1)
2173 Werror(
"Wrong ground ring specification (exponent smaller than 1");
2177 if (mpz_cmp_ui(modBase, 0) == 0)
2182 else if (modExponent > 1)
2185 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2197 info.
exp= modExponent;
2208 info.
exp= modExponent;
2221 for(i=0;i<R->N-1;i++)
2223 for(j=i+1;j<R->N;j++)
2225 if (strcmp(R->names[i],R->names[j])==0)
2228 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",i+1,j+1,R->names[i],R->names[i]);
2230 R->names[
j]=(
char *)
omAlloc(2+strlen(R->names[i]));
2231 sprintf(R->names[j],
"@%s",R->names[i]);
2237 for(i=0;i<
rPar(R); i++)
2243 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",i+1,j+1,R->names[j],i+1);
2249 sprintf(R->names[j],
"@@(%d)",i+1);
2287 int ch = (
int)(
long)L->
m[0].
Data();
2297 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch, l);
2320 int ch = (
int)(
long)LL->
m[0].
Data();
2321 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2322 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2343 WerrorS(
"could not create the specified coefficient field");
2347 if( extRing->qideal !=
NULL )
2351 extParam.
r = extRing;
2358 extParam.
r = extRing;
2368 WerrorS(
"coefficient field must be described by `int` or `list`");
2374 WerrorS(
"could not create coefficient field described by the input!");
2402 Werror(
"var name %d must be a string or a ring variable",i+1);
2408 Werror(
"var name %d must be `string`",i+1);
2415 WerrorS(
"variable must be given as `list`");
2425 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
2426 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2427 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2430 for (j=0; j < n-1; j++)
2438 WerrorS(
"ordering must be list of lists");
2446 WerrorS(
"ordering name must be a (string,intvec)");
2451 if (j==0) R->block0[0]=1;
2468 if (jj<0) R->block0[
j]=1;
2469 else R->block0[
j]=R->block1[jj]+1;
2477 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+iv_len-1);
2478 if (R->block1[j]>R->N)
2481 iv_len=R->block1[
j]-R->block0[
j]+1;
2485 switch (R->order[j])
2494 R->wvhdl[
j] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2495 for (i=0; i<iv_len;i++)
2497 R->wvhdl[
j][
i]=(*iv)[
i];
2502 for (i=0; i<iv_len;i++)
2504 R->wvhdl[
j][
i]=(*iv)[
i];
2506 R->wvhdl[
j][
i]=iv->
length() - iv_len;
2508 for (; i<iv->
length(); i++)
2510 R->wvhdl[
j][i+1]=(*iv)[
i];
2515 for (i=0; i<iv->
length();i++) R->wvhdl[j][i]=(*iv)[
i];
2516 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+(
int)
sqrt((
double)(iv->
length()-1)));
2517 if (R->block1[j]>R->N)
2519 WerrorS(
"ordering matrix too big");
2537 R->block1[
j]=R->block0[
j]=0;
2545 R->block1[
j] = R->block0[
j] = 0;
2548 const int s = (*iv)[0];
2549 assume( -2 < s && s < 2 );
2550 R->block1[
j] = R->block0[
j] =
s;
2565 if (R->block1[j] != R->N)
2576 R->block0[j] <= R->N)
2578 R->block1[
j] = R->N;
2582 Werror(
"ordering incomplete: size (%d) should be %d",R->block1[j],R->N);
2586 if (R->block0[j]>R->N)
2588 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",R->N,j+1);
2589 for(
int ii=0;ii<=
j;ii++)
2590 Werror(
"ord[%d]: %s from v%d to v%d",ii+1,
rSimpleOrdStr(R->order[ii]),R->block0[ii],R->block1[ii]);
2604 R->order=(
int*)
omRealloc0Size(R->order,n*
sizeof(
int),(n+1)*
sizeof(
int));
2605 R->block0=(
int*)
omRealloc0Size(R->block0,n*
sizeof(
int),(n+1)*
sizeof(
int));
2606 R->block1=(
int*)
omRealloc0Size(R->block1,n*
sizeof(
int),(n+1)*
sizeof(
int));
2618 WerrorS(
"ordering must be given as `list`");
2647 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2654 int par_perm_size=0;
2673 par_perm_size=
rPar(orig_ring);
2683 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2687 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(
int));
2688 if (par_perm_size!=0)
2689 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2693 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2702 else if (par_perm_size!=0)
2707 for(i=
IDELEMS(q)-1; i>=0; i--)
2710 par_perm,par_perm_size);
2712 pTest(dest_id->m[i]);
2728 WerrorS(
"q-ideal must be given as `ideal`");
2756 while (i>=0) {
if (R->names[i]!=
NULL)
omFree(R->names[i]); i--; }
2780 for (i=1; i<=
IDELEMS(
id); i++)
2787 res->
data=(
char *)result;
2805 if ((d>n) || (d<1) || (n<1))
2810 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
2827 if (choise[l-1]<=
IDELEMS(temp))
2829 p =
pCopy(temp->m[choise[l-1]-1]);
2830 if (sign == -1) p =
pNeg(p);
2841 res->
data=(
char *)result;
2856 int add_row_shift=0;
2862 add_row_shift = ww->
min_in();
2863 (*weights) -= add_row_shift;
2876 memset(&tmp,0,
sizeof(tmp));
2890 const int length = syzstr->
length;
2892 if ((fullres==
NULL) && (minres==
NULL))
2918 for (
int i=(length)-1;
i>=0;
i--)
2930 for (
int i=length-1;
i>=0;
i--)
2984 if (toDel) li->
Clean();
3015 res->
data=(
char *)iv;
3019 double wNsqr = (double)2.0 / (
double)
n;
3021 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(
int));
3023 for (i = n; i!=0; i--)
3024 (*iv)[i-1] = x[i + n + 1];
3042 res->
data=(
void *)b;
3060 #ifdef HAVE_SPECTRUM
3078 for(
int i=0;
i<spec.
n;
i++ )
3081 spec.
w[
i] = (*mul)[
i];
3112 for(
int i=0;
i<spec.
n;
i++ )
3116 (*mult)[
i] = spec.
w[
i];
3126 L->
m[0].
data = (
void*)(
long)spec.
mu;
3127 L->
m[1].
data = (
void*)(
long)spec.
pg;
3128 L->
m[2].
data = (
void*)(
long)spec.
n;
3129 L->
m[3].
data = (
void*)num;
3130 L->
m[4].
data = (
void*)den;
3131 L->
m[5].
data = (
void*)mult;
3179 WerrorS(
"the list is too short" );
3182 WerrorS(
"the list is too long" );
3186 WerrorS(
"first element of the list should be int" );
3189 WerrorS(
"second element of the list should be int" );
3192 WerrorS(
"third element of the list should be int" );
3195 WerrorS(
"fourth element of the list should be intvec" );
3198 WerrorS(
"fifth element of the list should be intvec" );
3201 WerrorS(
"sixth element of the list should be intvec" );
3205 WerrorS(
"first element of the list should be positive" );
3208 WerrorS(
"wrong number of numerators" );
3211 WerrorS(
"wrong number of denominators" );
3214 WerrorS(
"wrong number of multiplicities" );
3218 WerrorS(
"the Milnor number should be positive" );
3221 WerrorS(
"the geometrical genus should be nonnegative" );
3224 WerrorS(
"all numerators should be positive" );
3227 WerrorS(
"all denominators should be positive" );
3230 WerrorS(
"all multiplicities should be positive" );
3234 WerrorS(
"it is not symmetric" );
3237 WerrorS(
"it is not monotonous" );
3241 WerrorS(
"the Milnor number is wrong" );
3244 WerrorS(
"the geometrical genus is wrong" );
3248 WerrorS(
"unspecific error" );
3284 ( fast==2 ? 2 : 1 ) );
3294 ( fast==0 || (*node)->weight<=smax ) )
3316 cmp =
pCmp( (*node)->mon,f );
3339 (*node)->nf = search->
nf;
3343 while( cmp<0 && f!=(
poly)NULL );
3345 search = search->
next;
3356 if( (*node)->weight<=(
Rational)1 ) pg++;
3357 if( (*node)->weight==smax ) z++;
3358 if( (*node)->weight>weight_prev ) n++;
3360 weight_prev = (*node)->weight;
3361 node = &((*node)->next);
3383 cmp =
pCmp( (*node)->mon,f );
3398 search = search->
next;
3412 n = ( z > 0 ? 2*n - 1 : 2*
n );
3427 ( fast==0 || search->
weight<=smax );
3428 search=search->
next )
3453 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3456 (*den) [n2] = (*den)[n1];
3457 (*mult)[n2] = (*mult)[n1];
3465 if( fast==0 || fast==1 )
3469 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3471 if( (*mult)[n1]!=(*mult)[n2] ||
3472 (*den) [n1]!= (*den)[n2] ||
3479 if( symmetric==
FALSE )
3489 (*L)->m[0].data = (
void*)(
long)
mu;
3506 (*L)->m[0].data = (
void*)(
long)
mu;
3507 (*L)->m[1].data = (
void*)(
long)pg;
3508 (*L)->m[2].data = (
void*)(
long)
n;
3509 (*L)->m[3].data = (
void*)nom;
3510 (*L)->m[4].data = (
void*)den;
3511 (*L)->m[5].data = (
void*)mult;
3520 #ifdef SPECTRUM_DEBUG
3521 #ifdef SPECTRUM_PRINT
3522 #ifdef SPECTRUM_IOSTREAM
3523 cout <<
"spectrumCompute\n";
3524 if( fast==0 ) cout <<
" no optimization" << endl;
3525 if( fast==1 ) cout <<
" weight optimization" << endl;
3526 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3528 fprintf( stdout,
"spectrumCompute\n" );
3529 if( fast==0 ) fprintf( stdout,
" no optimization\n" );
3530 if( fast==1 ) fprintf( stdout,
" weight optimization\n" );
3531 if( fast==2 ) fprintf( stdout,
" symmetry optimization\n" );
3575 #ifdef SPECTRUM_DEBUG
3576 #ifdef SPECTRUM_PRINT
3577 #ifdef SPECTRUM_IOSTREAM
3578 cout <<
"\n computing the Jacobi ideal...\n";
3580 fprintf( stdout,
"\n computing the Jacobi ideal...\n" );
3589 #ifdef SPECTRUM_DEBUG
3590 #ifdef SPECTRUM_PRINT
3591 #ifdef SPECTRUM_IOSTREAM
3594 fprintf( stdout,
" " );
3605 #ifdef SPECTRUM_DEBUG
3606 #ifdef SPECTRUM_PRINT
3607 #ifdef SPECTRUM_IOSTREAM
3609 cout <<
" computing a standard basis..." << endl;
3611 fprintf( stdout,
"\n" );
3612 fprintf( stdout,
" computing a standard basis...\n" );
3620 #ifdef SPECTRUM_DEBUG
3621 #ifdef SPECTRUM_PRINT
3622 for( i=0; i<
IDELEMS(stdJ); i++ )
3624 #ifdef SPECTRUM_IOSTREAM
3627 fprintf( stdout,
" " );
3672 #ifdef SPECTRUM_DEBUG
3673 #ifdef SPECTRUM_PRINT
3674 #ifdef SPECTRUM_IOSTREAM
3675 cout <<
"\n computing the highest corner...\n";
3677 fprintf( stdout,
"\n computing the highest corner...\n" );
3686 if( hc!=(
poly)NULL )
3701 #ifdef SPECTRUM_DEBUG
3702 #ifdef SPECTRUM_PRINT
3703 #ifdef SPECTRUM_IOSTREAM
3706 fprintf( stdout,
" " );
3716 #ifdef SPECTRUM_DEBUG
3717 #ifdef SPECTRUM_PRINT
3718 #ifdef SPECTRUM_IOSTREAM
3719 cout <<
"\n computing the newton polygon...\n";
3721 fprintf( stdout,
"\n computing the newton polygon...\n" );
3728 #ifdef SPECTRUM_DEBUG
3729 #ifdef SPECTRUM_PRINT
3738 #ifdef SPECTRUM_DEBUG
3739 #ifdef SPECTRUM_PRINT
3740 #ifdef SPECTRUM_IOSTREAM
3741 cout <<
"\n computing the weight corner...\n";
3743 fprintf( stdout,
"\n computing the weight corner...\n" );
3753 #ifdef SPECTRUM_DEBUG
3754 #ifdef SPECTRUM_PRINT
3755 #ifdef SPECTRUM_IOSTREAM
3758 fprintf( stdout,
" " );
3768 #ifdef SPECTRUM_DEBUG
3769 #ifdef SPECTRUM_PRINT
3770 #ifdef SPECTRUM_IOSTREAM
3771 cout <<
"\n computing NF...\n" << endl;
3773 fprintf( stdout,
"\n computing NF...\n" );
3782 #ifdef SPECTRUM_DEBUG
3783 #ifdef SPECTRUM_PRINT
3785 #ifdef SPECTRUM_IOSTREAM
3788 fprintf( stdout,
"\n" );
3813 WerrorS(
"polynomial is zero" );
3816 WerrorS(
"polynomial has constant term" );
3819 WerrorS(
"not a singularity" );
3822 WerrorS(
"the singularity is not isolated" );
3825 WerrorS(
"highest corner cannot be computed" );
3828 WerrorS(
"principal part is degenerate" );
3834 WerrorS(
"unknown error occurred" );
3851 WerrorS(
"only works for local orderings" );
3859 WerrorS(
"does not work in quotient rings" );
3872 result->
data = (
char*)L;
3905 WerrorS(
"only works for local orderings" );
3910 WerrorS(
"does not work in quotient rings" );
3923 result->
data = (
char*)L;
3969 else if( l->
nr > 5 )
4008 int pg = (
int)(
long)(l->
m[1].
Data( ));
4020 if( n != num->
length( ) )
4024 else if( n != den->
length( ) )
4028 else if( n != mul->
length( ) )
4048 for( i=0; i<
n; i++ )
4050 if( (*num)[
i] <= 0 )
4054 if( (*den)[
i] <= 0 )
4058 if( (*mul)[
i] <= 0 )
4070 for( i=0, j=n-1; i<=
j; i++,j-- )
4073 (*den)[
i] != (*den)[
j] ||
4074 (*mul)[
i] != (*mul)[
j] )
4084 for( i=0, j=1; i<n/2; i++,j++ )
4086 if( (*num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
4096 for( mu=0, i=0; i<
n; i++ )
4101 if( mu != (
int)(long)(l->
m[0].
Data( )) )
4110 for( pg=0, i=0; i<
n; i++ )
4112 if( (*num)[
i]<=(*den)[
i] )
4118 if( pg != (
int)(long)(l->
m[1].
Data( )) )
4147 WerrorS(
"first argument is not a spectrum:" );
4152 WerrorS(
"second argument is not a spectrum:" );
4185 int k = (
int)(
long)second->
Data( );
4189 WerrorS(
"first argument is not a spectrum" );
4194 WerrorS(
"second argument should be positive" );
4231 WerrorS(
"first argument is not a spectrum" );
4236 WerrorS(
"second argument is not a spectrum" );
4260 memset(&tmp,0,
sizeof(tmp));
4279 WerrorS(
"Ground field not implemented!");
4325 #ifdef mprDEBUG_PROT
4326 Print(
"m (constraints) %d\n",LP->
m);
4327 Print(
"n (columns) %d\n",LP->
n);
4351 lres->
m[4].
data=(
void*)(
long)LP->
m;
4354 lres->
m[5].
data=(
void*)(
long)LP->
n;
4356 res->
data= (
void*)lres;
4364 int imtype= (
int)(
long)arg2->
Data();
4389 int howclean= (
int)(
long)arg3->
Data();
4396 WerrorS(
"Ground field not implemented!");
4403 unsigned long int ii = (
unsigned long int)arg2->
Data();
4409 WerrorS(
"Input polynomial is constant!");
4437 if ( (vpos != i) && (
pGetExp( piter, i ) != 0) )
4439 WerrorS(
"The input polynomial must be univariate!");
4447 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4449 for ( i= deg; i >= 0; i-- )
4464 #ifdef mprDEBUG_PROT
4465 for (i=deg; i >= 0; i--)
4473 roots->
solver( howclean );
4480 rlist->
Init( elem );
4484 for ( j= 0; j < elem; j++ )
4493 for ( j= 0; j < elem; j++ )
4497 rlist->
m[
j].
data=(
void *)dummy;
4511 res->
data= (
void*)rlist;
4532 int tdg= (
int)(
long)arg3->
Data();
4539 WerrorS(
"Last input parameter must be > 0!");
4547 if ( m != (
int)
pow((
double)tdg+1,(
double)n) )
4549 Werror(
"Size of second input ideal must be equal to %d!",
4550 (
int)
pow((
double)tdg+1,(
double)n));
4557 WerrorS(
"Ground field not implemented!");
4562 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4563 for ( i= 0; i <
n; i++ )
4572 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4581 WerrorS(
"Elements of first input ideal must be numbers!");
4584 pevpoint[
i]=
nCopy( tmp );
4588 number *wresults= (number *)
omAlloc( m *
sizeof( number ) );
4589 for ( i= 0; i <
m; i++ )
4598 WerrorS(
"Elements of second input ideal must be numbers!");
4613 res->
data= (
void*)rpoly;
4634 else imtype= (
int)(
long)v->
Data();
4641 for(j=
IDELEMS(gls)-1;j>=0;j--)
4643 if (gls->m[j]!=
NULL)
4645 test_id->m[0]=gls->m[
j];
4649 WerrorS(
"Newton polytope not of expected dimension");
4663 unsigned long int ii=(
unsigned long int)v->
Data();
4671 else howclean= (
int)(
long)v->
Data();
4700 WerrorS(
"Error occurred during matrix setup!");
4708 #ifdef mprDEBUG_PROT
4713 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4719 if ( interpolate_det )
4725 if ( interpolate_det )
4730 #ifdef mprDEBUG_PROT
4732 for (i=0; i < c; i++)
pWrite(iproots[i]->getPoly());
4734 for (i=0; i < c; i++)
pWrite(muiproots[i]->getPoly());
4738 arranger=
new rootArranger( iproots, muiproots, howclean );
4749 WerrorS(
"Solver was unable to find any roots!");
4755 for (i=0; i <
count; i++)
delete iproots[i];
4758 for (i=0; i <
count; i++)
delete muiproots[i];
4765 res->
data= (
void *)listofroots;
4777 int count=
self->roots[0]->getAnzRoots();
4778 int elem=
self->roots[0]->getAnzElems();
4782 if ( self->found_roots )
4784 listofroots->
Init( count );
4786 for (i=0; i <
count; i++)
4789 onepoint->
Init(elem);
4790 for ( j= 0; j < elem; j++ )
4806 listofroots->
m[
i].
data=(
void *)onepoint;
4814 listofroots->
Init( 0 );
4828 if (rg==
NULL)
return;
4848 Warn(
"deleting denom_list for ring change to %s",
IDID(h));
4860 if ((rg!=
NULL) && (rg->idroot==
NULL))
4888 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
4893 (*iv)[
i]= - (*iv)[
i];
4902 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
4907 (*iv)[
i]= -(*iv)[
i];
4916 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
4922 (*iv2)[2]=iv->
length()-2;
4934 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
4940 (*iv2)[2]=iv->
length()-2;
4974 (*iv)[2] += (*iv2)[2];
4981 if (!change) h=h->
next;
4989 int last = 0, o=0,
n = 1,
i=0, typ = 1,
j;
5001 R->bitmask=(*iv)[2];
5014 WerrorS(
"invalid combination of orderings");
5022 WerrorS(
"more than one ordering c/C specified");
5027 R->order=(
int *)
omAlloc0(
n*
sizeof(
int));
5028 R->block0=(
int *)
omAlloc0(
n*
sizeof(
int));
5029 R->block1=(
int *)
omAlloc0(
n*
sizeof(
int));
5032 int *weights=(
int*)
omAlloc0((R->N+1)*
sizeof(
int));
5035 for (
j=0;
j <
n-1;
j++)
5056 R->order[
n] = (*iv)[1];
5066 R->block0[
n] = last+1;
5069 R->wvhdl[
n][
i-2] = (*iv)[
i];
5071 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5073 R->block1[
n] =
last;
5084 R->block0[
n] = last+1;
5085 if (iv->
length() == 3) last+=(*iv)[2];
5086 else last += (*iv)[0];
5087 R->block1[
n] =
last;
5098 if (weights[
i]==0) weights[
i]=typ;
5110 const int s = (*iv)[2];
5120 const int s = (*iv)[2];
5122 if( 1 < s || s < -1 )
return TRUE;
5138 R->block0[
n] = last+1;
5143 R->wvhdl[
n][
i-2]=(*iv)[
i];
5145 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5147 last=R->block0[
n]-1;
5152 R->block0[
n] = last+1;
5155 if (R->block1[n]- R->block0[n]+2>=iv->
length())
5156 WarnS(
"missing module weights");
5157 for (
i=2;
i<=(R->block1[
n]-R->block0[
n]+2);
i++)
5159 R->wvhdl[
n][
i-2]=(*iv)[
i];
5161 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5163 R->wvhdl[
n][
i-2]=iv->
length() -3 -(R->block1[
n]- R->block0[
n]);
5166 R->wvhdl[
n][
i-1]=(*iv)[
i];
5168 last=R->block0[
n]-1;
5173 R->block0[
n] = last+1;
5181 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5183 last=R->block0[
n]-1;
5189 if (Mtyp==0)
return TRUE;
5190 if (Mtyp==-1) typ = -1;
5194 R->wvhdl[n][
i-2]=(*iv)[
i];
5196 R->block0[
n] = last+1;
5198 R->block1[
n] =
last;
5201 if (weights[
i]==0) weights[
i]=typ;
5211 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5230 if (R->block1[n] != R->N)
5241 R->block0[n] <= R->N)
5243 R->block1[
n] = R->N;
5247 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5254 for(
i=1;
i<=R->N;
i++)
5255 {
if (weights[
i]<0) { R->OrdSgn=-1;
break; }}
5308 mpz_ptr modBase =
NULL;
5309 unsigned int modExponent = 1;
5334 int ch = (
int)(
long)pn->
Data();
5344 if ((ch<2)||(ch!=ch2))
5346 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5361 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5373 if ((ch!=0) && (ch!=
IsPrime(ch)))
5375 WerrorS(
"too many parameters");
5383 WerrorS(
"parameter expected");
5389 extParam.
r =
rDefault( ch, pars, names);
5390 for(
int i=pars-1;
i>=0;
i--)
5404 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5406 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5410 float_len2=float_len;
5433 if (param.
float_len < SHORT_REAL_LENGTH)
5449 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5452 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
5453 mpz_init_set_si(modBase, 0);
5458 mpz_set_ui(modBase, (
int)(
long) pn->
next->
Data());
5460 if ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5462 modExponent = (long) pn->
next->
Data();
5465 while ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5467 mpz_mul_ui(modBase, modBase, (
int)(
long) pn->next->Data());
5481 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5483 Werror(
"Wrong ground ring specification (module is 1)");
5486 if (modExponent < 1)
5488 Werror(
"Wrong ground ring specification (exponent smaller than 1");
5493 if (modExponent > 1 && cf ==
NULL)
5495 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5506 if (mpz_cmp_ui(modBase,0)==0)
5508 WerrorS(
"modulus must not be 0 or parameter not allowed");
5514 info.
exp= modExponent;
5519 else if (cf ==
NULL)
5521 if (mpz_cmp_ui(modBase,0)==0)
5523 WerrorS(
"modulus must not be 0 or parameter not allowed");
5529 info.
exp= modExponent;
5539 extParam.
r = (ring)pn->
Data();
5545 extParam.
r = (ring)pn->
Data();
5551 Werror(
"Wrong or unknown ground field specification");
5579 Werror(
"Invalid ground field specification");
5595 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5603 WerrorS(
"name of ring variable expected");
5656 int *perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(
int));
5664 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5673 WerrorS(
"name of ring variable expected");
5683 for(;
i<org_ring->N;
i++)
5685 if (strcmp(org_ring->names[
i],R->names[
j])==0)
5693 Werror(
"variable %d (%s) not in basering",
j+1,R->names[
j]);
5706 for(
j=R->block0[
i];j<=R->block1[
i];
j++)
5710 if (min_var==-1) min_var=perm[
j];
5718 R->block0[
i]=min_var;
5719 R->block1[
i]=max_var;
5720 if (R->wvhdl[
i]!=
NULL)
5723 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(
int));
5724 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
5728 R->wvhdl[
i][perm[
j]-R->block0[
i]]=
5729 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
5755 R->order[
j-1]=R->order[
j];
5756 R->block0[
j-1]=R->block0[
j];
5757 R->block1[
j-1]=R->block1[
j];
5759 R->wvhdl[
j-1]=R->wvhdl[
j];
5767 while (R->order[n]==0) n--;
5770 if (R->block1[n] != R->N)
5781 R->block0[n] <= R->N)
5783 R->block1[
n] = R->N;
5787 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
5788 R->N,R->block1[n],n);
5794 R->OrdSgn = org_ring->OrdSgn;
5817 if ((r->ref<=0)&&(r->order!=
NULL))
5822 if (r->qideal!=
NULL)
5828 #ifdef USE_IILOCALRING
5833 if (j+1==myynest)
Warn(
"killing the basering for level %d",j);
5843 for(; nshdl !=
NULL; nshdl = nshdl->
next)
5845 if (nshdl->
cRing==r)
5847 Warn(
"killing the basering for level %d",lev);
5855 while (r->idroot!=
NULL)
5858 killhdl2(r->idroot,&(r->idroot),r);
6010 for(i=I->nrows*I->ncols-1;i>=0;i--)
6022 switch (p->language)
6030 if(p->libname!=
NULL)
6031 Print(
",%s", p->libname);
6044 memset(&tmp_in,0,
sizeof(tmp_in));
6046 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6050 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6054 Werror(
"apply fails at index %d",
i+1);
6057 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6062 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6084 for(
int i=0;
i<=aa->
nr;
i++)
6086 memset(&tmp_in,0,
sizeof(tmp_in));
6087 tmp_in.
Copy(&(aa->
m[
i]));
6091 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6096 Werror(
"apply fails at index %d",
i+1);
6099 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6104 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6111 memset(res,0,
sizeof(
sleftv));
6127 WerrorS(
"first argument to `apply` must allow an index");
6137 char assume_yylinebuf[80];
6139 int lev=(long)a->
Data();
6146 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6160 char *ss=(
char*)
omAlloc(strlen(a)+strlen(s)+30);
6162 int end_s=strlen(s);
6163 while ((end_s>0) && ((s[end_s]<=
' ')||(s[end_s]==
';'))) end_s--;
6165 char *
name=(
char *)
omAlloc(strlen(a)+strlen(s)+30);
6166 sprintf(name,
"%s->%s",a,s);
6168 int start_s=end_s-1;
6169 while ((start_s>=0) && (s[start_s]!=
';')) start_s--;
6172 sprintf(ss,
"parameter def %s;return(%s);\n",a,s);
6177 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6179 memset(r,0,
sizeof(*r));
6195 char* ring_name=(
char*)r->
Name();
6200 memset(&tmp,0,
sizeof(tmp));
6218 memset(&n,0,
sizeof(n));
6234 sprintf(buf,
"wrong length of parameters(%d), expected ",t);
6236 sprintf(buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6237 for(
int i=1;
i<=T[0];
i++)
6242 if (i<T[0]) strcat(buf,
",");
6251 if (type_list[0]==0)
return TRUE;
6254 if (report)
WerrorS(
"no arguments expected");
6259 if (l!=(
int)type_list[0])
6264 for(
int i=1;
i<=
l;
i++,args=args->
next)
6266 short t=type_list[
i];
6270 || (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
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
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)
int cf_getSmallPrime(int i)
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
const CanonicalForm int s
void rDecomposeC(leftv h, const ring R)
int iiTestConvert(int inputType, int outputType)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
#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)
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)
static BOOLEAN rField_is_Zp_a(const ring r)
virtual IStateType initState() const
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
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)
BOOLEAN idIsZeroDim(ideal i, const ring R=currRing)
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 iiApplyBIGINTMAT(leftv res, leftv a, int op, leftv proc)
int exprlist_length(leftv v)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
void syMinimizeResolvente(resolvente res, int length, int first)
BOOLEAN iiApplyIDEAL(leftv res, leftv a, int op, leftv proc)
static int rPar(const ring r)
(r->cf->P)
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
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()
#define omFreeSize(addr, size)
const CanonicalForm CFMap CFMap int &both_non_zero int n
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)
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)
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)
ring rAssure_HasComp(const ring r)
ideal loNewtonPolytope(const ideal id)
void killlocals_rec(idhdl *root, int v, ring r)
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)
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
int hasOne(ideal J, const ring r)
BOOLEAN exitBuffer(feBufferTypes typ)
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
static bool rIsPluralRing(const ring r)
we must always have this test!
poly numvec2poly(const number *q)
void rComposeC(lists L, ring R)
static void jjINT_S_TO_ID(int n, int *e, leftv res)
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
int iiIsPrime0(unsigned p)
static int pLength(poly a)
int int kStrategy strat if(h==NULL) return NULL
Creation data needed for finite fields.
BOOLEAN iiExport(leftv v, int toLev)
idhdl rDefault(const char *s)
idhdl get(const char *s, int lev)
real floating point (GMP) numbers
BOOLEAN iiParameter(leftv p)
short float_len2
additional char-flags, rInit
#define pGetVariables(p, e)
#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)
int rTypeOfMatrixOrder(intvec *order)
#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
Coefficient rings, fields and other domains suitable for Singular polynomials.
BOOLEAN killlocals_list(int v, lists L)
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)
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 "
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)
BOOLEAN rCheckIV(intvec *iv)
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)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
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)
int rOrderName(char *ordername)
void idDelete(ideal *h, ring r=currRing)
delete an ideal
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()
int cf_getNumSmallPrimes()
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 spectrumfProc(leftv result, leftv first)
gmp_complex * getRoot(const int i)
idhdl rFindHdl(ring r, idhdl n)
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
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)
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 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)
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
void paPrint(const char *n, package p)
BOOLEAN iiCheckRing(int i)
ideal idInit(int idsize, int rank)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN kQHWeight(leftv res, leftv v)
static BOOLEAN iiInternalExport(leftv v, int toLev)
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
char name(const Variable &v)
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)
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
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 iiOpsTwoChar(const char *s)
ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r)
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)
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)
syStrategy syConvList(lists li, BOOLEAN toDel)
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
number nlMapGMP(number from, const coeffs src, const coeffs dst)
ideal idCopy(ideal A, const ring R=currRing)
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)
ring rInit(sleftv *pn, sleftv *rv, sleftv *ord)
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...
#define omFreeBin(addr, bin)
BOOLEAN iiBranchTo(leftv r, leftv args)
Rational pow(const Rational &a, int e)
char * iiGetLibProcBuffer(procinfo *pi, int part)
BOOLEAN rSleftvList2StringArray(sleftv *sl, char **p)
static poly p_Init(const ring r, omBin bin)
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)
void nKillChar(coeffs r)
undo all initialisations
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)