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);
510 package save_p=currPack;
544 Warn(
"Gerhard, use the option command");
606 WerrorS(
"write: need at least two arguments");
614 if ((l!=
NULL)&&(l->name!=
NULL)) s=l->name;
616 Werror(
"cannot write to %s",s);
643 Werror(
"can not map from ground field of %s to current ground field",
647 if (
IDELEMS(theMap)<src_ring->N)
651 (src_ring->N)*
sizeof(
poly));
652 for(i=
IDELEMS(theMap);i<src_ring->N;i++)
658 WerrorS(
"argument of a map must have a name");
665 memset(&tmpW,0,
sizeof(
sleftv));
670 save_r=
IDMAP(w)->preimage;
671 IDMAP(w)->preimage=0;
680 ideal
id=(ideal)tmpW.
data;
681 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
683 if (theMap->m[
j]!=
NULL)
686 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
701 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
703 if (theMap->m[
j]!=
NULL)
717 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
735 char *tmp = theMap->preimage;
736 theMap->preimage=(
char*)1L;
739 theMap->preimage=tmp;
747 if (save_r!=
NULL)
IDMAP(w)->preimage=save_r;
753 IDMAP(w)->preimage=save_r;
761 Werror(
"%s undefined in %s",what,theMap->preimage);
766 Werror(
"cannot find preimage %s",theMap->preimage);
778 char *
s=(
char *)
omAlloc(strlen(name)+5);
782 sprintf(s,
"%s(%d)",name,i+1);
792 Print(
"//defining: %s as %d-th syzygy module\n",s,i+1);
797 Warn(
"cannot define %s",s);
877 int add_row_shift = 0;
880 if (weights!=
NULL) add_row_shift=weights->
min_in();
895 memset(&tmp,0,
sizeof(tmp));
915 memset(&tmp2,0,
sizeof(tmp2));
939 add_row_shift = ww->
min_in();
940 (*weights) -= add_row_shift;
949 if (weights!=
NULL)
delete weights;
967 add_row_shift = ww->
min_in();
968 (*weights) -= add_row_shift;
973 if (weights!=
NULL)
delete weights;
976 return reg+1+add_row_shift;
980 #define BREAK_LINE_LENGTH 80 1007 else if(strncmp(s,
"cont;",5)==0)
1014 strcat( s,
"\n;~\n");
1085 res->
m[
i].
data = (
void *)save->set;
1095 for (i=hMu;i<hMu+
hMu2;i++)
1097 res->
m[
i].
data = (
void *)save->set;
1122 const char *
id = name->
name;
1124 memset(sy,0,
sizeof(
sleftv));
1127 WerrorS(
"object to declare is not a name");
1164 if (iiCurrProc!=
NULL)
1169 memset(&tmp,0,
sizeof(
sleftv));
1181 if (ll!=(l-1))
return FALSE;
1183 short *t=(
short*)
omAlloc(l*
sizeof(
short));
1187 for(i=1;i<
l;i++,h=h->
next)
1192 Werror(
"arg %d is not a string",i);
1196 b=
IsCmd((
char *)h->Data(),tt);
1201 Werror(
"arg %d is not a type name",i);
1208 Werror(
"last arg (%d) is not a proc",i);
1213 if (b && (h->rtyp==
IDHDL) && (h->e==
NULL))
1219 if(
pi->data.s.body==
NULL )
1233 if (iiCurrArgs!=
NULL)
1235 if (!err)
Warn(
"too many arguments for %s",
IDID(iiCurrProc));
1246 if (iiCurrArgs==
NULL)
1248 if (strcmp(p->
name,
"#")==0)
1257 if (strcmp(p->
name,
"#")==0)
1259 is_default_list=
TRUE;
1267 if (is_default_list)
1315 #ifdef USE_IILOCALRING 1335 if (keepring)
IDRING(h)->ref--;
1347 Warn(
"'%s': no such identifier\n", v->
name);
1350 package frompack=v->req_packhdl;
1365 if (h==frompack->idroot)
1367 frompack->idroot=h->
next;
1371 idhdl hh=frompack->idroot;
1372 while ((hh!=
NULL) && (hh->
next!=h))
1382 h->
next=rootpack->idroot;
1522 WarnS(
"package not found\n");
1555 r->order = (
int *)
omAlloc(3 *
sizeof(
int *));
1556 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1557 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1576 if (h!=
NULL)
return h;
1578 if (h!=
NULL)
return h;
1585 if (h!=
NULL)
return h;
1593 if (h!=
NULL)
return h;
1612 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1618 for(i=0; i<r->N; i++)
1624 L->
m[1].
data=(
void *)LL;
1641 if (r->block1[i]-r->block0[i] >=0 )
1643 j=r->block1[
i]-r->block0[
i];
1646 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1648 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][
j];
1650 else switch (r->order[i])
1657 for(;j>=0; j--) (*iv)[
j]=1;
1667 LLL->
m[1].
data=(
void *)iv;
1668 LL->
m[
i].
data=(
void *)LLL;
1671 L->
m[2].
data=(
void *)LL;
1681 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1682 L->
m[3].
data=(
void *)q;
1702 L->
m[0].
data=(
void *)0;
1712 L->
m[1].
data=(
void *)LL;
1737 L->
m[0].
data=(
void *)0;
1747 L->
m[1].
data=(
void *)LL;
1783 LL->
m[1].
data=(
void *) C->modExponent;
1785 L->
m[1].
data=(
void *)LL;
1810 LL->
m[0].
data=
nlMapGMP((number) R->cf->modBase, R->cf, R->cf);
1812 LL->
m[1].
data=(
void *) R->cf->modExponent;
1814 L->
m[1].
data=(
void *)LL;
1828 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1841 else if ( C->extRing!=
NULL )
1851 Lc->
m[0].
data=(
void*)(
long)C->m_nfCharQ;
1858 Lc->
m[1].
data=(
void*)Lv;
1869 Loo->
m[1].
data=(
void *)iv;
1872 Lo->
m[0].
data=(
void*)Loo;
1875 Lc->
m[2].
data=(
void*)Lo;
1881 res->
data=(
void*)Lc;
1886 res->
data=(
void *)(
long)C->ch;
1903 || (r->qideal !=
NULL)
1910 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1928 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
1934 for(i=0; i<r->N; i++)
1937 LL->m[
i].data=(
void *)
omStrDup(r->names[i]);
1940 L->
m[1].
data=(
void *)LL;
1960 assume( r->block0[i] == r->block1[i] );
1961 const int s = r->block0[
i];
1962 assume( -2 < s && s < 2);
1967 else if (r->block1[i]-r->block0[i] >=0 )
1969 int bl=j=r->block1[
i]-r->block0[
i];
1977 j+=r->wvhdl[
i][bl+1];
1980 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1982 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
1984 else switch (r->order[i])
1991 for(;j>=0; j--) (*iv)[
j]=1;
2001 LLL->
m[1].
data=(
void *)iv;
2002 LL->m[
i].data=(
void *)LLL;
2005 L->
m[2].
data=(
void *)LL;
2009 if (r->qideal==
NULL)
2014 #ifdef HAVE_PLURAL // NC! in rDecompose 2027 #ifndef SINGULAR_4_1 2037 || (r->qideal !=
NULL)
2044 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2071 else if ( r->cf->extRing!=
NULL )
2081 Lc->
m[0].
data=(
void*)(
long)r->cf->m_nfCharQ;
2088 Lc->
m[1].
data=(
void*)Lv;
2099 Loo->
m[1].
data=(
void *)iv;
2102 Lo->
m[0].
data=(
void*)Loo;
2105 Lc->
m[2].
data=(
void*)Lo;
2111 L->
m[0].
data=(
void*)Lc;
2116 L->
m[0].
data=(
void *)(
long)r->cf->ch;
2123 for(i=0; i<r->N; i++)
2129 L->
m[1].
data=(
void *)LL;
2149 assume( r->block0[i] == r->block1[i] );
2150 const int s = r->block0[
i];
2151 assume( -2 < s && s < 2);
2156 else if (r->block1[i]-r->block0[i] >=0 )
2158 int bl=j=r->block1[
i]-r->block0[
i];
2166 j+=r->wvhdl[
i][bl+1];
2169 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
2171 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
2173 else switch (r->order[i])
2180 for(;j>=0; j--) (*iv)[
j]=1;
2190 LLL->
m[1].
data=(
void *)iv;
2191 LL->
m[
i].
data=(
void *)LLL;
2194 L->
m[2].
data=(
void *)LL;
2198 if (r->qideal==
NULL)
2203 #ifdef HAVE_PLURAL // NC! in rDecompose 2223 Werror(
"invald coeff. field description, expecting 0");
2230 Werror(
"invald coeff. field description, expecting precision list");
2232 int r1=(
int)(long)LL->
m[0].
data;
2233 int r2=(
int)(long)LL->
m[1].
data;
2255 R->cf->float_len=
si_min(r1,32767);
2256 R->cf->float_len2=
si_min(r2,32767);
2265 Werror(
"invald coeff. field description, expecting parameter name");
2281 mpz_ptr modBase =
NULL;
2282 unsigned int modExponent = 1;
2284 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
2287 mpz_init_set_ui(modBase,0);
2298 number tmp= (number) LL->
m[0].
data;
2304 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2308 mpz_init_set_ui(modBase,0);
2312 modExponent = (
unsigned long) LL->
m[1].
data;
2320 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
2322 Werror(
"Wrong ground ring specification (module is 1)");
2325 if (modExponent < 1)
2327 Werror(
"Wrong ground ring specification (exponent smaller than 1");
2331 if (mpz_cmp_ui(modBase, 0) == 0)
2336 else if (modExponent > 1)
2339 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2351 info.
exp= modExponent;
2362 info.
exp= modExponent;
2375 for(i=0;i<R->N-1;i++)
2377 for(j=i+1;j<R->N;j++)
2379 if (strcmp(R->names[i],R->names[j])==0)
2382 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",i+1,j+1,R->names[i],R->names[i]);
2384 R->names[
j]=(
char *)
omAlloc(2+strlen(R->names[i]));
2385 sprintf(R->names[j],
"@%s",R->names[i]);
2391 for(i=0;i<
rPar(R); i++)
2397 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",i+1,j+1,R->names[j],i+1);
2403 sprintf(R->names[j],
"@@(%d)",i+1);
2441 int ch = (int)(
long)L->
m[0].
Data();
2451 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch, l);
2474 int ch = (int)(
long)LL->
m[0].
Data();
2475 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2476 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2497 WerrorS(
"could not create the specified coefficient field");
2501 if( extRing->qideal !=
NULL )
2505 extParam.
r = extRing;
2512 extParam.
r = extRing;
2529 WerrorS(
"coefficient field must be described by `int` or `list`");
2535 WerrorS(
"could not create coefficient field described by the input!");
2563 Werror(
"var name %d must be a string or a ring variable",i+1);
2569 Werror(
"var name %d must be `string`",i+1);
2576 WerrorS(
"variable must be given as `list`");
2586 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
2587 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2588 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2591 for (j=0; j < n-1; j++)
2599 WerrorS(
"ordering must be list of lists");
2607 WerrorS(
"ordering name must be a (string,intvec)");
2612 if (j==0) R->block0[0]=1;
2629 if (jj<0) R->block0[
j]=1;
2630 else R->block0[
j]=R->block1[jj]+1;
2638 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+iv_len-1);
2639 if (R->block1[j]>R->N)
2642 iv_len=R->block1[
j]-R->block0[
j]+1;
2646 switch (R->order[j])
2655 R->wvhdl[
j] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2656 for (i=0; i<iv_len;i++)
2658 R->wvhdl[
j][
i]=(*iv)[
i];
2663 for (i=0; i<iv_len;i++)
2665 R->wvhdl[
j][
i]=(*iv)[
i];
2667 R->wvhdl[
j][
i]=iv->
length() - iv_len;
2669 for (; i<iv->
length(); i++)
2671 R->wvhdl[
j][i+1]=(*iv)[
i];
2676 for (i=0; i<iv->
length();i++) R->wvhdl[j][i]=(*iv)[
i];
2677 R->block1[
j]=
si_max(R->block0[j],R->block0[j]+(
int)
sqrt((
double)(iv->
length()-1)));
2678 if (R->block1[j]>R->N)
2680 WerrorS(
"ordering matrix too big");
2698 R->block1[
j]=R->block0[
j]=0;
2706 R->block1[
j] = R->block0[
j] = 0;
2709 const int s = (*iv)[0];
2710 assume( -2 < s && s < 2 );
2711 R->block1[
j] = R->block0[
j] =
s;
2726 if (R->block1[j] != R->N)
2737 R->block0[j] <= R->N)
2739 R->block1[
j] = R->N;
2743 Werror(
"ordering incomplete: size (%d) should be %d",R->block1[j],R->N);
2747 if (R->block0[j]>R->N)
2749 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",R->N,j+1);
2750 for(
int ii=0;ii<=
j;ii++)
2751 Werror(
"ord[%d]: %s from v%d to v%d",ii+1,
rSimpleOrdStr(R->order[ii]),R->block0[ii],R->block1[ii]);
2765 R->order=(
int*)
omRealloc0Size(R->order,n*
sizeof(
int),(n+1)*
sizeof(
int));
2766 R->block0=(
int*)
omRealloc0Size(R->block0,n*
sizeof(
int),(n+1)*
sizeof(
int));
2767 R->block1=(
int*)
omRealloc0Size(R->block1,n*
sizeof(
int),(n+1)*
sizeof(
int));
2779 WerrorS(
"ordering must be given as `list`");
2802 ideal q=(ideal)L->
m[3].
Data();
2808 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2815 int par_perm_size=0;
2834 par_perm_size=
rPar(orig_ring);
2844 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2848 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(int));
2849 if (par_perm_size!=0)
2850 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2854 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2863 else if (par_perm_size!=0)
2868 for(i=
IDELEMS(q)-1; i>=0; i--)
2871 par_perm,par_perm_size);
2873 pTest(dest_id->m[i]);
2889 WerrorS(
"q-ideal must be given as `ideal`");
2917 while (i>=0) {
if (R->names[i]!=
NULL)
omFree(R->names[i]); i--; }
2938 ideal
id=(ideal)a->
Data();
2941 for (i=1; i<=
IDELEMS(
id); i++)
2948 res->
data=(
char *)result;
2958 int n=(int)(
long)b->
Data();
2959 int d=(int)(
long)c->
Data();
2966 if ((d>n) || (d<1) || (n<1))
2971 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
2975 temp=(ideal)id->
Data();
2988 if (choise[l-1]<=
IDELEMS(temp))
2990 p =
pCopy(temp->m[choise[l-1]-1]);
2991 if (sign == -1) p =
pNeg(p);
3002 res->
data=(
char *)result;
3017 int add_row_shift=0;
3023 add_row_shift = ww->
min_in();
3024 (*weights) -= add_row_shift;
3037 memset(&tmp,0,
sizeof(tmp));
3051 const int length = syzstr->
length;
3053 if ((fullres==
NULL) && (minres==
NULL))
3079 for (
int i=(length)-1;
i>=0;
i--)
3091 for (
int i=length-1;
i>=0;
i--)
3142 if (toDel) li->
Clean();
3167 ideal F=(ideal)id->
Data();
3173 res->
data=(
char *)iv;
3177 double wNsqr = (double)2.0 / (
double)n;
3179 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(int));
3181 for (i = n; i!=0; i--)
3182 (*iv)[i-1] = x[i + n + 1];
3200 res->
data=(
void *)b;
3218 #ifdef HAVE_SPECTRUM 3226 spec.
mu = (int)(
long)(l->
m[0].
Data( ));
3227 spec.
pg = (int)(
long)(l->
m[1].
Data( ));
3228 spec.
n = (int)(
long)(l->
m[2].
Data( ));
3236 for(
int i=0;
i<spec.
n;
i++ )
3239 spec.
w[
i] = (*mul)[
i];
3270 for(
int i=0;
i<spec.
n;
i++ )
3274 (*mult)[
i] = spec.
w[
i];
3284 L->
m[0].
data = (
void*)(
long)spec.
mu;
3285 L->
m[1].
data = (
void*)(
long)spec.
pg;
3286 L->
m[2].
data = (
void*)(
long)spec.
n;
3287 L->
m[3].
data = (
void*)num;
3288 L->
m[4].
data = (
void*)den;
3289 L->
m[5].
data = (
void*)mult;
3337 WerrorS(
"the list is too short" );
3340 WerrorS(
"the list is too long" );
3344 WerrorS(
"first element of the list should be int" );
3347 WerrorS(
"second element of the list should be int" );
3350 WerrorS(
"third element of the list should be int" );
3353 WerrorS(
"fourth element of the list should be intvec" );
3356 WerrorS(
"fifth element of the list should be intvec" );
3359 WerrorS(
"sixth element of the list should be intvec" );
3363 WerrorS(
"first element of the list should be positive" );
3366 WerrorS(
"wrong number of numerators" );
3369 WerrorS(
"wrong number of denominators" );
3372 WerrorS(
"wrong number of multiplicities" );
3376 WerrorS(
"the Milnor number should be positive" );
3379 WerrorS(
"the geometrical genus should be nonnegative" );
3382 WerrorS(
"all numerators should be positive" );
3385 WerrorS(
"all denominators should be positive" );
3388 WerrorS(
"all multiplicities should be positive" );
3392 WerrorS(
"it is not symmetric" );
3395 WerrorS(
"it is not monotonous" );
3399 WerrorS(
"the Milnor number is wrong" );
3402 WerrorS(
"the geometrical genus is wrong" );
3406 WerrorS(
"unspecific error" );
3442 ( fast==2 ? 2 : 1 ) );
3452 ( fast==0 || (*node)->weight<=smax ) )
3474 cmp =
pCmp( (*node)->mon,f );
3497 (*node)->nf = search->
nf;
3501 while( cmp<0 && f!=(
poly)NULL );
3503 search = search->
next;
3514 if( (*node)->weight<=(
Rational)1 ) pg++;
3515 if( (*node)->weight==smax ) z++;
3516 if( (*node)->weight>weight_prev ) n++;
3518 weight_prev = (*node)->weight;
3519 node = &((*node)->next);
3541 cmp =
pCmp( (*node)->mon,f );
3556 search = search->
next;
3570 n = ( z > 0 ? 2*n - 1 : 2*n );
3585 ( fast==0 || search->
weight<=smax );
3586 search=search->
next )
3611 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3614 (*den) [n2] = (*den)[n1];
3615 (*mult)[n2] = (*mult)[n1];
3623 if( fast==0 || fast==1 )
3627 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3629 if( (*mult)[n1]!=(*mult)[n2] ||
3630 (*den) [n1]!= (*den)[n2] ||
3637 if( symmetric==
FALSE )
3647 (*L)->m[0].data = (
void*)(
long)
mu;
3664 (*L)->m[0].data = (
void*)(
long)
mu;
3665 (*L)->m[1].data = (
void*)(
long)pg;
3666 (*L)->m[2].data = (
void*)(
long)n;
3667 (*L)->m[3].data = (
void*)nom;
3668 (*L)->m[4].data = (
void*)den;
3669 (*L)->m[5].data = (
void*)mult;
3678 #ifdef SPECTRUM_DEBUG 3679 #ifdef SPECTRUM_PRINT 3680 #ifdef SPECTRUM_IOSTREAM 3681 cout <<
"spectrumCompute\n";
3682 if( fast==0 ) cout <<
" no optimization" << endl;
3683 if( fast==1 ) cout <<
" weight optimization" << endl;
3684 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3686 fprintf( stdout,
"spectrumCompute\n" );
3687 if( fast==0 ) fprintf( stdout,
" no optimization\n" );
3688 if( fast==1 ) fprintf( stdout,
" weight optimization\n" );
3689 if( fast==2 ) fprintf( stdout,
" symmetry optimization\n" );
3733 #ifdef SPECTRUM_DEBUG 3734 #ifdef SPECTRUM_PRINT 3735 #ifdef SPECTRUM_IOSTREAM 3736 cout <<
"\n computing the Jacobi ideal...\n";
3738 fprintf( stdout,
"\n computing the Jacobi ideal...\n" );
3747 #ifdef SPECTRUM_DEBUG 3748 #ifdef SPECTRUM_PRINT 3749 #ifdef SPECTRUM_IOSTREAM 3752 fprintf( stdout,
" " );
3763 #ifdef SPECTRUM_DEBUG 3764 #ifdef SPECTRUM_PRINT 3765 #ifdef SPECTRUM_IOSTREAM 3767 cout <<
" computing a standard basis..." << endl;
3769 fprintf( stdout,
"\n" );
3770 fprintf( stdout,
" computing a standard basis...\n" );
3778 #ifdef SPECTRUM_DEBUG 3779 #ifdef SPECTRUM_PRINT 3780 for( i=0; i<
IDELEMS(stdJ); i++ )
3782 #ifdef SPECTRUM_IOSTREAM 3785 fprintf( stdout,
" " );
3830 #ifdef SPECTRUM_DEBUG 3831 #ifdef SPECTRUM_PRINT 3832 #ifdef SPECTRUM_IOSTREAM 3833 cout <<
"\n computing the highest corner...\n";
3835 fprintf( stdout,
"\n computing the highest corner...\n" );
3844 if( hc!=(
poly)NULL )
3859 #ifdef SPECTRUM_DEBUG 3860 #ifdef SPECTRUM_PRINT 3861 #ifdef SPECTRUM_IOSTREAM 3864 fprintf( stdout,
" " );
3874 #ifdef SPECTRUM_DEBUG 3875 #ifdef SPECTRUM_PRINT 3876 #ifdef SPECTRUM_IOSTREAM 3877 cout <<
"\n computing the newton polygon...\n";
3879 fprintf( stdout,
"\n computing the newton polygon...\n" );
3886 #ifdef SPECTRUM_DEBUG 3887 #ifdef SPECTRUM_PRINT 3896 #ifdef SPECTRUM_DEBUG 3897 #ifdef SPECTRUM_PRINT 3898 #ifdef SPECTRUM_IOSTREAM 3899 cout <<
"\n computing the weight corner...\n";
3901 fprintf( stdout,
"\n computing the weight corner...\n" );
3911 #ifdef SPECTRUM_DEBUG 3912 #ifdef SPECTRUM_PRINT 3913 #ifdef SPECTRUM_IOSTREAM 3916 fprintf( stdout,
" " );
3926 #ifdef SPECTRUM_DEBUG 3927 #ifdef SPECTRUM_PRINT 3928 #ifdef SPECTRUM_IOSTREAM 3929 cout <<
"\n computing NF...\n" << endl;
3931 fprintf( stdout,
"\n computing NF...\n" );
3940 #ifdef SPECTRUM_DEBUG 3941 #ifdef SPECTRUM_PRINT 3943 #ifdef SPECTRUM_IOSTREAM 3946 fprintf( stdout,
"\n" );
3971 WerrorS(
"polynomial is zero" );
3974 WerrorS(
"polynomial has constant term" );
3977 WerrorS(
"not a singularity" );
3980 WerrorS(
"the singularity is not isolated" );
3983 WerrorS(
"highest corner cannot be computed" );
3986 WerrorS(
"principal part is degenerate" );
3992 WerrorS(
"unknown error occurred" );
4009 WerrorS(
"only works for local orderings" );
4017 WerrorS(
"does not work in quotient rings" );
4030 result->
data = (
char*)L;
4063 WerrorS(
"only works for local orderings" );
4068 WerrorS(
"does not work in quotient rings" );
4081 result->
data = (
char*)L;
4127 else if( l->
nr > 5 )
4165 int mu = (int)(
long)(l->
m[0].
Data( ));
4166 int pg = (int)(
long)(l->
m[1].
Data( ));
4167 int n = (int)(
long)(l->
m[2].
Data( ));
4178 if( n != num->
length( ) )
4182 else if( n != den->
length( ) )
4186 else if( n != mul->
length( ) )
4206 for( i=0; i<n; i++ )
4208 if( (*num)[
i] <= 0 )
4212 if( (*den)[
i] <= 0 )
4216 if( (*mul)[
i] <= 0 )
4228 for( i=0, j=n-1; i<=
j; i++,j-- )
4231 (*den)[
i] != (*den)[
j] ||
4232 (*mul)[
i] != (*mul)[
j] )
4242 for( i=0, j=1; i<n/2; i++,j++ )
4244 if( (*num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
4254 for( mu=0, i=0; i<n; i++ )
4259 if( mu != (
int)(long)(l->
m[0].
Data( )) )
4268 for( pg=0, i=0; i<n; i++ )
4270 if( (*num)[
i]<=(*den)[
i] )
4276 if( pg != (
int)(long)(l->
m[1].
Data( )) )
4305 WerrorS(
"first argument is not a spectrum:" );
4310 WerrorS(
"second argument is not a spectrum:" );
4343 int k = (int)(
long)second->
Data( );
4347 WerrorS(
"first argument is not a spectrum" );
4352 WerrorS(
"second argument should be positive" );
4389 WerrorS(
"first argument is not a spectrum" );
4394 WerrorS(
"second argument is not a spectrum" );
4418 memset(&tmp,0,
sizeof(tmp));
4437 WerrorS(
"Ground field not implemented!");
4457 LP->
m= (int)(
long)(v->
Data());
4463 LP->
n= (int)(
long)(v->
Data());
4469 LP->
m1= (int)(
long)(v->
Data());
4475 LP->
m2= (int)(
long)(v->
Data());
4481 LP->
m3= (int)(
long)(v->
Data());
4483 #ifdef mprDEBUG_PROT 4484 Print(
"m (constraints) %d\n",LP->
m);
4485 Print(
"n (columns) %d\n",LP->
n);
4509 lres->
m[4].
data=(
void*)(
long)LP->
m;
4512 lres->
m[5].
data=(
void*)(
long)LP->
n;
4514 res->
data= (
void*)lres;
4521 ideal gls = (ideal)(arg1->
Data());
4522 int imtype= (int)(
long)arg2->
Data();
4547 int howclean= (int)(
long)arg3->
Data();
4554 WerrorS(
"Ground field not implemented!");
4561 unsigned long int ii = (
unsigned long int)arg2->
Data();
4567 WerrorS(
"Input polynomial is constant!");
4595 if ( (vpos != i) && (
pGetExp( piter, i ) != 0) )
4597 WerrorS(
"The input polynomial must be univariate!");
4605 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4607 for ( i= deg; i >= 0; i-- )
4622 #ifdef mprDEBUG_PROT 4623 for (i=deg; i >= 0; i--)
4631 roots->
solver( howclean );
4638 rlist->
Init( elem );
4642 for ( j= 0; j < elem; j++ )
4651 for ( j= 0; j < elem; j++ )
4655 rlist->
m[
j].
data=(
void *)dummy;
4669 res->
data= (
void*)rlist;
4678 p= (ideal)arg1->
Data();
4679 w= (ideal)arg2->
Data();
4690 int tdg= (int)(
long)arg3->
Data();
4697 WerrorS(
"Last input parameter must be > 0!");
4705 if ( m != (
int)
pow((
double)tdg+1,(
double)n) )
4707 Werror(
"Size of second input ideal must be equal to %d!",
4708 (
int)
pow((
double)tdg+1,(
double)n));
4715 WerrorS(
"Ground field not implemented!");
4720 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4721 for ( i= 0; i < n; i++ )
4730 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4739 WerrorS(
"Elements of first input ideal must be numbers!");
4742 pevpoint[
i]=
nCopy( tmp );
4746 number *wresults= (number *)
omAlloc( m *
sizeof( number ) );
4747 for ( i= 0; i <
m; i++ )
4756 WerrorS(
"Elements of second input ideal must be numbers!");
4771 res->
data= (
void*)rpoly;
4786 else gls= (ideal)(v->
Data());
4792 else imtype= (int)(
long)v->
Data();
4797 ideal test_id=
idInit(1,1);
4799 for(j=
IDELEMS(gls)-1;j>=0;j--)
4801 if (gls->m[j]!=
NULL)
4803 test_id->m[0]=gls->m[
j];
4807 WerrorS(
"Newton polytope not of expected dimension");
4821 unsigned long int ii=(
unsigned long int)v->
Data();
4829 else howclean= (int)(
long)v->
Data();
4858 WerrorS(
"Error occurred during matrix setup!");
4866 #ifdef mprDEBUG_PROT 4871 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4877 if ( interpolate_det )
4883 if ( interpolate_det )
4888 #ifdef mprDEBUG_PROT 4890 for (i=0; i < c; i++)
pWrite(iproots[i]->getPoly());
4892 for (i=0; i < c; i++)
pWrite(muiproots[i]->getPoly());
4896 arranger=
new rootArranger( iproots, muiproots, howclean );
4907 WerrorS(
"Solver was unable to find any roots!");
4913 for (i=0; i <
count; i++)
delete iproots[i];
4916 for (i=0; i <
count; i++)
delete muiproots[i];
4923 res->
data= (
void *)listofroots;
4935 int count=
self->roots[0]->getAnzRoots();
4936 int elem=
self->roots[0]->getAnzElems();
4940 if ( self->found_roots )
4942 listofroots->
Init( count );
4944 for (i=0; i <
count; i++)
4947 onepoint->
Init(elem);
4948 for ( j= 0; j < elem; j++ )
4964 listofroots->
m[
i].
data=(
void *)onepoint;
4972 listofroots->
Init( 0 );
4986 if (rg==
NULL)
return;
5006 Warn(
"deleting denom_list for ring change to %s",
IDID(h));
5018 if ((rg!=
NULL) && (rg->idroot==
NULL))
5046 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5051 (*iv)[
i]= - (*iv)[
i];
5060 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5065 (*iv)[
i]= -(*iv)[
i];
5074 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5080 (*iv2)[2]=iv->
length()-2;
5092 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5098 (*iv2)[2]=iv->
length()-2;
5132 (*iv)[2] += (*iv2)[2];
5139 if (!change) h=h->
next;
5147 int last = 0, o=0, n = 1,
i=0, typ = 1,
j;
5159 R->bitmask=(*iv)[2];
5172 WerrorS(
"invalid combination of orderings");
5180 WerrorS(
"more than one ordering c/C specified");
5185 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
5186 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
5187 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
5190 int *weights=(
int*)
omAlloc0((R->N+1)*
sizeof(int));
5193 for (
j=0;
j < n-1;
j++)
5214 R->order[n] = (*iv)[1];
5224 R->block0[n] = last+1;
5227 R->wvhdl[n][
i-2] = (*iv)[
i];
5229 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5231 R->block1[n] =
si_min(last,R->N);
5242 R->block0[n] = last+1;
5243 if (iv->
length() == 3) last+=(*iv)[2];
5244 else last += (*iv)[0];
5245 R->block1[n] =
si_min(last,R->N);
5249 if (weights[
i]==0) weights[
i]=typ;
5261 const int s = (*iv)[2];
5271 const int s = (*iv)[2];
5273 if( 1 < s || s < -1 )
return TRUE;
5289 R->block0[n] = last+1;
5294 R->wvhdl[n][
i-2]=(*iv)[
i];
5296 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5298 last=R->block0[n]-1;
5303 R->block0[n] = last+1;
5306 if (R->block1[n]- R->block0[n]+2>=iv->
length())
5307 WarnS(
"missing module weights");
5308 for (
i=2;
i<=(R->block1[n]-R->block0[n]+2);
i++)
5310 R->wvhdl[n][
i-2]=(*iv)[
i];
5312 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5314 R->wvhdl[n][
i-2]=iv->
length() -3 -(R->block1[n]- R->block0[n]);
5317 R->wvhdl[n][
i-1]=(*iv)[
i];
5319 last=R->block0[n]-1;
5324 R->block0[n] = last+1;
5332 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5334 last=R->block0[n]-1;
5340 if (Mtyp==0)
return TRUE;
5341 if (Mtyp==-1) typ = -1;
5345 R->wvhdl[n][
i-2]=(*iv)[
i];
5347 R->block0[n] = last+1;
5349 R->block1[n] =
si_min(last,R->N);
5350 for(
i=R->block1[n];
i>=R->block0[n];
i--)
5352 if (weights[
i]==0) weights[
i]=typ;
5362 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5369 Werror(
"mismatch of number of vars (%d) and ordering (>=%d vars)",
5387 if (R->block1[n] != R->N)
5398 R->block0[n] <= R->N)
5400 R->block1[n] = R->N;
5404 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5411 for(
i=1;
i<=R->N;
i++)
5412 {
if (weights[
i]<0) { R->OrdSgn=-1;
break; }}
5465 mpz_ptr modBase =
NULL;
5466 unsigned int modExponent = 1;
5497 WerrorS(
"parameter expected");
5503 extParam.
r =
rDefault( cf, pars, names);
5504 for(
int i=pars-1;
i>=0;
i--)
5518 int ch = (int)(
long)pn->
Data();
5528 if ((ch<2)||(ch!=ch2))
5530 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5545 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5557 if ((ch!=0) && (ch!=
IsPrime(ch)))
5559 WerrorS(
"too many parameters");
5567 WerrorS(
"parameter expected");
5573 extParam.
r =
rDefault( ch, pars, names);
5574 for(
int i=pars-1;
i>=0;
i--)
5588 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5590 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5593 float_len=(int)(
long)pn->
next->
Data();
5594 float_len2=float_len;
5598 float_len2=(int)(
long)pn->
next->
Data();
5617 if (param.
float_len < SHORT_REAL_LENGTH)
5633 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5636 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
5637 mpz_init_set_si(modBase, 0);
5642 mpz_set_ui(modBase, (
int)(
long) pn->
next->
Data());
5644 if ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5646 modExponent = (long) pn->
next->
Data();
5649 while ((pn->next!=
NULL) && (pn->next->Typ()==
INT_CMD))
5651 mpz_mul_ui(modBase, modBase, (
int)(
long) pn->next->Data());
5665 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5667 Werror(
"Wrong ground ring specification (module is 1)");
5670 if (modExponent < 1)
5672 Werror(
"Wrong ground ring specification (exponent smaller than 1");
5677 if (modExponent > 1 && cf ==
NULL)
5679 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5690 if (mpz_cmp_ui(modBase,0)==0)
5692 WerrorS(
"modulus must not be 0 or parameter not allowed");
5698 info.
exp= modExponent;
5703 else if (cf ==
NULL)
5705 if (mpz_cmp_ui(modBase,0)==0)
5707 WerrorS(
"modulus must not be 0 or parameter not allowed");
5713 info.
exp= modExponent;
5723 extParam.
r = (ring)pn->
Data();
5729 extParam.
r = (ring)pn->
Data();
5735 Werror(
"Wrong or unknown ground field specification");
5763 Werror(
"Invalid ground field specification");
5779 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5787 WerrorS(
"name of ring variable expected");
5839 ring R =
rCopy0(org_ring);
5840 int *perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(int));
5848 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5857 WerrorS(
"name of ring variable expected");
5867 for(;
i<org_ring->N;
i++)
5869 if (strcmp(org_ring->names[
i],R->names[
j])==0)
5877 Werror(
"variable %d (%s) not in basering",
j+1,R->names[
j]);
5890 for(
j=R->block0[
i];j<=R->block1[
i];
j++)
5894 if (min_var==-1) min_var=perm[
j];
5902 R->block0[
i]=min_var;
5903 R->block1[
i]=max_var;
5904 if (R->wvhdl[
i]!=
NULL)
5907 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(int));
5908 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
5912 R->wvhdl[
i][perm[
j]-R->block0[
i]]=
5913 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
5939 R->order[
j-1]=R->order[
j];
5940 R->block0[
j-1]=R->block0[
j];
5941 R->block1[
j-1]=R->block1[
j];
5943 R->wvhdl[
j-1]=R->wvhdl[
j];
5951 while (R->order[n]==0) n--;
5954 if (R->block1[n] != R->N)
5965 R->block0[n] <= R->N)
5967 R->block1[n] = R->N;
5971 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
5972 R->N,R->block1[n],n);
5978 R->OrdSgn = org_ring->OrdSgn;
6001 if ((r->ref<=0)&&(r->order!=
NULL))
6006 if (r->qideal!=
NULL)
6012 #ifdef USE_IILOCALRING 6017 if (j+1==myynest)
Warn(
"killing the basering for level %d",j);
6027 for(; nshdl !=
NULL; nshdl = nshdl->
next)
6029 if (nshdl->
cRing==r)
6031 Warn(
"killing the basering for level %d",lev);
6039 while (r->idroot!=
NULL)
6042 killhdl2(r->idroot,&(r->idroot),r);
6138 resid=(ideal)(res.
data);
6191 ideal I=(ideal)u->
Data();
6194 for(i=I->nrows*I->ncols-1;i>=0;i--)
6206 switch (p->language)
6214 if(p->libname!=
NULL)
6215 Print(
",%s", p->libname);
6228 memset(&tmp_in,0,
sizeof(tmp_in));
6230 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6234 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6238 Werror(
"apply fails at index %d",
i+1);
6241 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6246 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6268 for(
int i=0;
i<=aa->
nr;
i++)
6270 memset(&tmp_in,0,
sizeof(tmp_in));
6271 tmp_in.
Copy(&(aa->
m[
i]));
6275 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6280 Werror(
"apply fails at index %d",
i+1);
6283 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6288 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6295 memset(res,0,
sizeof(
sleftv));
6311 WerrorS(
"first argument to `apply` must allow an index");
6321 char assume_yylinebuf[80];
6323 int lev=(long)a->
Data();
6330 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6344 char *ss=(
char*)
omAlloc(strlen(a)+strlen(s)+30);
6346 int end_s=strlen(s);
6347 while ((end_s>0) && ((s[end_s]<=
' ')||(s[end_s]==
';'))) end_s--;
6349 char *
name=(
char *)
omAlloc(strlen(a)+strlen(s)+30);
6350 sprintf(name,
"%s->%s",a,s);
6352 int start_s=end_s-1;
6353 while ((start_s>=0) && (s[start_s]!=
';')) start_s--;
6356 sprintf(ss,
"parameter def %s;return(%s);\n",a,s);
6361 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6363 memset(r,0,
sizeof(*r));
6383 memset(&tmp,0,
sizeof(tmp));
6402 memset(&n,0,
sizeof(n));
6421 sprintf(buf,
"wrong length of parameters(%d), expected ",t);
6423 sprintf(buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6424 for(
int i=1;
i<=T[0];
i++)
6429 if (i<T[0]) strcat(buf,
",");
6438 if (type_list[0]==0)
return TRUE;
6441 if (report)
WerrorS(
"no arguments expected");
6446 if (l!=(
int)type_list[0])
6451 for(
int i=1;
i<=
l;
i++,args=args->
next)
6453 short t=type_list[
i];
6457 || (t!=args->Typ()))
int status int void size_t count
BOOLEAN jjCHARSERIES(leftv res, leftv u)
for idElimination, like a, except pFDeg, pWeigths ignore it
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
complex root finder for univariate polynomials based on laguers algorithm
#define omRealloc0Size(addr, o_size, size)
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
const CanonicalForm int s
int iiTestConvert(int inputType, int outputType)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
#define omCheckAddrSize(addr, size)
void atSet(idhdl root, const char *name, void *data, int typ)
Class used for (list of) interpreter objects.
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
number * interpolateDense(const number *q)
Solves the Vandermode linear system {i=1}^{n} x_i^k-1 w_i = q_k, k=1,..,n.
matrix mapToMatrix(matrix m)
ring rSubring(ring org_ring, sleftv *rv)
Base class for solving 0-dim poly systems using u-resultant.
only used if HAVE_RINGS is defined: ?
void mu(int **points, int sizePoints)
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
#define SHORT_REAL_LENGTH
vandermonde system solver for interpolating polynomials from their values
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
#define idDelete(H)
delete an ideal
static BOOLEAN rField_is_Zp_a(const ring r)
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()
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
#define omFreeSize(addr, size)
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)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
int hasOne(ideal J, const ring r)
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 FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static int pLength(poly a)
Creation data needed for finite fields.
BOOLEAN iiExport(leftv v, int toLev)
idhdl rDefault(const char *s)
static BOOLEAN idIsZeroDim(ideal i)
idhdl get(const char *s, int lev)
real floating point (GMP) numbers
BOOLEAN 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: ?
void rDecomposeRing(leftv h, const coeffs C)
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)
const ExtensionInfo & info
< [in] sqrfree poly
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.
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
BOOLEAN slWrite(si_link l, leftv v)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
spectrumState spectrumCompute(poly h, lists *L, int fast)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
static void rRenameVars(ring R)
static 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)
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)
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 rDecompose_CF(leftv res, const coeffs C)
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,...)
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)
static void rDecomposeC(leftv h, const coeffs C)
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)