12 #include <factory/factory.h>
118 case LE:
return "<=";
119 case GE:
return ">=";
128 if (s[1]==
'\0')
return s[0];
129 else if (s[2]!=
'\0')
return 0;
132 case '.':
if (s[1]==
'.')
return DOTDOT;
138 case '+':
if (s[1]==
'+')
return PLUSPLUS;
142 case '<':
if (s[1]==
'=')
return LE;
143 else if (s[1]==
'>')
return NOTEQUAL;
145 case '>':
if (s[1]==
'=')
return GE;
147 case '!':
if (s[1]==
'=')
return NOTEQUAL;
159 if(fullname) sprintf(buf2,
"%s::%s",
"",
IDID(h));
160 else sprintf(buf2,
"%s",
IDID(h));
198 && (strlen(
IDPROC(h)->libname)>0))
209 if ((s=strchr(buffer,
'\n'))!=
NULL)
215 if((s!=
NULL) ||(l>20))
217 Print(
"..., %d char(s)",l);
234 { number2
n=(number2)
IDDATA(h);
240 Print(
" %d x %d (%s)",
375 && (((ring)d)->idroot!=
NULL))
427 package savePack=currPack;
434 if (strcmp(what,
"all")==0)
446 if (iterate)
list1(prefix,h,
TRUE,fullname);
470 Werror(
"%s is undefined",what);
503 package save_p=currPack;
537 Warn(
"Gerhard, use the option command");
599 WerrorS(
"write: need at least two arguments");
607 if ((l!=
NULL)&&(l->name!=
NULL)) s=l->name;
609 Werror(
"cannot write to %s",s);
636 Werror(
"can not map from ground field of %s to current ground field",
640 if (
IDELEMS(theMap)<src_ring->N)
644 (src_ring->N)*
sizeof(
poly));
645 for(i=
IDELEMS(theMap);i<src_ring->N;i++)
651 WerrorS(
"argument of a map must have a name");
658 memset(&tmpW,0,
sizeof(
sleftv));
663 save_r=
IDMAP(w)->preimage;
664 IDMAP(w)->preimage=0;
673 ideal
id=(ideal)tmpW.
data;
674 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
676 if (theMap->m[
j]!=
NULL)
679 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
694 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
696 if (theMap->m[
j]!=
NULL)
710 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
728 char *tmp = theMap->preimage;
729 theMap->preimage=(
char*)1L;
732 theMap->preimage=tmp;
740 if (save_r!=
NULL)
IDMAP(w)->preimage=save_r;
746 IDMAP(w)->preimage=save_r;
754 Werror(
"%s undefined in %s",what,theMap->preimage);
759 Werror(
"cannot find preimage %s",theMap->preimage);
771 char *
s=(
char *)
omAlloc(strlen(name)+5);
775 sprintf(s,
"%s(%d)",name,i+1);
785 Print(
"//defining: %s as %d-th syzygy module\n",s,i+1);
790 Warn(
"cannot define %s",s);
870 int add_row_shift = 0;
873 if (weights!=
NULL) add_row_shift=weights->
min_in();
888 memset(&tmp,0,
sizeof(tmp));
908 memset(&tmp2,0,
sizeof(tmp2));
932 add_row_shift = ww->
min_in();
933 (*weights) -= add_row_shift;
942 if (weights!=
NULL)
delete weights;
960 add_row_shift = ww->
min_in();
961 (*weights) -= add_row_shift;
966 if (weights!=
NULL)
delete weights;
969 return reg+1+add_row_shift;
973 #define BREAK_LINE_LENGTH 80
1000 else if(strncmp(s,
"cont;",5)==0)
1007 strcat( s,
"\n;~\n");
1078 res->
m[
i].
data = (
void *)save->set;
1088 for (i=hMu;i<hMu+
hMu2;i++)
1090 res->
m[
i].
data = (
void *)save->set;
1115 const char *
id = name->
name;
1117 memset(sy,0,
sizeof(
sleftv));
1120 WerrorS(
"object to declare is not a name");
1157 if (iiCurrProc!=
NULL)
1162 memset(&tmp,0,
sizeof(
sleftv));
1174 if (ll!=(l-1))
return FALSE;
1176 short *t=(
short*)
omAlloc(l*
sizeof(
short));
1180 for(i=1;i<
l;i++,h=h->
next)
1185 Werror(
"arg %d is not a string",i);
1189 b=
IsCmd((
char *)h->Data(),tt);
1194 Werror(
"arg %d is not a type name",i);
1201 Werror(
"last arg (%d) is not a proc",i);
1206 if (b && (h->rtyp==
IDHDL) && (h->e==
NULL))
1212 if(
pi->data.s.body==
NULL )
1226 if (iiCurrArgs!=
NULL)
1228 if (!err)
Warn(
"too many arguments for %s",
IDID(iiCurrProc));
1239 if (iiCurrArgs==
NULL)
1241 if (strcmp(p->
name,
"#")==0)
1250 if (strcmp(p->
name,
"#")==0)
1252 is_default_list=
TRUE;
1260 if (is_default_list)
1307 #ifdef USE_IILOCALRING
1327 if (keepring)
IDRING(h)->ref--;
1339 Warn(
"'%s': no such identifier\n", v->
name);
1342 package frompack=v->req_packhdl;
1357 if (h==frompack->idroot)
1359 frompack->idroot=h->
next;
1363 idhdl hh=frompack->idroot;
1364 while ((hh!=
NULL) && (hh->
next!=h))
1374 h->
next=rootpack->idroot;
1514 WarnS(
"package not found\n");
1547 r->order = (
int *)
omAlloc(3 *
sizeof(
int *));
1548 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1549 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1568 if (h!=
NULL)
return h;
1570 if (h!=
NULL)
return h;
1577 if (h!=
NULL)
return h;
1585 if (h!=
NULL)
return h;
1604 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1610 for(i=0; i<r->N; i++)
1616 L->
m[1].
data=(
void *)LL;
1633 if (r->block1[i]-r->block0[i] >=0 )
1635 j=r->block1[
i]-r->block0[
i];
1638 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1640 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][
j];
1642 else switch (r->order[i])
1649 for(;j>=0; j--) (*iv)[
j]=1;
1659 LLL->
m[1].
data=(
void *)iv;
1660 LL->
m[
i].
data=(
void *)LLL;
1663 L->
m[2].
data=(
void *)LL;
1673 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1674 L->
m[3].
data=(
void *)q;
1693 L->
m[0].
data=(
void *)0;
1703 L->
m[1].
data=(
void *)LL;
1735 LL->
m[0].
data=
nlMapGMP((number) R->cf->modBase, R->cf, R->cf);
1737 LL->
m[1].
data=(
void *) R->cf->modExponent;
1739 L->
m[1].
data=(
void *)LL;
1753 || (r->qideal !=
NULL)
1760 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1780 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
1792 else if ( r->cf->extRing!=
NULL )
1802 Lc->
m[0].
data=(
void*)(
long)r->cf->m_nfCharQ;
1809 Lc->
m[1].
data=(
void*)Lv;
1820 Loo->
m[1].
data=(
void *)iv;
1823 Lo->
m[0].
data=(
void*)Loo;
1826 Lc->
m[2].
data=(
void*)Lo;
1832 L->
m[0].
data=(
void*)Lc;
1837 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1845 for(i=0; i<r->N; i++)
1851 L->
m[1].
data=(
void *)LL;
1871 assume( r->block0[i] == r->block1[i] );
1872 const int s = r->block0[
i];
1873 assume( -2 < s && s < 2);
1878 else if (r->block1[i]-r->block0[i] >=0 )
1880 int bl=j=r->block1[
i]-r->block0[
i];
1888 j+=r->wvhdl[
i][bl+1];
1891 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1893 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
1895 else switch (r->order[i])
1902 for(;j>=0; j--) (*iv)[
j]=1;
1912 LLL->
m[1].
data=(
void *)iv;
1913 LL->
m[
i].
data=(
void *)LLL;
1916 L->
m[2].
data=(
void *)LL;
1920 if (r->qideal==
NULL)
1925 #ifdef HAVE_PLURAL // NC! in rDecompose
1944 Werror(
"invald coeff. field description, expecting 0");
1951 Werror(
"invald coeff. field description, expecting precision list");
1953 int r1=(
int)(long)LL->
m[0].
data;
1954 int r2=(
int)(long)LL->
m[1].
data;
1976 R->cf->float_len=
si_min(r1,32767);
1977 R->cf->float_len2=
si_min(r2,32767);
1986 Werror(
"invald coeff. field description, expecting parameter name");
2002 mpz_ptr modBase =
NULL;
2003 unsigned int modExponent = 1;
2005 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
2008 mpz_init_set_ui(modBase,0);
2019 number tmp= (number) LL->
m[0].
data;
2025 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2029 mpz_init_set_ui(modBase,0);
2033 modExponent = (
unsigned long) LL->
m[1].
data;
2041 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
2043 Werror(
"Wrong ground ring specification (module is 1)");
2046 if (modExponent < 1)
2048 Werror(
"Wrong ground ring specification (exponent smaller than 1");
2052 if (mpz_cmp_ui(modBase, 0) == 0)
2057 else if (modExponent > 1)
2060 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2072 info.
exp= modExponent;
2083 info.
exp= modExponent;
2096 for(i=0;i<R->N-1;i++)
2098 for(j=i+1;j<R->N;j++)
2100 if (strcmp(R->names[i],R->names[j])==0)
2103 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",i+1,j+1,R->names[i],R->names[i]);
2105 R->names[
j]=(
char *)
omAlloc(2+strlen(R->names[i]));
2106 sprintf(R->names[j],
"@%s",R->names[i]);
2112 for(i=0;i<
rPar(R); i++)
2118 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",i+1,j+1,R->names[j],i+1);
2124 sprintf(R->names[j],
"@@(%d)",i+1);
2162 int ch = (int)(
long)L->
m[0].
Data();
2172 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch, l);
2195 int ch = (int)(
long)LL->
m[0].
Data();
2196 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2197 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2218 WerrorS(
"could not create the specified coefficient field");
2222 if( extRing->qideal !=
NULL )
2226 extParam.
r = extRing;
2233 extParam.
r = extRing;
2243 WerrorS(
"coefficient field must be described by `int` or `list`");
2249 WerrorS(
"could not create coefficient field described by the input!");
2277 Werror(
"var name %d must be a string or a ring variable",i+1);
2283 Werror(
"var name %d must be `string`",i+1);
2290 WerrorS(
"variable must be given as `list`");
2300 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
2301 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2302 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2305 for (j=0; j < n-1; j++)
2313 WerrorS(
"ordering must be list of lists");
2321 WerrorS(
"ordering name must be a (string,intvec)");
2326 if (j==0) R->block0[0]=1;
2343 if (jj<0) R->block0[
j]=1;
2344 else R->block0[
j]=R->block1[jj]+1;
2352 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+iv_len-1);
2353 if (R->block1[j]>R->N)
2356 iv_len=R->block1[
j]-R->block0[
j]+1;
2360 switch (R->order[j])
2369 R->wvhdl[
j] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2370 for (i=0; i<iv_len;i++)
2372 R->wvhdl[
j][
i]=(*iv)[
i];
2377 for (i=0; i<iv_len;i++)
2379 R->wvhdl[
j][
i]=(*iv)[
i];
2381 R->wvhdl[
j][
i]=iv->
length() - iv_len;
2383 for (; i<iv->
length(); i++)
2385 R->wvhdl[
j][i+1]=(*iv)[
i];
2390 for (i=0; i<iv->
length();i++) R->wvhdl[j][i]=(*iv)[
i];
2391 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+(
int)
sqrt((
double)(iv->
length()-1)));
2392 if (R->block1[j]>R->N)
2394 WerrorS(
"ordering matrix too big");
2412 R->block1[
j]=R->block0[
j]=0;
2420 R->block1[
j] = R->block0[
j] = 0;
2423 const int s = (*iv)[0];
2424 assume( -2 < s && s < 2 );
2425 R->block1[
j] = R->block0[
j] =
s;
2440 if (R->block1[j] != R->N)
2451 R->block0[j] <= R->N)
2453 R->block1[
j] = R->N;
2457 Werror(
"ordering incomplete: size (%d) should be %d",R->block1[j],R->N);
2461 if (R->block0[j]>R->N)
2463 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",R->N,j+1);
2464 for(
int ii=0;ii<=
j;ii++)
2465 Werror(
"ord[%d]: %s from v%d to v%d",ii+1,
rSimpleOrdStr(R->order[ii]),R->block0[ii],R->block1[ii]);
2479 R->order=(
int*)
omRealloc0Size(R->order,n*
sizeof(
int),(n+1)*
sizeof(
int));
2480 R->block0=(
int*)
omRealloc0Size(R->block0,n*
sizeof(
int),(n+1)*
sizeof(
int));
2481 R->block1=(
int*)
omRealloc0Size(R->block1,n*
sizeof(
int),(n+1)*
sizeof(
int));
2493 WerrorS(
"ordering must be given as `list`");
2516 ideal q=(ideal)L->
m[3].
Data();
2522 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2529 int par_perm_size=0;
2548 par_perm_size=
rPar(orig_ring);
2558 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2562 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(int));
2563 if (par_perm_size!=0)
2564 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2568 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2577 else if (par_perm_size!=0)
2582 for(i=
IDELEMS(q)-1; i>=0; i--)
2585 par_perm,par_perm_size);
2587 pTest(dest_id->m[i]);
2603 WerrorS(
"q-ideal must be given as `ideal`");
2631 while (i>=0) {
if (R->names[i]!=
NULL)
omFree(R->names[i]); i--; }
2652 ideal
id=(ideal)a->
Data();
2655 for (i=1; i<=
IDELEMS(
id); i++)
2662 res->
data=(
char *)result;
2672 int n=(int)(
long)b->
Data();
2673 int d=(int)(
long)c->
Data();
2680 if ((d>n) || (d<1) || (n<1))
2685 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
2689 temp=(ideal)id->
Data();
2702 if (choise[l-1]<=
IDELEMS(temp))
2704 p =
pCopy(temp->m[choise[l-1]-1]);
2705 if (sign == -1) p =
pNeg(p);
2716 res->
data=(
char *)result;
2731 int add_row_shift=0;
2737 add_row_shift = ww->
min_in();
2738 (*weights) -= add_row_shift;
2751 memset(&tmp,0,
sizeof(tmp));
2765 const int length = syzstr->
length;
2767 if ((fullres==
NULL) && (minres==
NULL))
2793 for (
int i=(length)-1;
i>=0;
i--)
2805 for (
int i=length-1;
i>=0;
i--)
2859 if (toDel) li->
Clean();
2884 ideal F=(ideal)id->
Data();
2890 res->
data=(
char *)iv;
2894 double wNsqr = (double)2.0 / (
double)
n;
2896 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(int));
2898 for (i = n; i!=0; i--)
2899 (*iv)[i-1] = x[i + n + 1];
2917 res->
data=(
void *)b;
2935 #ifdef HAVE_SPECTRUM
2943 spec.
mu = (int)(
long)(l->
m[0].
Data( ));
2944 spec.
pg = (int)(
long)(l->
m[1].
Data( ));
2945 spec.
n = (int)(
long)(l->
m[2].
Data( ));
2953 for(
int i=0;
i<spec.
n;
i++ )
2956 spec.
w[
i] = (*mul)[
i];
2987 for(
int i=0;
i<spec.
n;
i++ )
2991 (*mult)[
i] = spec.
w[
i];
3001 L->
m[0].
data = (
void*)(
long)spec.
mu;
3002 L->
m[1].
data = (
void*)(
long)spec.
pg;
3003 L->
m[2].
data = (
void*)(
long)spec.
n;
3004 L->
m[3].
data = (
void*)num;
3005 L->
m[4].
data = (
void*)den;
3006 L->
m[5].
data = (
void*)mult;
3054 WerrorS(
"the list is too short" );
3057 WerrorS(
"the list is too long" );
3061 WerrorS(
"first element of the list should be int" );
3064 WerrorS(
"second element of the list should be int" );
3067 WerrorS(
"third element of the list should be int" );
3070 WerrorS(
"fourth element of the list should be intvec" );
3073 WerrorS(
"fifth element of the list should be intvec" );
3076 WerrorS(
"sixth element of the list should be intvec" );
3080 WerrorS(
"first element of the list should be positive" );
3083 WerrorS(
"wrong number of numerators" );
3086 WerrorS(
"wrong number of denominators" );
3089 WerrorS(
"wrong number of multiplicities" );
3093 WerrorS(
"the Milnor number should be positive" );
3096 WerrorS(
"the geometrical genus should be nonnegative" );
3099 WerrorS(
"all numerators should be positive" );
3102 WerrorS(
"all denominators should be positive" );
3105 WerrorS(
"all multiplicities should be positive" );
3109 WerrorS(
"it is not symmetric" );
3112 WerrorS(
"it is not monotonous" );
3116 WerrorS(
"the Milnor number is wrong" );
3119 WerrorS(
"the geometrical genus is wrong" );
3123 WerrorS(
"unspecific error" );
3159 ( fast==2 ? 2 : 1 ) );
3169 ( fast==0 || (*node)->weight<=smax ) )
3191 cmp =
pCmp( (*node)->mon,f );
3214 (*node)->nf = search->
nf;
3218 while( cmp<0 && f!=(
poly)NULL );
3220 search = search->
next;
3231 if( (*node)->weight<=(
Rational)1 ) pg++;
3232 if( (*node)->weight==smax ) z++;
3233 if( (*node)->weight>weight_prev ) n++;
3235 weight_prev = (*node)->weight;
3236 node = &((*node)->next);
3258 cmp =
pCmp( (*node)->mon,f );
3273 search = search->
next;
3287 n = ( z > 0 ? 2*n - 1 : 2*
n );
3302 ( fast==0 || search->
weight<=smax );
3303 search=search->
next )
3328 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3331 (*den) [n2] = (*den)[n1];
3332 (*mult)[n2] = (*mult)[n1];
3340 if( fast==0 || fast==1 )
3344 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3346 if( (*mult)[n1]!=(*mult)[n2] ||
3347 (*den) [n1]!= (*den)[n2] ||
3354 if( symmetric==
FALSE )
3364 (*L)->m[0].data = (
void*)(
long)
mu;
3381 (*L)->m[0].data = (
void*)(
long)
mu;
3382 (*L)->m[1].data = (
void*)(
long)pg;
3383 (*L)->m[2].data = (
void*)(
long)
n;
3384 (*L)->m[3].data = (
void*)nom;
3385 (*L)->m[4].data = (
void*)den;
3386 (*L)->m[5].data = (
void*)mult;
3395 #ifdef SPECTRUM_DEBUG
3396 #ifdef SPECTRUM_PRINT
3397 #ifdef SPECTRUM_IOSTREAM
3398 cout <<
"spectrumCompute\n";
3399 if( fast==0 ) cout <<
" no optimization" << endl;
3400 if( fast==1 ) cout <<
" weight optimization" << endl;
3401 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3403 fprintf( stdout,
"spectrumCompute\n" );
3404 if( fast==0 ) fprintf( stdout,
" no optimization\n" );
3405 if( fast==1 ) fprintf( stdout,
" weight optimization\n" );
3406 if( fast==2 ) fprintf( stdout,
" symmetry optimization\n" );
3450 #ifdef SPECTRUM_DEBUG
3451 #ifdef SPECTRUM_PRINT
3452 #ifdef SPECTRUM_IOSTREAM
3453 cout <<
"\n computing the Jacobi ideal...\n";
3455 fprintf( stdout,
"\n computing the Jacobi ideal...\n" );
3464 #ifdef SPECTRUM_DEBUG
3465 #ifdef SPECTRUM_PRINT
3466 #ifdef SPECTRUM_IOSTREAM
3469 fprintf( stdout,
" " );
3480 #ifdef SPECTRUM_DEBUG
3481 #ifdef SPECTRUM_PRINT
3482 #ifdef SPECTRUM_IOSTREAM
3484 cout <<
" computing a standard basis..." << endl;
3486 fprintf( stdout,
"\n" );
3487 fprintf( stdout,
" computing a standard basis...\n" );
3495 #ifdef SPECTRUM_DEBUG
3496 #ifdef SPECTRUM_PRINT
3497 for( i=0; i<
IDELEMS(stdJ); i++ )
3499 #ifdef SPECTRUM_IOSTREAM
3502 fprintf( stdout,
" " );
3547 #ifdef SPECTRUM_DEBUG
3548 #ifdef SPECTRUM_PRINT
3549 #ifdef SPECTRUM_IOSTREAM
3550 cout <<
"\n computing the highest corner...\n";
3552 fprintf( stdout,
"\n computing the highest corner...\n" );
3561 if( hc!=(
poly)NULL )
3576 #ifdef SPECTRUM_DEBUG
3577 #ifdef SPECTRUM_PRINT
3578 #ifdef SPECTRUM_IOSTREAM
3581 fprintf( stdout,
" " );
3591 #ifdef SPECTRUM_DEBUG
3592 #ifdef SPECTRUM_PRINT
3593 #ifdef SPECTRUM_IOSTREAM
3594 cout <<
"\n computing the newton polygon...\n";
3596 fprintf( stdout,
"\n computing the newton polygon...\n" );
3603 #ifdef SPECTRUM_DEBUG
3604 #ifdef SPECTRUM_PRINT
3613 #ifdef SPECTRUM_DEBUG
3614 #ifdef SPECTRUM_PRINT
3615 #ifdef SPECTRUM_IOSTREAM
3616 cout <<
"\n computing the weight corner...\n";
3618 fprintf( stdout,
"\n computing the weight corner...\n" );
3628 #ifdef SPECTRUM_DEBUG
3629 #ifdef SPECTRUM_PRINT
3630 #ifdef SPECTRUM_IOSTREAM
3633 fprintf( stdout,
" " );
3643 #ifdef SPECTRUM_DEBUG
3644 #ifdef SPECTRUM_PRINT
3645 #ifdef SPECTRUM_IOSTREAM
3646 cout <<
"\n computing NF...\n" << endl;
3648 fprintf( stdout,
"\n computing NF...\n" );
3657 #ifdef SPECTRUM_DEBUG
3658 #ifdef SPECTRUM_PRINT
3660 #ifdef SPECTRUM_IOSTREAM
3663 fprintf( stdout,
"\n" );
3688 WerrorS(
"polynomial is zero" );
3691 WerrorS(
"polynomial has constant term" );
3694 WerrorS(
"not a singularity" );
3697 WerrorS(
"the singularity is not isolated" );
3700 WerrorS(
"highest corner cannot be computed" );
3703 WerrorS(
"principal part is degenerate" );
3709 WerrorS(
"unknown error occurred" );
3726 WerrorS(
"only works for local orderings" );
3734 WerrorS(
"does not work in quotient rings" );
3747 result->
data = (
char*)L;
3780 WerrorS(
"only works for local orderings" );
3785 WerrorS(
"does not work in quotient rings" );
3798 result->
data = (
char*)L;
3844 else if( l->
nr > 5 )
3882 int mu = (int)(
long)(l->
m[0].
Data( ));
3883 int pg = (int)(
long)(l->
m[1].
Data( ));
3884 int n = (int)(
long)(l->
m[2].
Data( ));
3895 if( n != num->
length( ) )
3899 else if( n != den->
length( ) )
3903 else if( n != mul->
length( ) )
3923 for( i=0; i<
n; i++ )
3925 if( (*num)[
i] <= 0 )
3929 if( (*den)[
i] <= 0 )
3933 if( (*mul)[
i] <= 0 )
3945 for( i=0, j=n-1; i<=
j; i++,j-- )
3948 (*den)[
i] != (*den)[
j] ||
3949 (*mul)[
i] != (*mul)[
j] )
3959 for( i=0, j=1; i<n/2; i++,j++ )
3961 if( (*num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
3971 for( mu=0, i=0; i<
n; i++ )
3976 if( mu != (
int)(long)(l->
m[0].
Data( )) )
3985 for( pg=0, i=0; i<
n; i++ )
3987 if( (*num)[
i]<=(*den)[
i] )
3993 if( pg != (
int)(long)(l->
m[1].
Data( )) )
4022 WerrorS(
"first argument is not a spectrum:" );
4027 WerrorS(
"second argument is not a spectrum:" );
4060 int k = (int)(
long)second->
Data( );
4064 WerrorS(
"first argument is not a spectrum" );
4069 WerrorS(
"second argument should be positive" );
4106 WerrorS(
"first argument is not a spectrum" );
4111 WerrorS(
"second argument is not a spectrum" );
4135 memset(&tmp,0,
sizeof(tmp));
4154 WerrorS(
"Ground field not implemented!");
4174 LP->
m= (int)(
long)(v->
Data());
4180 LP->
n= (int)(
long)(v->
Data());
4186 LP->
m1= (int)(
long)(v->
Data());
4192 LP->
m2= (int)(
long)(v->
Data());
4198 LP->
m3= (int)(
long)(v->
Data());
4200 #ifdef mprDEBUG_PROT
4201 Print(
"m (constraints) %d\n",LP->
m);
4202 Print(
"n (columns) %d\n",LP->
n);
4226 lres->
m[4].
data=(
void*)(
long)LP->
m;
4229 lres->
m[5].
data=(
void*)(
long)LP->
n;
4231 res->
data= (
void*)lres;
4238 ideal gls = (ideal)(arg1->
Data());
4239 int imtype= (int)(
long)arg2->
Data();
4264 int howclean= (int)(
long)arg3->
Data();
4271 WerrorS(
"Ground field not implemented!");
4278 unsigned long int ii = (
unsigned long int)arg2->
Data();
4284 WerrorS(
"Input polynomial is constant!");
4312 if ( (vpos != i) && (
pGetExp( piter, i ) != 0) )
4314 WerrorS(
"The input polynomial must be univariate!");
4322 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4324 for ( i= deg; i >= 0; i-- )
4339 #ifdef mprDEBUG_PROT
4340 for (i=deg; i >= 0; i--)
4348 roots->
solver( howclean );
4355 rlist->
Init( elem );
4359 for ( j= 0; j < elem; j++ )
4368 for ( j= 0; j < elem; j++ )
4372 rlist->
m[
j].
data=(
void *)dummy;
4386 res->
data= (
void*)rlist;
4395 p= (ideal)arg1->
Data();
4396 w= (ideal)arg2->
Data();
4407 int tdg= (int)(
long)arg3->
Data();
4414 WerrorS(
"Last input parameter must be > 0!");
4422 if ( m != (
int)
pow((
double)tdg+1,(
double)n) )
4424 Werror(
"Size of second input ideal must be equal to %d!",
4425 (
int)
pow((
double)tdg+1,(
double)n));
4432 WerrorS(
"Ground field not implemented!");
4437 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4438 for ( i= 0; i <
n; i++ )
4447 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4456 WerrorS(
"Elements of first input ideal must be numbers!");
4459 pevpoint[
i]=
nCopy( tmp );
4463 number *wresults= (number *)
omAlloc( m *
sizeof( number ) );
4464 for ( i= 0; i <
m; i++ )
4473 WerrorS(
"Elements of second input ideal must be numbers!");
4488 res->
data= (
void*)rpoly;
4503 else gls= (ideal)(v->
Data());
4509 else imtype= (int)(
long)v->
Data();
4514 ideal test_id=
idInit(1,1);
4516 for(j=
IDELEMS(gls)-1;j>=0;j--)
4518 if (gls->m[j]!=
NULL)
4520 test_id->m[0]=gls->m[
j];
4524 WerrorS(
"Newton polytope not of expected dimension");
4538 unsigned long int ii=(
unsigned long int)v->
Data();
4546 else howclean= (int)(
long)v->
Data();
4575 WerrorS(
"Error occurred during matrix setup!");
4583 #ifdef mprDEBUG_PROT
4588 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4594 if ( interpolate_det )
4600 if ( interpolate_det )
4605 #ifdef mprDEBUG_PROT
4607 for (i=0; i < c; i++)
pWrite(iproots[i]->getPoly());
4609 for (i=0; i < c; i++)
pWrite(muiproots[i]->getPoly());
4613 arranger=
new rootArranger( iproots, muiproots, howclean );
4624 WerrorS(
"Solver was unable to find any roots!");
4630 for (i=0; i <
count; i++)
delete iproots[i];
4633 for (i=0; i <
count; i++)
delete muiproots[i];
4640 res->
data= (
void *)listofroots;
4652 int count=
self->roots[0]->getAnzRoots();
4653 int elem=
self->roots[0]->getAnzElems();
4657 if ( self->found_roots )
4659 listofroots->
Init( count );
4661 for (i=0; i <
count; i++)
4664 onepoint->
Init(elem);
4665 for ( j= 0; j < elem; j++ )
4681 listofroots->
m[
i].
data=(
void *)onepoint;
4689 listofroots->
Init( 0 );
4703 if (rg==
NULL)
return;
4723 Warn(
"deleting denom_list for ring change to %s",
IDID(h));
4735 if ((rg!=
NULL) && (rg->idroot==
NULL))
4763 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
4768 (*iv)[
i]= - (*iv)[
i];
4777 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
4782 (*iv)[
i]= -(*iv)[
i];
4791 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
4797 (*iv2)[2]=iv->
length()-2;
4809 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
4815 (*iv2)[2]=iv->
length()-2;
4849 (*iv)[2] += (*iv2)[2];
4856 if (!change) h=h->
next;
4864 int last = 0, o=0,
n = 1,
i=0, typ = 1,
j;
4876 R->bitmask=(*iv)[2];
4889 WerrorS(
"invalid combination of orderings");
4897 WerrorS(
"more than one ordering c/C specified");
4902 R->order=(
int *)
omAlloc0(
n*
sizeof(
int));
4903 R->block0=(
int *)
omAlloc0(
n*
sizeof(
int));
4904 R->block1=(
int *)
omAlloc0(
n*
sizeof(
int));
4907 int *weights=(
int*)
omAlloc0((R->N+1)*
sizeof(int));
4910 for (
j=0;
j <
n-1;
j++)
4931 R->order[
n] = (*iv)[1];
4941 R->block0[
n] = last+1;
4944 R->wvhdl[
n][
i-2] = (*iv)[
i];
4946 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
4948 R->block1[
n] =
last;
4959 R->block0[
n] = last+1;
4960 if (iv->
length() == 3) last+=(*iv)[2];
4961 else last += (*iv)[0];
4962 R->block1[
n] =
last;
4973 if (weights[
i]==0) weights[
i]=typ;
4985 const int s = (*iv)[2];
4995 const int s = (*iv)[2];
4997 if( 1 < s || s < -1 )
return TRUE;
5013 R->block0[
n] = last+1;
5018 R->wvhdl[
n][
i-2]=(*iv)[
i];
5020 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5022 last=R->block0[
n]-1;
5027 R->block0[
n] = last+1;
5030 if (R->block1[n]- R->block0[n]+2>=iv->
length())
5031 WarnS(
"missing module weights");
5032 for (
i=2;
i<=(R->block1[
n]-R->block0[
n]+2);
i++)
5034 R->wvhdl[
n][
i-2]=(*iv)[
i];
5036 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5038 R->wvhdl[
n][
i-2]=iv->
length() -3 -(R->block1[
n]- R->block0[
n]);
5041 R->wvhdl[
n][
i-1]=(*iv)[
i];
5043 last=R->block0[
n]-1;
5048 R->block0[
n] = last+1;
5056 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5058 last=R->block0[
n]-1;
5064 if (Mtyp==0)
return TRUE;
5065 if (Mtyp==-1) typ = -1;
5069 R->wvhdl[n][
i-2]=(*iv)[
i];
5071 R->block0[
n] = last+1;
5073 R->block1[
n] =
last;
5076 if (weights[
i]==0) weights[
i]=typ;
5086 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5105 if (R->block1[n] != R->N)
5116 R->block0[n] <= R->N)
5118 R->block1[
n] = R->N;
5122 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5129 for(
i=1;
i<=R->N;
i++)
5130 {
if (weights[
i]<0) { R->OrdSgn=-1;
break; }}
5183 mpz_ptr modBase =
NULL;
5184 unsigned int modExponent = 1;
5209 int ch = (int)(
long)pn->
Data();
5219 if ((ch<2)||(ch!=ch2))
5221 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5236 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5248 if ((ch!=0) && (ch!=
IsPrime(ch)))
5250 WerrorS(
"too many parameters");
5258 WerrorS(
"parameter expected");
5264 extParam.
r =
rDefault( ch, pars, names);
5265 for(
int i=pars-1;
i>=0;
i--)
5279 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5281 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5284 float_len=(int)(
long)pn->
next->
Data();
5285 float_len2=float_len;
5289 float_len2=(int)(
long)pn->
next->
Data();
5308 if (param.
float_len < SHORT_REAL_LENGTH)
5324 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5327 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
5328 mpz_init_set_si(modBase, 0);
5333 mpz_set_ui(modBase, (
int)(
long) pn->
next->
Data());
5335 if ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5337 modExponent = (long) pn->
next->
Data();
5340 while ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5342 mpz_mul_ui(modBase, modBase, (
int)(
long) pn->next->Data());
5356 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5358 Werror(
"Wrong ground ring specification (module is 1)");
5361 if (modExponent < 1)
5363 Werror(
"Wrong ground ring specification (exponent smaller than 1");
5368 if (modExponent > 1 && cf ==
NULL)
5370 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5381 if (mpz_cmp_ui(modBase,0)==0)
5383 WerrorS(
"modulus must not be 0 or parameter not allowed");
5389 info.
exp= modExponent;
5394 else if (cf ==
NULL)
5396 if (mpz_cmp_ui(modBase,0)==0)
5398 WerrorS(
"modulus must not be 0 or parameter not allowed");
5404 info.
exp= modExponent;
5414 extParam.
r = (ring)pn->
Data();
5420 extParam.
r = (ring)pn->
Data();
5426 Werror(
"Wrong or unknown ground field specification");
5454 Werror(
"Invalid ground field specification");
5470 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5478 WerrorS(
"name of ring variable expected");
5531 int *
perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(int));
5539 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5548 WerrorS(
"name of ring variable expected");
5558 for(;
i<org_ring->N;
i++)
5560 if (strcmp(org_ring->names[
i],R->names[
j])==0)
5568 Werror(
"variable %d (%s) not in basering",
j+1,R->names[
j]);
5581 for(
j=R->block0[
i];j<=R->block1[
i];
j++)
5585 if (min_var==-1) min_var=perm[
j];
5593 R->block0[
i]=min_var;
5594 R->block1[
i]=max_var;
5595 if (R->wvhdl[
i]!=
NULL)
5598 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(int));
5599 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
5603 R->wvhdl[
i][perm[
j]-R->block0[
i]]=
5604 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
5630 R->order[
j-1]=R->order[
j];
5631 R->block0[
j-1]=R->block0[
j];
5632 R->block1[
j-1]=R->block1[
j];
5634 R->wvhdl[
j-1]=R->wvhdl[
j];
5642 while (R->order[n]==0) n--;
5645 if (R->block1[n] != R->N)
5656 R->block0[n] <= R->N)
5658 R->block1[
n] = R->N;
5662 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
5663 R->N,R->block1[n],n);
5669 R->OrdSgn = org_ring->OrdSgn;
5692 if ((r->ref<=0)&&(r->order!=
NULL))
5697 if (r->qideal!=
NULL)
5703 #ifdef USE_IILOCALRING
5708 if (j+1==myynest)
Warn(
"killing the basering for level %d",j);
5718 for(; nshdl !=
NULL; nshdl = nshdl->
next)
5720 if (nshdl->
cRing==r)
5722 Warn(
"killing the basering for level %d",lev);
5730 while (r->idroot!=
NULL)
5733 killhdl2(r->idroot,&(r->idroot),r);
5829 resid=(ideal)(res.
data);
5882 ideal I=(ideal)u->
Data();
5885 for(i=I->nrows*I->ncols-1;i>=0;i--)
5897 switch (p->language)
5905 if(p->libname!=
NULL)
5906 Print(
",%s", p->libname);
5919 memset(&tmp_in,0,
sizeof(tmp_in));
5921 tmp_in.
data=(
void*)(
long)(*aa)[
i];
5925 bo=
jjPROC(&tmp_out,proc,&tmp_in);
5929 Werror(
"apply fails at index %d",
i+1);
5932 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
5937 memcpy(curr,&tmp_out,
sizeof(tmp_out));
5959 for(
int i=0;
i<=aa->
nr;
i++)
5961 memset(&tmp_in,0,
sizeof(tmp_in));
5962 tmp_in.
Copy(&(aa->
m[
i]));
5966 bo=
jjPROC(&tmp_out,proc,&tmp_in);
5971 Werror(
"apply fails at index %d",
i+1);
5974 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
5979 memcpy(curr,&tmp_out,
sizeof(tmp_out));
5986 memset(res,0,
sizeof(
sleftv));
6002 WerrorS(
"first argument to `apply` must allow an index");
6012 char assume_yylinebuf[80];
6014 int lev=(long)a->
Data();
6021 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6035 char *ss=(
char*)
omAlloc(strlen(a)+strlen(s)+30);
6037 int end_s=strlen(s);
6038 while ((end_s>0) && ((s[end_s]<=
' ')||(s[end_s]==
';'))) end_s--;
6040 char *
name=(
char *)
omAlloc(strlen(a)+strlen(s)+30);
6041 sprintf(name,
"%s->%s",a,s);
6043 int start_s=end_s-1;
6044 while ((start_s>=0) && (s[start_s]!=
';')) start_s--;
6047 sprintf(ss,
"parameter def %s;return(%s);\n",a,s);
6052 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6054 memset(r,0,
sizeof(*r));
6070 char* ring_name=(
char*)r->
Name();
6075 memset(&tmp,0,
sizeof(tmp));
6093 memset(&n,0,
sizeof(n));
6109 sprintf(buf,
"wrong length of parameters(%d), expected ",t);
6111 sprintf(buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6112 for(
int i=1;
i<=T[0];
i++)
6117 if (i<T[0]) strcat(buf,
",");
6126 if (type_list[0]==0)
return TRUE;
6129 if (report)
WerrorS(
"no arguments expected");
6134 if (l!=(
int)type_list[0])
6139 for(
int i=1;
i<=
l;
i++,args=args->
next)
6141 short t=type_list[
i];
6145 || (t!=args->Typ()))
int status int void size_t count
BOOLEAN jjCHARSERIES(leftv res, leftv u)
for idElimination, like a, except pFDeg, pWeigths ignore it
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
complex root finder for univariate polynomials based on laguers algorithm
#define omRealloc0Size(addr, o_size, size)
#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)
unsigned char * proc[NUM_PROC]
#define omCheckAddrSize(addr, size)
void atSet(idhdl root, const char *name, void *data, int typ)
Class used for (list of) interpreter objects.
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
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)
ring rCompose(const lists L, const BOOLEAN check_comp)
only used if HAVE_RINGS is defined: ?
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
static int si_min(const int a, const int b)
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Linear Programming / Linear Optimization using Simplex - Algorithm.
Compatiblity layer for legacy polynomial operations (over currRing)
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
BOOLEAN 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)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
static int * multiplicity
poly singclap_resultant(poly f, poly g, poly x, const ring r)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
intvec * id_QHomWeight(ideal id, const ring r)
BOOLEAN nuVanderSys(leftv res, leftv arg1, leftv arg2, leftv arg3)
COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consi...
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
BOOLEAN spectrumProc(leftv result, leftv first)
static BOOLEAN rField_is_Q_a(const ring r)
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
denominator_list DENOMINATOR_LIST
uResultant::resMatType determineMType(int imtype)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
BOOLEAN iiAssignCR(leftv r, leftv arg)
static long p_Totaldegree(poly p, const ring r)
poly iiHighCorner(ideal I, int ak)
bool solver(const int polishmode=PM_NONE)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
BOOLEAN hasConstTerm(poly h, const ring r)
void WerrorS(const char *s)
static BOOLEAN rField_is_GF(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
void nlGMP(number &i, number n, const coeffs r)
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.
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)
return the maximal component number found in any polynomial in s
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 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()
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)
gives an ideal/module the minimal possible size
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
static void rRenameVars(ring R)
static 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)
initialise an ideal / module
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)
BOOLEAN idIsZeroDim(ideal i)
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)
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 idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
void syKillEmptyEntres(resolvente res, int length)
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
int mult_spectrum(spectrum &)
lists listOfRoots(rootArranger *self, const unsigned int oprec)
static BOOLEAN rField_is_numeric(const ring r)
BOOLEAN lRingDependend(lists L)
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
void copy_deep(spectrum &spec, lists l)
void delete_node(spectrumPolyNode **)
void Werror(const char *fmt,...)
void idDelete(ideal *h)
delete an ideal
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)