12 #include <factory/factory.h> 114 case LE:
return "<=";
115 case GE:
return ">=";
124 if (s[1]==
'\0')
return s[0];
125 else if (s[2]!=
'\0')
return 0;
128 case '.':
if (s[1]==
'.')
return DOTDOT;
134 case '+':
if (s[1]==
'+')
return PLUSPLUS;
138 case '<':
if (s[1]==
'=')
return LE;
139 else if (s[1]==
'>')
return NOTEQUAL;
141 case '>':
if (s[1]==
'=')
return GE;
143 case '!':
if (s[1]==
'=')
return NOTEQUAL;
155 if(fullname) sprintf(buf2,
"%s::%s",
"",
IDID(h));
156 else sprintf(buf2,
"%s",
IDID(h));
194 && (strlen(
IDPROC(h)->libname)>0))
207 if ((s=strchr(buffer,
'\n'))!=
NULL)
213 if((s!=
NULL) ||(l>20))
215 Print(
"..., %d char(s)",l);
231 { number2 n=(number2)
IDDATA(h);
237 Print(
" %d x %d (%s)",
370 && (((ring)d)->idroot!=
NULL))
421 package savePack=currPack;
428 if (strcmp(what,
"all")==0)
440 if (iterate)
list1(prefix,h,
TRUE,fullname);
463 Werror(
"%s is undefined",what);
501 package save_p=currPack;
535 Warn(
"Gerhard, use the option command");
597 WerrorS(
"write: need at least two arguments");
605 if ((l!=
NULL)&&(l->name!=
NULL)) s=l->name;
607 Werror(
"cannot write to %s",s);
634 Werror(
"can not map from ground field of %s to current ground field",
638 if (
IDELEMS(theMap)<src_ring->N)
642 (src_ring->N)*
sizeof(
poly));
643 for(i=
IDELEMS(theMap);i<src_ring->N;i++)
649 WerrorS(
"argument of a map must have a name");
656 memset(&tmpW,0,
sizeof(
sleftv));
661 save_r=
IDMAP(w)->preimage;
662 IDMAP(w)->preimage=0;
671 ideal
id=(ideal)tmpW.
data;
673 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
679 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
681 if (theMap->m[
j]!=
NULL)
685 for(
int i=
IDELEMS(
id)-1;i>=0;i--)
688 if ((p!=
NULL) && (degs[i]!=0) &&
689 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)degs[i])/2)))
701 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
703 if (theMap->m[
j]!=
NULL)
709 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)deg)/2)))
718 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
734 char *tmp = theMap->preimage;
735 theMap->preimage=(
char*)1L;
738 theMap->preimage=tmp;
746 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));
940 add_row_shift = ww->
min_in();
941 (*weights) -= add_row_shift;
948 res->
data=(
void*)res_im;
951 for(
int i=1;
i<=res_im->
rows();
i++)
953 if (
IMATELEM(*res_im,1,
i)==0) { add_row_shift--; }
958 if (weights!=
NULL)
delete weights;
976 add_row_shift = ww->
min_in();
977 (*weights) -= add_row_shift;
982 if (weights!=
NULL)
delete weights;
985 return reg+1+add_row_shift;
989 #define BREAK_LINE_LENGTH 80 1016 else if(strncmp(s,
"cont;",5)==0)
1023 strcat( s,
"\n;~\n");
1094 res->
m[
i].
data = (
void *)save->set;
1104 for (i=hMu;i<hMu+
hMu2;i++)
1106 res->
m[
i].
data = (
void *)save->set;
1131 const char *
id = name->
name;
1133 memset(sy,0,
sizeof(
sleftv));
1136 WerrorS(
"object to declare is not a name");
1175 if (iiCurrProc!=
NULL)
1180 memset(&tmp,0,
sizeof(
sleftv));
1192 if (ll!=(l-1))
return FALSE;
1194 short *t=(
short*)
omAlloc(l*
sizeof(
short));
1198 for(i=1;i<
l;i++,h=h->
next)
1203 Werror(
"arg %d is not a string",i);
1207 b=
IsCmd((
char *)h->Data(),tt);
1212 Werror(
"arg %d is not a type name",i);
1219 Werror(
"last arg (%d) is not a proc",i);
1224 if (b && (h->rtyp==
IDHDL) && (h->e==
NULL))
1230 if(
pi->data.s.body==
NULL )
1244 if (iiCurrArgs!=
NULL)
1246 if (!err)
Warn(
"too many arguments for %s",
IDID(iiCurrProc));
1257 if (iiCurrArgs==
NULL)
1259 if (strcmp(p->
name,
"#")==0)
1268 if (strcmp(p->
name,
"#")==0)
1270 is_default_list=
TRUE;
1278 if (is_default_list)
1336 if (keepring)
IDRING(h)->ref--;
1348 Warn(
"'%s': no such identifier\n", v->
name);
1351 package frompack=v->req_packhdl;
1366 if (h==frompack->idroot)
1368 frompack->idroot=h->
next;
1372 idhdl hh=frompack->idroot;
1373 while ((hh!=
NULL) && (hh->
next!=h))
1383 h->
next=rootpack->idroot;
1521 WarnS(
"package not found\n");
1554 r->order = (
int *)
omAlloc(3 *
sizeof(
int *));
1555 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1556 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1575 if (h!=
NULL)
return h;
1577 if (h!=
NULL)
return h;
1584 if (h!=
NULL)
return h;
1592 if (h!=
NULL)
return h;
1611 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1617 for(i=0; i<r->N; i++)
1623 L->
m[1].
data=(
void *)LL;
1640 if (r->block1[i]-r->block0[i] >=0 )
1642 j=r->block1[
i]-r->block0[
i];
1645 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
1647 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][
j];
1649 else switch (r->order[i])
1656 for(;j>=0; j--) (*iv)[
j]=1;
1666 LLL->
m[1].
data=(
void *)iv;
1667 LL->
m[
i].
data=(
void *)LLL;
1670 L->
m[2].
data=(
void *)LL;
1680 pSetCoeff0(q->m[0],(number)(r->qideal->m[0]));
1681 L->
m[3].
data=(
void *)q;
1701 L->
m[0].
data=(
void *)0;
1711 L->
m[1].
data=(
void *)LL;
1736 L->
m[0].
data=(
void *)0;
1746 L->
m[1].
data=(
void *)LL;
1781 LL->
m[1].
data=(
void *) C->modExponent;
1783 L->
m[1].
data=(
void *)LL;
1809 LL->
m[0].
data=
nlMapGMP((number) R->cf->modBase, R->cf, R->cf);
1811 LL->
m[1].
data=(
void *) R->cf->modExponent;
1813 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 2036 || (r->qideal !=
NULL)
2043 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2068 else if ( r->cf->extRing!=
NULL )
2078 Lc->
m[0].
data=(
void*)(
long)r->cf->m_nfCharQ;
2085 Lc->
m[1].
data=(
void*)Lv;
2096 Loo->
m[1].
data=(
void *)iv;
2099 Lo->
m[0].
data=(
void*)Loo;
2102 Lc->
m[2].
data=(
void*)Lo;
2108 L->
m[0].
data=(
void*)Lc;
2113 L->
m[0].
data=(
void *)(
long)r->cf->ch;
2120 for(i=0; i<r->N; i++)
2126 L->
m[1].
data=(
void *)LL;
2146 assume( r->block0[i] == r->block1[i] );
2147 const int s = r->block0[
i];
2148 assume( -2 < s && s < 2);
2153 else if (r->block1[i]-r->block0[i] >=0 )
2155 int bl=j=r->block1[
i]-r->block0[
i];
2163 j+=r->wvhdl[
i][bl+1];
2166 if ((r->wvhdl!=
NULL) && (r->wvhdl[i]!=
NULL))
2168 for(;j>=0; j--) (*iv)[
j]=r->wvhdl[
i][j+(j>bl)];
2170 else switch (r->order[i])
2177 for(;j>=0; j--) (*iv)[
j]=1;
2187 LLL->
m[1].
data=(
void *)iv;
2188 LL->
m[
i].
data=(
void *)LLL;
2191 L->
m[2].
data=(
void *)LL;
2195 if (r->qideal==
NULL)
2200 #ifdef HAVE_PLURAL // NC! in rDecompose 2219 WerrorS(
"invalid coeff. field description, expecting 0");
2227 WerrorS(
"invalid coeff. field description, expecting precision list");
2237 WerrorS(
"invalid coeff. field description list");
2240 int r1=(int)(
long)LL->
m[0].
data;
2241 int r2=(int)(
long)LL->
m[1].
data;
2263 R->cf->float_len=
si_min(r1,32767);
2264 R->cf->float_len2=
si_min(r2,32767);
2273 WerrorS(
"invalid coeff. field description, expecting parameter name");
2289 mpz_ptr modBase =
NULL;
2290 unsigned int modExponent = 1;
2292 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
2295 mpz_init_set_ui(modBase,0);
2306 number tmp= (number) LL->
m[0].
data;
2312 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2316 mpz_init_set_ui(modBase,0);
2320 modExponent = (
unsigned long) LL->
m[1].
data;
2328 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
2330 WerrorS(
"Wrong ground ring specification (module is 1)");
2333 if (modExponent < 1)
2335 WerrorS(
"Wrong ground ring specification (exponent smaller than 1)");
2339 if (mpz_cmp_ui(modBase, 0) == 0)
2344 else if (modExponent > 1)
2347 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2359 info.
exp= modExponent;
2370 info.
exp= modExponent;
2383 for(i=0;i<R->N-1;i++)
2385 for(j=i+1;j<R->N;j++)
2387 if (strcmp(R->names[i],R->names[j])==0)
2390 Warn(
"name conflict var(%d) and var(%d): `%s`, rename to `@%s`",i+1,j+1,R->names[i],R->names[i]);
2392 R->names[
j]=(
char *)
omAlloc(2+strlen(R->names[i]));
2393 sprintf(R->names[j],
"@%s",R->names[i]);
2399 for(i=0;i<
rPar(R); i++)
2405 Warn(
"name conflict par(%d) and var(%d): `%s`, renaming the VARIABLE to `@@(%d)`",i+1,j+1,R->names[j],i+1);
2411 sprintf(R->names[j],
"@@(%d)",i+1);
2443 Werror(
"var name %d must be a string or a ring variable",i+1);
2449 Werror(
"var name %d must be `string`",i+1);
2456 WerrorS(
"variable must be given as `list`");
2472 for (
int j=0;
j < n-1;
j++)
2479 &&(strcmp((
char*)vv->
m[0].
Data(),
"L")==0))
2481 number nn=(number)vv->
m[1].
Data();
2488 Werror(
"illegal argument for pseudo ordering L: %d",vv->
m[1].
Typ());
2495 if (bitmask!=0) n--;
2498 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
2499 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
2500 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
2503 for (j_in_R= n-2; j_in_R>=0; j_in_R--)
2506 for(j_in_R=0,j_in_L=0;j_in_R<n-1;j_in_R++,j_in_L++)
2511 WerrorS(
"ordering must be list of lists");
2518 if (strcmp((
char*)vv->
m[0].
Data(),
"L")==0)
2526 WerrorS(
"ordering name must be a (string,intvec)(1)");
2531 if (j_in_R==0) R->block0[0]=1;
2548 if (jj<0) R->block0[j_in_R]=1;
2549 else R->block0[j_in_R]=R->block1[jj]+1;
2557 R->block1[j_in_R]=
si_max(R->block0[j_in_R],R->block0[j_in_R]+iv_len-1);
2558 if (R->block1[j_in_R]>R->N)
2560 R->block1[j_in_R]=R->N;
2561 iv_len=R->block1[j_in_R]-R->block0[j_in_R]+1;
2565 switch (R->order[j_in_R])
2574 R->wvhdl[j_in_R] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2575 for (i=0; i<iv_len;i++)
2577 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2581 R->wvhdl[j_in_R] =(
int *)
omAlloc((iv->
length()+1)*
sizeof(
int));
2582 for (i=0; i<iv_len;i++)
2584 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2586 R->wvhdl[j_in_R][
i]=iv->
length() - iv_len;
2588 for (; i<iv->
length(); i++)
2590 R->wvhdl[j_in_R][i+1]=(*iv)[
i];
2594 R->wvhdl[j_in_R] =(
int *)
omAlloc((iv->
length())*
sizeof(
int));
2595 for (i=0; i<iv->
length();i++) R->wvhdl[j_in_R][i]=(*iv)[
i];
2596 R->block1[j_in_R]=
si_max(R->block0[j_in_R],R->block0[j_in_R]+(
int)
sqrt((
double)(iv->
length()-1)));
2597 if (R->block1[j_in_R]>R->N)
2599 WerrorS(
"ordering matrix too big");
2617 R->block1[j_in_R]=R->block0[j_in_R]=0;
2625 R->block1[j_in_R] = R->block0[j_in_R] = 0;
2628 const int s = (*iv)[0];
2629 assume( -2 < s && s < 2 );
2630 R->block1[j_in_R] = R->block0[j_in_R] =
s;
2643 WerrorS(
"ordering name must be a (string,intvec)");
2652 if (R->block1[j_in_R] != R->N)
2663 R->block0[j_in_R] <= R->N)
2665 R->block1[j_in_R] = R->N;
2669 Werror(
"ordering incomplete: size (%d) should be %d",R->block1[j_in_R],R->N);
2673 if (R->block0[j_in_R]>R->N)
2675 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",R->N,j_in_R+1);
2676 for(
int ii=0;ii<=j_in_R;ii++)
2677 Werror(
"ord[%d]: %s from v%d to v%d",ii+1,
rSimpleOrdStr(R->order[ii]),R->block0[ii],R->block1[ii]);
2691 R->order=(
int*)
omRealloc0Size(R->order,n*
sizeof(
int),(n+1)*
sizeof(
int));
2692 R->block0=(
int*)
omRealloc0Size(R->block0,n*
sizeof(
int),(n+1)*
sizeof(
int));
2693 R->block1=(
int*)
omRealloc0Size(R->block1,n*
sizeof(
int),(n+1)*
sizeof(
int));
2705 WerrorS(
"ordering must be given as `list`");
2708 if (bitmask!=0) R->bitmask=bitmask*2;
2743 int ch = (int)(
long)L->
m[0].
Data();
2753 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch, l);
2776 int ch = (int)(
long)LL->
m[0].
Data();
2777 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2778 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2799 WerrorS(
"could not create the specified coefficient field");
2803 if( extRing->qideal !=
NULL )
2807 extParam.
r = extRing;
2814 extParam.
r = extRing;
2824 WerrorS(
"coefficient field must be described by `int` or `list`");
2830 WerrorS(
"could not create coefficient field described by the input!");
2848 ideal q=(ideal)L->
m[3].
Data();
2854 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2861 int par_perm_size=0;
2880 par_perm_size=
rPar(orig_ring);
2890 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2894 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(int));
2895 if (par_perm_size!=0)
2896 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2900 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2909 else if (par_perm_size!=0)
2914 for(i=
IDELEMS(q)-1; i>=0; i--)
2917 par_perm,par_perm_size);
2919 pTest(dest_id->m[i]);
2935 WerrorS(
"q-ideal must be given as `ideal`");
2963 while (i>=0) {
if (R->names[i]!=
NULL)
omFree(R->names[i]); i--; }
2984 ideal
id=(ideal)a->
Data();
2987 for (i=1; i<=
IDELEMS(
id); i++)
2994 res->
data=(
char *)result;
3004 int n=(int)(
long)b->
Data();
3005 int d=(int)(
long)c->
Data();
3012 if ((d>n) || (d<1) || (n<1))
3017 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
3021 temp=(ideal)id->
Data();
3034 if (choise[l-1]<=
IDELEMS(temp))
3036 p =
pCopy(temp->m[choise[l-1]-1]);
3037 if (sign == -1) p =
pNeg(p);
3048 res->
data=(
char *)result;
3063 int add_row_shift=0;
3069 add_row_shift = ww->
min_in();
3070 (*weights) -= add_row_shift;
3083 memset(&tmp,0,
sizeof(tmp));
3097 const int length = syzstr->
length;
3099 if ((fullres==
NULL) && (minres==
NULL))
3125 for (
int i=(length)-1;
i>=0;
i--)
3137 for (
int i=length-1;
i>=0;
i--)
3212 ideal F=(ideal)id->
Data();
3218 res->
data=(
char *)iv;
3222 double wNsqr = (double)2.0 / (
double)n;
3224 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(int));
3226 for (i = n; i!=0; i--)
3227 (*iv)[i-1] = x[i + n + 1];
3245 res->
data=(
void *)b;
3263 #ifdef HAVE_SPECTRUM 3271 spec.
mu = (int)(
long)(l->
m[0].
Data( ));
3272 spec.
pg = (int)(
long)(l->
m[1].
Data( ));
3273 spec.
n = (int)(
long)(l->
m[2].
Data( ));
3281 for(
int i=0;
i<spec.
n;
i++ )
3284 spec.
w[
i] = (*mul)[
i];
3315 for(
int i=0;
i<spec.
n;
i++ )
3319 (*mult)[
i] = spec.
w[
i];
3329 L->
m[0].
data = (
void*)(
long)spec.
mu;
3330 L->
m[1].
data = (
void*)(
long)spec.
pg;
3331 L->
m[2].
data = (
void*)(
long)spec.
n;
3332 L->
m[3].
data = (
void*)num;
3333 L->
m[4].
data = (
void*)den;
3334 L->
m[5].
data = (
void*)mult;
3382 WerrorS(
"the list is too short" );
3385 WerrorS(
"the list is too long" );
3389 WerrorS(
"first element of the list should be int" );
3392 WerrorS(
"second element of the list should be int" );
3395 WerrorS(
"third element of the list should be int" );
3398 WerrorS(
"fourth element of the list should be intvec" );
3401 WerrorS(
"fifth element of the list should be intvec" );
3404 WerrorS(
"sixth element of the list should be intvec" );
3408 WerrorS(
"first element of the list should be positive" );
3411 WerrorS(
"wrong number of numerators" );
3414 WerrorS(
"wrong number of denominators" );
3417 WerrorS(
"wrong number of multiplicities" );
3421 WerrorS(
"the Milnor number should be positive" );
3424 WerrorS(
"the geometrical genus should be nonnegative" );
3427 WerrorS(
"all numerators should be positive" );
3430 WerrorS(
"all denominators should be positive" );
3433 WerrorS(
"all multiplicities should be positive" );
3437 WerrorS(
"it is not symmetric" );
3440 WerrorS(
"it is not monotonous" );
3444 WerrorS(
"the Milnor number is wrong" );
3447 WerrorS(
"the geometrical genus is wrong" );
3451 WerrorS(
"unspecific error" );
3487 ( fast==2 ? 2 : 1 ) );
3497 ( fast==0 || (*node)->weight<=smax ) )
3519 cmp =
pCmp( (*node)->mon,f );
3542 (*node)->nf = search->
nf;
3546 while( cmp<0 && f!=(
poly)NULL );
3548 search = search->
next;
3559 if( (*node)->weight<=(
Rational)1 ) pg++;
3560 if( (*node)->weight==smax ) z++;
3561 if( (*node)->weight>weight_prev ) n++;
3563 weight_prev = (*node)->weight;
3564 node = &((*node)->next);
3586 cmp =
pCmp( (*node)->mon,f );
3601 search = search->
next;
3615 n = ( z > 0 ? 2*n - 1 : 2*n );
3630 ( fast==0 || search->
weight<=smax );
3631 search=search->
next )
3656 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3659 (*den) [n2] = (*den)[n1];
3660 (*mult)[n2] = (*mult)[n1];
3668 if( fast==0 || fast==1 )
3672 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3674 if( (*mult)[n1]!=(*mult)[n2] ||
3675 (*den) [n1]!= (*den)[n2] ||
3682 if( symmetric==
FALSE )
3692 (*L)->m[0].data = (
void*)(
long)
mu;
3709 (*L)->m[0].data = (
void*)(
long)
mu;
3710 (*L)->m[1].data = (
void*)(
long)pg;
3711 (*L)->m[2].data = (
void*)(
long)n;
3712 (*L)->m[3].data = (
void*)nom;
3713 (*L)->m[4].data = (
void*)den;
3714 (*L)->m[5].data = (
void*)mult;
3723 #ifdef SPECTRUM_DEBUG 3724 #ifdef SPECTRUM_PRINT 3725 #ifdef SPECTRUM_IOSTREAM 3726 cout <<
"spectrumCompute\n";
3727 if( fast==0 ) cout <<
" no optimization" << endl;
3728 if( fast==1 ) cout <<
" weight optimization" << endl;
3729 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3731 fprintf( stdout,
"spectrumCompute\n" );
3732 if( fast==0 ) fprintf( stdout,
" no optimization\n" );
3733 if( fast==1 ) fprintf( stdout,
" weight optimization\n" );
3734 if( fast==2 ) fprintf( stdout,
" symmetry optimization\n" );
3778 #ifdef SPECTRUM_DEBUG 3779 #ifdef SPECTRUM_PRINT 3780 #ifdef SPECTRUM_IOSTREAM 3781 cout <<
"\n computing the Jacobi ideal...\n";
3783 fprintf( stdout,
"\n computing the Jacobi ideal...\n" );
3792 #ifdef SPECTRUM_DEBUG 3793 #ifdef SPECTRUM_PRINT 3794 #ifdef SPECTRUM_IOSTREAM 3797 fprintf( stdout,
" " );
3808 #ifdef SPECTRUM_DEBUG 3809 #ifdef SPECTRUM_PRINT 3810 #ifdef SPECTRUM_IOSTREAM 3812 cout <<
" computing a standard basis..." << endl;
3814 fprintf( stdout,
"\n" );
3815 fprintf( stdout,
" computing a standard basis...\n" );
3823 #ifdef SPECTRUM_DEBUG 3824 #ifdef SPECTRUM_PRINT 3825 for( i=0; i<
IDELEMS(stdJ); i++ )
3827 #ifdef SPECTRUM_IOSTREAM 3830 fprintf( stdout,
" " );
3875 #ifdef SPECTRUM_DEBUG 3876 #ifdef SPECTRUM_PRINT 3877 #ifdef SPECTRUM_IOSTREAM 3878 cout <<
"\n computing the highest corner...\n";
3880 fprintf( stdout,
"\n computing the highest corner...\n" );
3889 if( hc!=(
poly)NULL )
3904 #ifdef SPECTRUM_DEBUG 3905 #ifdef SPECTRUM_PRINT 3906 #ifdef SPECTRUM_IOSTREAM 3909 fprintf( stdout,
" " );
3919 #ifdef SPECTRUM_DEBUG 3920 #ifdef SPECTRUM_PRINT 3921 #ifdef SPECTRUM_IOSTREAM 3922 cout <<
"\n computing the newton polygon...\n";
3924 fprintf( stdout,
"\n computing the newton polygon...\n" );
3931 #ifdef SPECTRUM_DEBUG 3932 #ifdef SPECTRUM_PRINT 3941 #ifdef SPECTRUM_DEBUG 3942 #ifdef SPECTRUM_PRINT 3943 #ifdef SPECTRUM_IOSTREAM 3944 cout <<
"\n computing the weight corner...\n";
3946 fprintf( stdout,
"\n computing the weight corner...\n" );
3956 #ifdef SPECTRUM_DEBUG 3957 #ifdef SPECTRUM_PRINT 3958 #ifdef SPECTRUM_IOSTREAM 3961 fprintf( stdout,
" " );
3971 #ifdef SPECTRUM_DEBUG 3972 #ifdef SPECTRUM_PRINT 3973 #ifdef SPECTRUM_IOSTREAM 3974 cout <<
"\n computing NF...\n" << endl;
3976 fprintf( stdout,
"\n computing NF...\n" );
3985 #ifdef SPECTRUM_DEBUG 3986 #ifdef SPECTRUM_PRINT 3988 #ifdef SPECTRUM_IOSTREAM 3991 fprintf( stdout,
"\n" );
4016 WerrorS(
"polynomial is zero" );
4019 WerrorS(
"polynomial has constant term" );
4022 WerrorS(
"not a singularity" );
4025 WerrorS(
"the singularity is not isolated" );
4028 WerrorS(
"highest corner cannot be computed" );
4031 WerrorS(
"principal part is degenerate" );
4037 WerrorS(
"unknown error occurred" );
4054 WerrorS(
"only works for local orderings" );
4062 WerrorS(
"does not work in quotient rings" );
4075 result->
data = (
char*)L;
4108 WerrorS(
"only works for local orderings" );
4113 WerrorS(
"does not work in quotient rings" );
4126 result->
data = (
char*)L;
4172 else if( l->
nr > 5 )
4210 int mu = (int)(
long)(l->
m[0].
Data( ));
4211 int pg = (int)(
long)(l->
m[1].
Data( ));
4212 int n = (int)(
long)(l->
m[2].
Data( ));
4223 if( n != num->
length( ) )
4227 else if( n != den->
length( ) )
4231 else if( n != mul->
length( ) )
4251 for( i=0; i<n; i++ )
4253 if( (*num)[
i] <= 0 )
4257 if( (*den)[
i] <= 0 )
4261 if( (*mul)[
i] <= 0 )
4273 for( i=0, j=n-1; i<=
j; i++,j-- )
4276 (*den)[
i] != (*den)[
j] ||
4277 (*mul)[
i] != (*mul)[
j] )
4287 for( i=0, j=1; i<n/2; i++,j++ )
4289 if( (*num)[
i]*(*den)[
j] >= (*num)[
j]*(*den)[
i] )
4299 for( mu=0, i=0; i<n; i++ )
4304 if( mu != (
int)(long)(l->
m[0].
Data( )) )
4313 for( pg=0, i=0; i<n; i++ )
4315 if( (*num)[
i]<=(*den)[
i] )
4321 if( pg != (
int)(long)(l->
m[1].
Data( )) )
4350 WerrorS(
"first argument is not a spectrum:" );
4355 WerrorS(
"second argument is not a spectrum:" );
4388 int k = (int)(
long)second->
Data( );
4392 WerrorS(
"first argument is not a spectrum" );
4397 WerrorS(
"second argument should be positive" );
4434 WerrorS(
"first argument is not a spectrum" );
4439 WerrorS(
"second argument is not a spectrum" );
4463 memset(&tmp,0,
sizeof(tmp));
4482 WerrorS(
"Ground field not implemented!");
4502 LP->
m= (int)(
long)(v->
Data());
4508 LP->
n= (int)(
long)(v->
Data());
4514 LP->
m1= (int)(
long)(v->
Data());
4520 LP->
m2= (int)(
long)(v->
Data());
4526 LP->
m3= (int)(
long)(v->
Data());
4528 #ifdef mprDEBUG_PROT 4529 Print(
"m (constraints) %d\n",LP->
m);
4530 Print(
"n (columns) %d\n",LP->
n);
4554 lres->
m[4].
data=(
void*)(
long)LP->
m;
4557 lres->
m[5].
data=(
void*)(
long)LP->
n;
4559 res->
data= (
void*)lres;
4566 ideal gls = (ideal)(arg1->
Data());
4567 int imtype= (int)(
long)arg2->
Data();
4592 int howclean= (int)(
long)arg3->
Data();
4599 WerrorS(
"Ground field not implemented!");
4606 unsigned long int ii = (
unsigned long int)arg2->
Data();
4612 WerrorS(
"Input polynomial is constant!");
4638 if ( (vpos != i) && (
pGetExp( piter, i ) != 0) )
4640 WerrorS(
"The input polynomial must be univariate!");
4648 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4650 for ( i= deg; i >= 0; i-- )
4664 #ifdef mprDEBUG_PROT 4665 for (i=deg; i >= 0; i--)
4673 roots->
solver( howclean );
4680 rlist->
Init( elem );
4684 for ( j= 0; j < elem; j++ )
4693 for ( j= 0; j < elem; j++ )
4697 rlist->
m[
j].
data=(
void *)dummy;
4711 res->
data= (
void*)rlist;
4720 p= (ideal)arg1->
Data();
4721 w= (ideal)arg2->
Data();
4732 int tdg= (int)(
long)arg3->
Data();
4739 WerrorS(
"Last input parameter must be > 0!");
4747 if ( m != (
int)
pow((
double)tdg+1,(
double)n) )
4749 Werror(
"Size of second input ideal must be equal to %d!",
4750 (
int)
pow((
double)tdg+1,(
double)n));
4757 WerrorS(
"Ground field not implemented!");
4762 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4763 for ( i= 0; i < n; i++ )
4772 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4781 WerrorS(
"Elements of first input ideal must be numbers!");
4784 pevpoint[
i]=
nCopy( tmp );
4788 number *wresults= (number *)
omAlloc( m *
sizeof( number ) );
4789 for ( i= 0; i <
m; i++ )
4798 WerrorS(
"Elements of second input ideal must be numbers!");
4813 res->
data= (
void*)rpoly;
4828 else gls= (ideal)(v->
Data());
4834 else imtype= (int)(
long)v->
Data();
4839 ideal test_id=
idInit(1,1);
4841 for(j=
IDELEMS(gls)-1;j>=0;j--)
4843 if (gls->m[j]!=
NULL)
4845 test_id->m[0]=gls->m[
j];
4849 WerrorS(
"Newton polytope not of expected dimension");
4863 unsigned long int ii=(
unsigned long int)v->
Data();
4871 else howclean= (int)(
long)v->
Data();
4900 WerrorS(
"Error occurred during matrix setup!");
4908 #ifdef mprDEBUG_PROT 4913 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
4919 if ( interpolate_det )
4925 if ( interpolate_det )
4930 #ifdef mprDEBUG_PROT 4932 for (i=0; i < c; i++)
pWrite(iproots[i]->getPoly());
4934 for (i=0; i < c; i++)
pWrite(muiproots[i]->getPoly());
4938 arranger=
new rootArranger( iproots, muiproots, howclean );
4949 WerrorS(
"Solver was unable to find any roots!");
4955 for (i=0; i <
count; i++)
delete iproots[i];
4958 for (i=0; i <
count; i++)
delete muiproots[i];
4965 res->
data= (
void *)listofroots;
4977 int count=
self->roots[0]->getAnzRoots();
4978 int elem=
self->roots[0]->getAnzElems();
4982 if ( self->found_roots )
4984 listofroots->
Init( count );
4986 for (i=0; i <
count; i++)
4989 onepoint->
Init(elem);
4990 for ( j= 0; j < elem; j++ )
5006 listofroots->
m[
i].
data=(
void *)onepoint;
5014 listofroots->
Init( 0 );
5028 if (rg==
NULL)
return;
5048 Warn(
"deleting denom_list for ring change to %s",
IDID(h));
5060 if ((rg!=
NULL) && (rg->idroot==
NULL))
5088 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5093 (*iv)[
i]= - (*iv)[
i];
5102 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5107 (*iv)[
i]= -(*iv)[
i];
5116 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5122 (*iv2)[2]=iv->
length()-2;
5134 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5140 (*iv2)[2]=iv->
length()-2;
5174 (*iv)[2] += (*iv2)[2];
5181 if (!change) h=h->
next;
5189 int last = 0, o=0, n = 1,
i=0, typ = 1,
j;
5201 R->bitmask=(*iv)[2];
5214 WerrorS(
"invalid combination of orderings");
5222 WerrorS(
"more than one ordering c/C specified");
5227 R->order=(
int *)
omAlloc0(n*
sizeof(
int));
5228 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
5229 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
5232 int *weights=(
int*)
omAlloc0((R->N+1)*
sizeof(int));
5235 for (
j=0;
j < n-1;
j++)
5256 R->order[n] = (*iv)[1];
5266 R->block0[n] = last+1;
5269 R->wvhdl[n][
i-2] = (*iv)[
i];
5271 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5273 R->block1[n] =
si_min(last,R->N);
5284 R->block0[n] = last+1;
5285 if (iv->
length() == 3) last+=(*iv)[2];
5286 else last += (*iv)[0];
5287 R->block1[n] =
si_min(last,R->N);
5291 if (weights[
i]==0) weights[
i]=typ;
5303 const int s = (*iv)[2];
5313 const int s = (*iv)[2];
5315 if( 1 < s || s < -1 )
return TRUE;
5331 R->block0[n] = last+1;
5336 R->wvhdl[n][
i-2]=(*iv)[
i];
5338 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5340 last=R->block0[n]-1;
5345 R->block0[n] = last+1;
5348 if (R->block1[n]- R->block0[n]+2>=iv->
length())
5349 WarnS(
"missing module weights");
5350 for (
i=2;
i<=(R->block1[n]-R->block0[n]+2);
i++)
5352 R->wvhdl[n][
i-2]=(*iv)[
i];
5354 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5356 R->wvhdl[n][
i-2]=iv->
length() -3 -(R->block1[n]- R->block0[n]);
5359 R->wvhdl[n][
i-1]=(*iv)[
i];
5361 last=R->block0[n]-1;
5366 R->block0[n] = last+1;
5374 if (weights[last]==0) weights[
last]=(*iv)[
i]*typ;
5376 last=R->block0[n]-1;
5382 if (Mtyp==0)
return TRUE;
5383 if (Mtyp==-1) typ = -1;
5387 R->wvhdl[n][
i-2]=(*iv)[
i];
5389 R->block0[n] = last+1;
5391 R->block1[n] =
si_min(last,R->N);
5392 for(
i=R->block1[n];
i>=R->block0[n];
i--)
5394 if (weights[
i]==0) weights[
i]=typ;
5404 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5411 Werror(
"mismatch of number of vars (%d) and ordering (>=%d vars)",
5419 for(
i=1;
i<=R->N;
i++)
5420 {
if (weights[
i]<0) { R->OrdSgn=-1;
break; }}
5434 if (R->block1[n] != R->N)
5445 R->block0[n] <= R->N)
5447 R->block1[n] = R->N;
5451 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5470 *p = (
char*)sl->
name;
5511 mpz_ptr modBase =
NULL;
5512 unsigned int modExponent = 1;
5544 WerrorS(
"parameter expected");
5550 extParam.
r =
rDefault( cf, pars, names);
5551 for(
int i=pars-1;
i>=0;
i--)
5565 int ch = (int)(
long)pn->
Data();
5576 if ((ch<2)||(ch!=ch2))
5578 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5593 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5605 if ((ch!=0) && (ch!=
IsPrime(ch)))
5607 WerrorS(
"too many parameters");
5615 WerrorS(
"parameter expected");
5621 extParam.
r =
rDefault( ch, pars, names);
5622 for(
int i=pars-1;
i>=0;
i--)
5635 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5638 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5641 float_len=(int)(
long)pnn->
Data();
5642 float_len2=float_len;
5646 float_len2=(int)(
long)pnn->
Data();
5665 if (param.
float_len < SHORT_REAL_LENGTH)
5681 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5684 modBase = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
5685 mpz_init_set_si(modBase, 0);
5692 mpz_set_ui(modBase, (
int)(
long) pnn->
Data());
5696 modExponent = (long) pnn->
Data();
5701 mpz_mul_ui(modBase, modBase, (
int)(
long) pnn->
Data());
5714 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5716 WerrorS(
"Wrong ground ring specification (module is 1)");
5719 if (modExponent < 1)
5721 WerrorS(
"Wrong ground ring specification (exponent smaller than 1");
5726 if (modExponent > 1 && cf ==
NULL)
5728 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5739 if (mpz_cmp_ui(modBase,0)==0)
5741 WerrorS(
"modulus must not be 0 or parameter not allowed");
5747 info.
exp= modExponent;
5752 else if (cf ==
NULL)
5754 if (mpz_cmp_ui(modBase,0)==0)
5756 WerrorS(
"modulus must not be 0 or parameter not allowed");
5762 info.
exp= modExponent;
5772 extParam.
r = (ring)pn->
Data();
5784 WerrorS(
"Wrong or unknown ground field specification");
5812 WerrorS(
"Invalid ground field specification");
5828 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5836 WerrorS(
"name of ring variable expected");
5889 int *
perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(int));
5897 Werror(
"too many ring variables(%d), max is %d",l,MAX_SHORT);
5906 WerrorS(
"name of ring variable expected");
5916 for(;
i<org_ring->N;
i++)
5918 if (strcmp(org_ring->names[
i],R->names[
j])==0)
5926 Werror(
"variable %d (%s) not in basering",
j+1,R->names[
j]);
5939 for(
j=R->block0[
i];j<=R->block1[
i];
j++)
5943 if (min_var==-1) min_var=perm[
j];
5951 R->block0[
i]=min_var;
5952 R->block1[
i]=max_var;
5953 if (R->wvhdl[
i]!=
NULL)
5956 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(int));
5957 for(
j=org_ring->block0[
i];j<=org_ring->block1[
i];
j++)
5961 R->wvhdl[
i][perm[
j]-R->block0[
i]]=
5962 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
5988 R->order[
j-1]=R->order[
j];
5989 R->block0[
j-1]=R->block0[
j];
5990 R->block1[
j-1]=R->block1[
j];
5992 R->wvhdl[
j-1]=R->wvhdl[
j];
6000 while (R->order[n]==0) n--;
6003 if (R->block1[n] != R->N)
6014 R->block0[n] <= R->N)
6016 R->block1[n] = R->N;
6020 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
6021 R->N,R->block1[n],n);
6027 R->OrdSgn = org_ring->OrdSgn;
6050 if ((r->ref<=0)&&(r->order!=
NULL))
6055 if (r->qideal!=
NULL)
6065 if (j==0)
WarnS(
"killing the basering for level 0");
6070 while (r->idroot!=
NULL)
6073 killhdl2(r->idroot,&(r->idroot),r);
6168 resid=(ideal)(res.
data);
6221 ideal I=(ideal)u->
Data();
6224 for(i=I->nrows*I->ncols-1;i>=0;i--)
6236 switch (p->language)
6244 if(p->libname!=
NULL)
6245 Print(
",%s", p->libname);
6258 memset(&tmp_in,0,
sizeof(tmp_in));
6260 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6264 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6268 Werror(
"apply fails at index %d",
i+1);
6271 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6276 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6298 for(
int i=0;
i<=aa->
nr;
i++)
6300 memset(&tmp_in,0,
sizeof(tmp_in));
6301 tmp_in.
Copy(&(aa->
m[
i]));
6305 bo=
jjPROC(&tmp_out,proc,&tmp_in);
6310 Werror(
"apply fails at index %d",
i+1);
6313 if (
i==0) { memcpy(res,&tmp_out,
sizeof(tmp_out)); }
6318 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6325 memset(res,0,
sizeof(
sleftv));
6341 WerrorS(
"first argument to `apply` must allow an index");
6351 char assume_yylinebuf[80];
6353 int lev=(long)a->
Data();
6360 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6374 char *ss=(
char*)
omAlloc(strlen(a)+strlen(s)+30);
6376 int end_s=strlen(s);
6377 while ((end_s>0) && ((s[end_s]<=
' ')||(s[end_s]==
';'))) end_s--;
6379 char *
name=(
char *)
omAlloc(strlen(a)+strlen(s)+30);
6380 sprintf(name,
"%s->%s",a,s);
6382 int start_s=end_s-1;
6383 while ((start_s>=0) && (s[start_s]!=
';')) start_s--;
6386 sprintf(ss,
"parameter def %s;return(%s);\n",a,s);
6391 sprintf(ss,
"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6393 memset(r,0,
sizeof(*r));
6413 memset(&tmp,0,
sizeof(tmp));
6432 memset(&n,0,
sizeof(n));
6451 sprintf(buf,
"wrong length of parameters(%d), expected ",t);
6453 sprintf(buf,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6454 for(
int i=1;
i<=T[0];
i++)
6459 if (i<T[0]) strcat(buf,
",");
6468 if (type_list[0]==0)
return TRUE;
6471 if (report)
WerrorS(
"no arguments expected");
6476 if (l!=(
int)type_list[0])
6481 for(
int i=1;
i<=
l;
i++,args=args->
next)
6483 short t=type_list[
i];
6487 || (t!=args->Typ()))
int status int void size_t count
BOOLEAN jjCHARSERIES(leftv res, leftv u)
for idElimination, like a, except pFDeg, pWeigths ignore it
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
complex root finder for univariate polynomials based on laguers algorithm
#define omRealloc0Size(addr, o_size, size)
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
const CanonicalForm int s
int iiTestConvert(int inputType, int outputType)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
unsigned char * proc[NUM_PROC]
#define omCheckAddrSize(addr, size)
void atSet(idhdl root, const char *name, void *data, int typ)
Class used for (list of) interpreter objects.
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
number * interpolateDense(const number *q)
Solves the Vandermode linear system {i=1}^{n} x_i^k-1 w_i = q_k, k=1,..,n.
matrix mapToMatrix(matrix m)
ring rSubring(ring org_ring, sleftv *rv)
Base class for solving 0-dim poly systems using u-resultant.
only used if HAVE_RINGS is defined
void mu(int **points, int sizePoints)
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
#define SHORT_REAL_LENGTH
vandermonde system solver for interpolating polynomials from their values
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
#define idDelete(H)
delete an ideal
static BOOLEAN rField_is_Zp_a(const ring r)
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
static BOOLEAN rComposeVar(const lists L, ring R)
ring rCompose(const lists L, const BOOLEAN check_comp)
only used if HAVE_RINGS is defined
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
static int si_min(const int a, const int b)
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Linear Programming / Linear Optimization using Simplex - Algorithm.
Compatiblity layer for legacy polynomial operations (over currRing)
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
int exprlist_length(leftv v)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
void syMinimizeResolvente(resolvente res, int length, int first)
static int rPar(const ring r)
(r->cf->P)
spectrum spectrumFromList(lists l)
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
static BOOLEAN rField_is_R(const ring r)
void list_error(semicState state)
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
resMatrixBase * accessResMat()
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
#define omFreeSize(addr, size)
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
static int * multiplicity
poly singclap_resultant(poly f, poly g, poly x, const ring r)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
intvec * id_QHomWeight(ideal id, const ring r)
BOOLEAN nuVanderSys(leftv res, leftv arg1, leftv arg2, leftv arg3)
COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consi...
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
BOOLEAN spectrumProc(leftv result, leftv first)
static BOOLEAN rField_is_Q_a(const ring r)
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
denominator_list DENOMINATOR_LIST
uResultant::resMatType determineMType(int imtype)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
BOOLEAN iiAssignCR(leftv r, leftv arg)
static long p_Totaldegree(poly p, const ring r)
poly iiHighCorner(ideal I, int ak)
bool solver(const int polishmode=PM_NONE)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
BOOLEAN hasConstTerm(poly h, const ring r)
void WerrorS(const char *s)
static BOOLEAN rField_is_GF(const ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
void nlGMP(number &i, number n, const coeffs r)
char * lString(lists l, BOOLEAN typed, int dim)
ring rAssure_HasComp(const ring r)
ideal loNewtonPolytope(const ideal id)
void killlocals_rec(idhdl *root, int v, ring r)
syStrategy syConvList(lists li)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
void hRadical(scfmon rad, int *Nrad, int Nvar)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
int hasOne(ideal J, const ring r)
BOOLEAN exitBuffer(feBufferTypes typ)
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
poly numvec2poly(const number *q)
void rComposeC(lists L, ring R)
static void jjINT_S_TO_ID(int n, int *e, leftv res)
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Creation data needed for finite fields.
BOOLEAN iiExport(leftv v, int toLev)
idhdl rDefault(const char *s)
static BOOLEAN idIsZeroDim(ideal i)
idhdl get(const char *s, int lev)
real floating point (GMP) numbers
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
BOOLEAN iiParameter(leftv p)
short float_len2
additional char-flags, rInit
#define pGetVariables(p, e)
void rDecomposeRing_41(leftv h, const coeffs C)
#define nPrint(a)
only for debug, over any initalized currRing
lists getList(spectrum &spec)
int iiRegularity(lists L)
void rDecomposeCF(leftv h, const ring r, const ring R)
void hDelete(scfmon ev, int ev_length)
BOOLEAN iiTestAssume(leftv a, leftv b)
semicState list_is_spectrum(lists l)
BOOLEAN kWeight(leftv res, leftv id)
#define omReallocSize(addr, o_size, size)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetExp(p, i)
Exponent.
single prescision (6,6) real numbers
void killhdl2(idhdl h, idhdl *ih, ring r)
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
BOOLEAN hasLinearTerm(poly h, const ring r)
static int rBlocks(ring r)
BOOLEAN syBetti1(leftv res, leftv u)
spectrumState spectrumStateFromList(spectrumPolyList &speclist, lists *L, int fast)
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
short float_len
additional char-flags, rInit
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Coefficient rings, fields and other domains suitable for Singular polynomials.
BOOLEAN killlocals_list(int v, lists L)
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
void hKill(monf xmem, int Nvar)
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
ideal maMapIdeal(const ideal map_id, const ring preimage_r, const ideal image_id, const ring image_r, const nMapFunc nMap)
polynomial map for ideals/module/matrix map_id: the ideal to map map_r: the base ring for map_id imag...
BOOLEAN mapFromMatrix(matrix m)
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
void computeNF(ideal stdJ, poly hc, poly wc, spectrumPolyList *NF, const ring r)
only used if HAVE_RINGS is defined
static long pTotaldegree(poly p)
static leftv rOptimizeOrdAsSleftv(leftv ord)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
The main handler for Singular numbers which are suitable for Singular polynomials.
BOOLEAN iiBranchTo(leftv, leftv args)
static BOOLEAN iiNoKeepRing
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
int status int void * buf
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
const ExtensionInfo & info
< [in] sqrfree poly
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static void rDecomposeC(leftv h, const ring R)
BOOLEAN hasAxis(ideal J, int k, const ring r)
complex floating point (GMP) numbers
static FORCE_INLINE char * nCoeffName(const coeffs cf)
const char * rSimpleOrdStr(int ord)
int mult_spectrumh(spectrum &)
gmp_float sqrt(const gmp_float &a)
static resolvente iiCopyRes(resolvente r, int l)
BOOLEAN nuUResSolve(leftv res, leftv args)
solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing-...
static void iiReportTypes(int nr, int t, const short *T)
BOOLEAN rCheckIV(const intvec *iv)
int rOrderName(char *ordername)
const unsigned short fftable[]
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define pIsConstant(p)
like above, except that Comp might be != 0
struct for passing initialization parameters to naInitChar
only used if HAVE_RINGS is defined
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
void spectrumPrintError(spectrumState state)
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
const char * iiTwoOps(int t)
static int si_max(const int a, const int b)
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
virtual ideal getMatrix()
ring rInit(leftv pn, leftv rv, leftv ord)
Induced (Schreyer) ordering.
void PrintS(const char *s)
matrix singclap_irrCharSeries(ideal I, const ring r)
static BOOLEAN rField_is_Q(const ring r)
lists rDecompose(const ring r)
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
BOOLEAN spectrumfProc(leftv result, leftv first)
char name(const Variable &v)
gmp_complex * getRoot(const int i)
idhdl rFindHdl(ring r, idhdl n)
static unsigned pLength(poly a)
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
BOOLEAN slWrite(si_link l, leftv v)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
spectrumState spectrumCompute(poly h, lists *L, int fast)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
static void rRenameVars(ring R)
static void rDecomposeC_41(leftv h, const coeffs C)
static BOOLEAN rField_is_long_C(const ring r)
#define rHasLocalOrMixedOrdering_currRing()
void rChangeCurrRing(ring r)
static BOOLEAN rField_is_Zp(const ring r)
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
INLINE_THIS void Init(int l=0)
matrix mpNew(int r, int c)
create a r x c zero-matrix
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
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
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN kQHWeight(leftv res, leftv v)
static BOOLEAN iiInternalExport(leftv v, int toLev)
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
void rComposeRing(lists L, ring R)
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
#define BREAK_LINE_LENGTH
static BOOLEAN rField_is_Ring(const ring r)
void rDecomposeRing(leftv h, const ring R)
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
BOOLEAN iiDefaultParameter(leftv p)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
struct for passing initialization parameters to naInitChar
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
BOOLEAN semicProc(leftv res, leftv u, leftv v)
void rDelete(ring r)
unconditionally deletes fields in r
BOOLEAN nuMPResMat(leftv res, leftv arg1, leftv arg2)
returns module representing the multipolynomial resultant matrix Arguments 2: ideal i...
const char * Tok2Cmdname(int tok)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
BOOLEAN iiWRITE(leftv, leftv v)
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
BOOLEAN jjBETTI(leftv res, leftv u)
coeffs basecoeffs() const
static BOOLEAN rField_is_Ring_Z(const ring r)
void pNorm(poly p, const ring R=currRing)
static BOOLEAN rField_is_long_R(const ring r)
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
int rTypeOfMatrixOrder(const intvec *order)
int iiOpsTwoChar(const char *s)
BOOLEAN jjMINRES(leftv res, leftv v)
void CleanUp(ring r=currRing)
void Clean(ring r=currRing)
const char * par_name
parameter name
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
lists rDecompose_list_cf(const ring r)
static int rInternalChar(const ring r)
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
number nlMapGMP(number from, const coeffs src, const coeffs dst)
BOOLEAN iiARROW(leftv r, char *a, char *s)
BOOLEAN ringIsLocal(const ring r)
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
leftv iiMap(map theMap, const char *what)
idhdl packFindHdl(package r)
#define omCheckAddr(addr)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void iiCheckPack(package &p)
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
virtual IStateType initState() const
#define omFreeBin(addr, bin)
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Rational pow(const Rational &a, int e)
char * iiGetLibProcBuffer(procinfo *pi, int part)
#define IMATELEM(M, I, J)
static poly p_Init(const ring r, omBin bin)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
void syKillEmptyEntres(resolvente res, int length)
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
int mult_spectrum(spectrum &)
lists listOfRoots(rootArranger *self, const unsigned int oprec)
static BOOLEAN rField_is_numeric(const ring r)
BOOLEAN lRingDependend(lists L)
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
void copy_deep(spectrum &spec, lists l)
void delete_node(spectrumPolyNode **)
void Werror(const char *fmt,...)
virtual number getSubDet()
ideal kGroebner(ideal F, ideal Q)
void syKillComputation(syStrategy syzstr, ring r=currRing)
const char * lastreserved
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
static void killlocals0(int v, idhdl *localhdl, const ring r)
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
#define pCopy(p)
return a copy of the poly
#define MATELEM(mat, i, j)
poly computeWC(const newtonPolygon &np, Rational max_weight, const ring r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
syStrategy syForceMin(lists li)
int IsCmd(const char *n, int &tok)
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
BOOLEAN mpJacobi(leftv res, leftv a)