115 case LE:
return "<=";
116 case GE:
return ">=";
125 if (
s[1]==
'\0')
return s[0];
126 else if (
s[2]!=
'\0')
return 0;
129 case '.':
if (
s[1]==
'.')
return DOTDOT;
135 case '+':
if (
s[1]==
'+')
return PLUSPLUS;
139 case '<':
if (
s[1]==
'=')
return LE;
142 case '>':
if (
s[1]==
'=')
return GE;
144 case '!':
if (
s[1]==
'=')
return NOTEQUAL;
156 if(fullname) snprintf(
buf2,128,
"%s::%s",
"",
IDID(
h));
200 && (strlen(
IDPROC(
h)->libname)>0))
211 memset(buffer,0,
sizeof(buffer));
213 if ((
s=strchr(buffer,
'\n'))!=
NULL)
221 Print(
"..., %d char(s)",
l);
238 { number2 n=(number2)
IDDATA(
h);
244 Print(
" %d x %d (%s)",
270 ((
intvec*)(
v->Data()))->cols());
break;
274 case MODUL_CMD:
Print(
", rk %d\n", (
int)(((ideal)(
v->Data()))->rank));
break;
377 && (((ring)d)->idroot!=
NULL))
403 if (((ring)
h->data)->idroot!=
NULL)
428 package savePack=currPack;
435 if (strcmp(what,
"all")==0)
468 Werror(
"%s is undefined",what);
502 package save_p=currPack;
536 WarnS(
"Gerhard, use the option command");
566 rc += ((
intvec *)(
v->Data()))->length();
577 rc+=((
lists)
v->Data())->nr+1;
598 WerrorS(
"write: need at least two arguments");
603 if (strcmp(
l->mode,
"string")==0)
612 Werror(
"cannot write to %s",
s);
639 Werror(
"can not map from ground field of %s to current ground field",
643 if (
IDELEMS(theMap)<src_ring->N)
647 (src_ring->N)*
sizeof(poly));
657 short src_lV = src_ring->isLPring;
658 short src_ncGenCount = src_ring->LPncGenCount;
659 short src_nVars = src_lV - src_ncGenCount;
660 int src_nblocks = src_ring->N / src_lV;
663 short dest_ncGenCount =
currRing->LPncGenCount;
666 for(
i=
IDELEMS(theMap);
i < src_lV - src_ncGenCount;
i++)
674 if (theMap->m[
i] !=
NULL)
682 for(
i = src_nVars;
i < src_lV;
i++)
684 short ncGenIndex =
i - src_nVars;
685 if (ncGenIndex < dest_ncGenCount)
699 for(
i = 1;
i < src_nblocks;
i++)
701 for(
int j = 0;
j < src_lV;
j++)
719 WerrorS(
"argument of a map must have a name");
731 save_r=
IDMAP(
w)->preimage;
742 ideal
id=(ideal)tmpW.
data;
751 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
753 if (theMap->m[
j]!=
NULL)
760 if ((
p!=
NULL) && (degs[
i]!=0) &&
761 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)degs[
i])/2)))
774 for(
int j=
IDELEMS(theMap)-1;
j>=0 && !overflow;
j--)
776 if (theMap->m[
j]!=
NULL)
779 poly
p=(poly)tmpW.
data;
782 ((
unsigned long)deg_monexp > (
currRing->bitmask / ((
unsigned long)deg)/2)))
796 Warn(
"possible OVERFLOW in map, max exponent is %ld",
currRing->bitmask/2);
816 char *tmp = theMap->preimage;
817 theMap->preimage=(
char*)1L;
820 theMap->preimage=tmp;
835 IDMAP(
w)->preimage=save_r;
843 Werror(
"%s undefined in %s",what,theMap->preimage);
848 Werror(
"cannot find preimage %s",theMap->preimage);
860 size_t len=strlen(
name)+5;
865 snprintf(
s,len,
"%s(%d)",
name,
i+1);
872 h->data.uideal=(ideal)L->
m[
i].
data;
875 Print(
"//defining: %s as %d-th syzygy module\n",
s,
i+1);
880 Warn(
"cannot define %s",
s);
960 int add_row_shift = 0;
963 if (weights!=
NULL) add_row_shift=weights->
min_in();
992 l->m[0].rtyp=u->
Typ();
993 l->m[0].data=u->
Data();
996 l->m[0].attribute=*a;
1000 tmp2.data=(
void *)
l;
1003 l->m[0].attribute=
NULL;
1017 int add_row_shift=0;
1023 add_row_shift = ww->
min_in();
1024 (*weights) -= add_row_shift;
1031 res->data=(
void*)res_im;
1034 for(
int i=1;
i<=res_im->
rows();
i++)
1036 if (
IMATELEM(*res_im,1,
i)==0) { add_row_shift--; }
1041 if (weights!=
NULL)
delete weights;
1054 int add_row_shift=0;
1059 add_row_shift = ww->
min_in();
1060 (*weights) -= add_row_shift;
1065 if (weights!=
NULL)
delete weights;
1068 return reg+1+add_row_shift;
1072#define BREAK_LINE_LENGTH 80
1099 else if(strncmp(
s,
"cont;",5)==0)
1106 strcat(
s,
"\n;~\n");
1172 res->m[
i].data = (
void *)save->set;
1184 res->m[
i].data = (
void *)save->set;
1210 const char *
id =
name->name;
1215 WerrorS(
"object to declare is not a name");
1225 Werror(
"can not define `%s` in other package",
name->name);
1272 at=
iiCurrProc->attribute->get(
"default_arg");
1286 WerrorS(
"branchTo can only occur in a proc");
1294 if (ll!=(
l-1))
return FALSE;
1297 short *t=(
short*)
omAlloc(
l*
sizeof(
short));
1301 for(
i=1;
i<
l;
i++,
h=
h->next)
1306 Werror(
"arg %d is not a string",
i);
1310 b=
IsCmd((
char *)
h->Data(),tt);
1315 Werror(
"arg %d is not a type name",
i);
1322 Werror(
"last(%d.) arg.(%s) is not a proc(but %s(%d)), nesting=%d",
1335 if(
pi->data.s.body==
NULL )
1364 if (err==0)
Warn(
"too many arguments for %s",
IDID(currProc));
1388 if (strcmp(
p->name,
"#")==0)
1396 if (strcmp(
p->name,
"#")==0)
1451 WerrorS(
"object with a different type exists");
1469 Warn(
"'%s': no such identifier\n",
v->name);
1472 package frompack=v->req_packhdl;
1486 v->req_packhdl=rootpack;
1487 if (
h==frompack->idroot)
1489 frompack->idroot=
h->next;
1493 idhdl hh=frompack->idroot;
1500 Werror(
"`%s` not found",
v->Name());
1504 h->next=rootpack->idroot;
1518 Werror(
"cannot export:%s of internal type %d",
v->name,
v->rtyp);
1544 Werror(
"cannot export:%s of internal type %d",
v->name,
v->rtyp);
1549 idhdl old=pack->idroot->get(
v->name,toLev);
1557 else if (
IDTYP(old)==
v->Typ())
1595 WerrorS(
"no ring active (9)");
1639 WarnS(
"package not found\n");
1659 #ifndef TEST_ZN_AS_ZP
1663 mpz_init_set_ui(modBase, (
long)32003);
1670 r->cf->has_simple_Inverse=1;
1683 r->block0 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1684 r->block1 = (
int *)
omAlloc0(3 *
sizeof(
int *));
1703 if ((r==
NULL)||(r->VarOffset==
NULL))
1742 L->
m[0].
data=(
void *)(
long)r->cf->ch;
1748 for(
i=0;
i<r->N;
i++)
1754 L->
m[1].
data=(
void *)LL;
1771 if (r->block1[
i]-r->block0[
i] >=0 )
1773 j=r->block1[
i]-r->block0[
i];
1776 if ((r->wvhdl!=
NULL) && (r->wvhdl[
i]!=
NULL))
1778 for(;
j>=0;
j--) (*iv)[
j]=r->wvhdl[
i][
j];
1780 else switch (r->order[
i])
1789 for(;
j>=0;
j--) (*iv)[
j]=1;
1799 LLL->
m[1].
data=(
void *)iv;
1800 LL->
m[
i].
data=(
void *)LLL;
1803 L->
m[2].
data=(
void *)LL;
1814 L->
m[3].
data=(
void *)q;
1833 L->
m[0].
data=(
void *)0;
1843 L->
m[1].
data=(
void *)LL;
1867 L->
m[0].
data=(
void *)0;
1877 L->
m[1].
data=(
void *)LL;
1910 LL->
m[1].
data=(
void *) C->modExponent;
1912 L->
m[1].
data=(
void *)LL;
1937 LL->
m[1].
data=(
void *)
R->cf->modExponent;
1939 L->
m[1].
data=(
void *)LL;
1950 WerrorS(
"ring with polynomial data must be the base ring or compatible");
1961 else if ( C->extRing!=
NULL )
1971 Lc->m[0].data=(
void*)(
long)C->m_nfCharQ;
1978 Lc->m[1].data=(
void*)Lv;
1989 Loo->
m[1].
data=(
void *)iv;
1992 Lo->
m[0].
data=(
void*)Loo;
1995 Lc->m[2].data=(
void*)Lo;
2001 res->data=(
void*)
Lc;
2006 res->data=(
void *)(
long)C->ch;
2020 for(
i=0;
i<r->N;
i++)
2026 L->
m[1].
data=(
void *)LL;
2047 assume( r->block0[
i] == r->block1[
i] );
2048 const int s = r->block0[
i];
2054 else if (r->block1[
i]-r->block0[
i] >=0 )
2056 int bl=
j=r->block1[
i]-r->block0[
i];
2064 j+=r->wvhdl[
i][bl+1];
2067 if ((r->wvhdl!=
NULL) && (r->wvhdl[
i]!=
NULL))
2069 for(;
j>=0;
j--) (*iv)[
j]=r->wvhdl[
i][
j+(
j>bl)];
2071 else switch (r->order[
i])
2080 for(;
j>=0;
j--) (*iv)[
j]=1;
2090 LLL->
m[1].
data=(
void *)iv;
2091 LL->
m[
i].
data=(
void *)LLL;
2094 L->
m[2].
data=(
void *)LL;
2098 if (r->qideal==
NULL)
2129 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2147 L->
m[0].
data=(
char*)r->cf; r->cf->ref++;
2162 || (r->qideal !=
NULL)
2169 WerrorS(
"ring with polynomial data must be the base ring or compatible");
2194 else if ( r->cf->extRing!=
NULL )
2204 Lc->m[0].data=(
void*)(
long)r->cf->m_nfCharQ;
2211 Lc->m[1].data=(
void*)Lv;
2222 Loo->
m[1].
data=(
void *)iv;
2225 Lo->
m[0].
data=(
void*)Loo;
2228 Lc->m[2].data=(
void*)Lo;
2239 L->
m[0].
data=(
void *)(
long)r->cf->ch;
2244 L->
m[0].
data=(
void *)r->cf;
2259 WerrorS(
"invalid coeff. field description, expecting 0");
2267 WerrorS(
"invalid coeff. field description, expecting precision list");
2275 WerrorS(
"invalid coeff. field description list, expected list(`int`,`int`)");
2278 int r1=(int)(
long)LL->
m[0].
data;
2279 int r2=(int)(
long)LL->
m[1].
data;
2289 WerrorS(
"invalid coeff. field description, expecting parameter name");
2310 unsigned int modExponent = 1;
2314 mpz_init_set_ui(modBase,0);
2325 number tmp= (number) LL->
m[0].
data;
2332 mpz_init_set_ui(modBase,(
unsigned long) LL->
m[0].
data);
2336 mpz_init_set_ui(modBase,0);
2340 modExponent = (
unsigned long) LL->
m[1].
data;
2348 if ((mpz_cmp_ui(modBase, 1) == 0) && (
mpz_sgn1(modBase) < 0))
2350 WerrorS(
"Wrong ground ring specification (module is 1)");
2353 if (modExponent < 1)
2355 WerrorS(
"Wrong ground ring specification (exponent smaller than 1)");
2364 else if (modExponent > 1)
2367 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
2378 info.exp= modExponent;
2389 info.exp= modExponent;
2402 for(
i=0;
i<
R->N-1;
i++)
2404 for(
j=
i+1;
j<
R->N;
j++)
2406 if (strcmp(
R->names[
i],
R->names[
j])==0)
2411 size_t len=2+strlen(
R->names[
i]);
2413 snprintf(
R->names[
j],len,
"@%s",
R->names[
i]);
2431 snprintf(
R->names[
j],16,
"@@(%d)",
i+1);
2457 poly
p=(poly)
v->m[
i].Data();
2463 Werror(
"var name %d must be a string or a ring variable",
i+1);
2469 Werror(
"var name %d must be `string` (not %d)",
i+1,
v->m[
i].Typ());
2476 WerrorS(
"variable must be given as `list`");
2492 for (
int j=0;
j < n-1;
j++)
2499 &&(strcmp((
char*)vv->
m[0].
Data(),
"L")==0))
2501 number nn=(number)vv->
m[1].
Data();
2508 Werror(
"illegal argument for pseudo ordering L: %d",vv->
m[1].
Typ());
2515 if (bitmask!=0) n--;
2519 R->block0=(
int *)
omAlloc0((n+1)*
sizeof(
int));
2520 R->block1=(
int *)
omAlloc0((n+1)*
sizeof(
int));
2523 for (j_in_R= n-2; j_in_R>=0; j_in_R--)
2526 for(j_in_R=0,j_in_L=0;j_in_R<n-1;j_in_R++,j_in_L++)
2531 WerrorS(
"ordering must be list of lists");
2538 if (strcmp((
char*)vv->
m[0].
Data(),
"L")==0)
2552 if (j_in_R==0)
R->block0[0]=1;
2569 if (jj<0)
R->block0[j_in_R]=1;
2570 else R->block0[j_in_R]=
R->block1[jj]+1;
2577 for(
int i=0;
i<
l;
i++) (*iv)[
i]=1;
2598 int sq=(int)
sqrt((
double)(iv_len));
2599 R->block1[j_in_R]=
si_max(
R->block0[j_in_R],
R->block0[j_in_R]+sq-1);
2602 R->block1[j_in_R]=
si_max(
R->block0[j_in_R],
R->block0[j_in_R]+iv_len-1);
2603 if (
R->block1[j_in_R]>
R->N)
2605 if (
R->block0[j_in_R]>
R->N)
2607 Print(
"R->block0[j_in_R]=%d,N=%d\n",
R->block0[j_in_R],
R->N);
2611 R->block1[j_in_R]=
R->N;
2612 iv_len=
R->block1[j_in_R]-
R->block0[j_in_R]+1;
2618 switch (
R->order[j_in_R])
2627 R->wvhdl[j_in_R] =(
int *)
omAlloc(iv_len*
sizeof(
int));
2628 for (
i=0;
i<iv_len;
i++)
2630 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2635 for (
i=0;
i<iv_len;
i++)
2637 R->wvhdl[j_in_R][
i]=(*iv)[
i];
2639 R->wvhdl[j_in_R][
i]=iv->
length() - iv_len;
2643 R->wvhdl[j_in_R][
i+1]=(*iv)[
i];
2648 for (
i=0;
i<iv->
length();
i++)
R->wvhdl[j_in_R][
i]=(*iv)[
i];
2649 if (
R->block1[j_in_R]>
R->N)
2651 R->block1[j_in_R]=
R->N;
2665 for (
i=0;
i<iv_len;
i++)
2667 if (((*iv)[
i]!=1)&&(iv_len!=1))
2670 Warn(
"ignore weight %d for ord %d (%s) at pos %d\n>>%s<<",
2681 R->block1[j_in_R]=
R->block0[j_in_R]=0;
2685 R->block1[j_in_R]=
R->block0[j_in_R]=(*iv)[0];
2691 R->block1[j_in_R] =
R->block0[j_in_R] = 0;
2694 const int s = (*iv)[0];
2696 R->block1[j_in_R] =
R->block0[j_in_R] =
s;
2705 WerrorS(
"ring order not implemented");
2713 WerrorS(
"ordering name must be a (string,intvec)");
2722 if (
R->block1[j_in_R] !=
R->N)
2733 R->block0[j_in_R] <=
R->N)
2735 R->block1[j_in_R] =
R->N;
2739 Werror(
"ordering incomplete: size (%d) should be %d",
R->block1[j_in_R],
R->N);
2743 if (
R->block0[j_in_R]>
R->N)
2745 Werror(
"not enough variables (%d) for ordering block %d, scanned so far:",
R->N,j_in_R+1);
2746 for(
int ii=0;ii<=j_in_R;ii++)
2775 WerrorS(
"ordering must be given as `list`");
2778 if (bitmask!=0) {
R->bitmask=bitmask;
R->wanted_maxExp=bitmask; }
2810 int ch = (int)(
long)L->
m[0].
Data();
2820 Warn(
"%d is invalid characteristic of ground field. %d is used.", ch,
l);
2823 #ifndef TEST_ZN_AS_ZP
2827 mpz_init_set_ui(modBase,(
long) ch);
2834 R->cf->has_simple_Inverse=1;
2853 int ch = (int)(
long)LL->
m[0].
Data();
2854 while ((ch!=
fftable[is_gf_char]) && (
fftable[is_gf_char])) is_gf_char++;
2855 if (
fftable[is_gf_char]==0) is_gf_char=-1;
2876 WerrorS(
"could not create the specified coefficient field");
2880 if( extRing->qideal !=
NULL )
2883 extParam.
r = extRing;
2889 extParam.
r = extRing;
2898 WerrorS(
"coefficient field must be described by `int` or `list`");
2904 WerrorS(
"could not create coefficient field described by the input!");
2916 #ifdef HAVE_SHIFTBBA
2919 R->isLPring=isLetterplace;
2924 if ((bitmask!=0)&&(
R->wanted_maxExp==0))
R->wanted_maxExp=bitmask;
2931 ideal q=(ideal)L->
m[3].
Data();
2937 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2944 int par_perm_size=0;
2964 par_perm_size=
rPar(orig_ring);
2974 WerrorS(
"coefficient fields must be equal if q-ideal !=0");
2978 perm=(
int *)
omAlloc0((orig_ring->N+1)*
sizeof(
int));
2979 if (par_perm_size!=0)
2980 par_perm=(
int *)
omAlloc0(par_perm_size*
sizeof(
int));
2984 maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2993 else if (par_perm_size!=0)
3001 par_perm,par_perm_size);
3019 WerrorS(
"q-ideal must be given as `ideal`");
3068 ideal
id=(ideal)a->
Data();
3088 int n=(int)(
long)
b->Data();
3089 int d=(int)(
long)c->
Data();
3096 if ((d>n) || (d<1) || (n<1))
3101 int *choise = (
int*)
omAlloc(d*
sizeof(
int));
3105 temp=(ideal)id->
Data();
3120 p =
pCopy(temp->m[choise[
l-1]-1]);
3146 BOOLEAN minim=(int)(
long)
w->Data();
3148 int add_row_shift=0;
3154 add_row_shift = ww->
min_in();
3155 (*weights) -= add_row_shift;
3159 if (ww!=
NULL)
delete weights;
3185 if ((fullres==
NULL) && (minres==
NULL))
3299 ideal F=(ideal)id->
Data();
3305 res->data=(
char *)iv;
3311 for(
int i=0;
i<n;
i++) (*iv)[
i]=1;
3315 double wNsqr = (double)2.0 / (
double)n;
3317 x = (
int * )
omAlloc(2 * (n + 1) *
sizeof(
int));
3319 for (
i = n;
i!=0;
i--)
3320 (*iv)[
i-1] =
x[
i + n + 1];
3338 res->data=(
void *)
b;
3364 spec.
mu = (int)(
long)(
l->m[0].Data( ));
3365 spec.
pg = (int)(
long)(
l->m[1].Data( ));
3366 spec.
n = (int)(
long)(
l->m[2].Data( ));
3374 for(
int i=0;
i<spec.
n;
i++ )
3377 spec.
w[
i] = (*mul)[
i];
3408 for(
int i=0;
i<spec.
n;
i++ )
3412 (*mult)[
i] = spec.
w[
i];
3422 L->
m[0].
data = (
void*)(
long)spec.
mu;
3423 L->
m[1].
data = (
void*)(
long)spec.
pg;
3424 L->
m[2].
data = (
void*)(
long)spec.
n;
3475 WerrorS(
"the list is too short" );
3478 WerrorS(
"the list is too long" );
3482 WerrorS(
"first element of the list should be int" );
3485 WerrorS(
"second element of the list should be int" );
3488 WerrorS(
"third element of the list should be int" );
3491 WerrorS(
"fourth element of the list should be intvec" );
3494 WerrorS(
"fifth element of the list should be intvec" );
3497 WerrorS(
"sixth element of the list should be intvec" );
3501 WerrorS(
"first element of the list should be positive" );
3504 WerrorS(
"wrong number of numerators" );
3507 WerrorS(
"wrong number of denominators" );
3510 WerrorS(
"wrong number of multiplicities" );
3514 WerrorS(
"the Milnor number should be positive" );
3517 WerrorS(
"the geometrical genus should be nonnegative" );
3520 WerrorS(
"all numerators should be positive" );
3523 WerrorS(
"all denominators should be positive" );
3526 WerrorS(
"all multiplicities should be positive" );
3530 WerrorS(
"it is not symmetric" );
3533 WerrorS(
"it is not monotonous" );
3537 WerrorS(
"the Milnor number is wrong" );
3540 WerrorS(
"the geometrical genus is wrong" );
3544 WerrorS(
"unspecific error" );
3580 ( fast==2 ? 2 : 1 ) );
3590 ( fast==0 || (*node)->weight<=smax ) )
3612 cmp =
pCmp( (*node)->mon,
f );
3635 (*node)->nf =
search->nf;
3639 while( cmp<0 &&
f!=(poly)
NULL );
3652 if( (*node)->weight<=(
Rational)1 ) pg++;
3653 if( (*node)->weight==smax ) z++;
3654 if( (*node)->weight>weight_prev ) n++;
3656 weight_prev = (*node)->weight;
3657 node = &((*node)->next);
3679 cmp =
pCmp( (*node)->mon,
f );
3692 while( cmp<0 &&
f!=(poly)
NULL );
3708 n = ( z > 0 ? 2*n - 1 : 2*n );
3723 ( fast==0 ||
search->weight<=smax );
3749 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )
3752 (*den) [n2] = (*den)[n1];
3753 (*mult)[n2] = (*mult)[n1];
3761 if( fast==0 || fast==1 )
3765 for(
int n1=0, n2=n-1 ; n1<n2 && symmetric==
TRUE; n1++, n2-- )
3768 (*
den) [n1]!= (*
den)[n2] ||
3775 if( symmetric==
FALSE )
3785 (*L)->m[0].data = (
void*)(
long)
mu;
3802 (*L)->m[0].data = (
void*)(
long)
mu;
3803 (*L)->m[1].data = (
void*)(
long)pg;
3804 (*L)->m[2].data = (
void*)(
long)n;
3805 (*L)->m[3].data = (
void*)nom;
3806 (*L)->m[4].data = (
void*)
den;
3807 (*L)->m[5].data = (
void*)
mult;
3816 #ifdef SPECTRUM_DEBUG
3817 #ifdef SPECTRUM_PRINT
3818 #ifdef SPECTRUM_IOSTREAM
3819 cout <<
"spectrumCompute\n";
3820 if( fast==0 ) cout <<
" no optimization" << endl;
3821 if( fast==1 ) cout <<
" weight optimization" << endl;
3822 if( fast==2 ) cout <<
" symmetry optimization" << endl;
3824 fputs(
"spectrumCompute\n",stdout );
3825 if( fast==0 ) fputs(
" no optimization\n", stdout );
3826 if( fast==1 ) fputs(
" weight optimization\n", stdout );
3827 if( fast==2 ) fputs(
" symmetry optimization\n", stdout );
3871 #ifdef SPECTRUM_DEBUG
3872 #ifdef SPECTRUM_PRINT
3873 #ifdef SPECTRUM_IOSTREAM
3874 cout <<
"\n computing the Jacobi ideal...\n";
3876 fputs(
"\n computing the Jacobi ideal...\n",stdout );
3885 #ifdef SPECTRUM_DEBUG
3886 #ifdef SPECTRUM_PRINT
3887 #ifdef SPECTRUM_IOSTREAM
3890 fputs(
" ", stdout );
3901 #ifdef SPECTRUM_DEBUG
3902 #ifdef SPECTRUM_PRINT
3903 #ifdef SPECTRUM_IOSTREAM
3905 cout <<
" computing a standard basis..." << endl;
3907 fputs(
"\n", stdout );
3908 fputs(
" computing a standard basis...\n", stdout );
3916 #ifdef SPECTRUM_DEBUG
3917 #ifdef SPECTRUM_PRINT
3920 #ifdef SPECTRUM_IOSTREAM
3923 fputs(
" ",stdout );
3968 #ifdef SPECTRUM_DEBUG
3969 #ifdef SPECTRUM_PRINT
3970 #ifdef SPECTRUM_IOSTREAM
3971 cout <<
"\n computing the highest corner...\n";
3973 fputs(
"\n computing the highest corner...\n", stdout );
3978 poly hc = (poly)
NULL;
3982 if( hc!=(poly)
NULL )
3998 #ifdef SPECTRUM_DEBUG
3999 #ifdef SPECTRUM_PRINT
4000 #ifdef SPECTRUM_IOSTREAM
4003 fputs(
" ", stdout );
4013 #ifdef SPECTRUM_DEBUG
4014 #ifdef SPECTRUM_PRINT
4015 #ifdef SPECTRUM_IOSTREAM
4016 cout <<
"\n computing the newton polygon...\n";
4018 fputs(
"\n computing the newton polygon...\n", stdout );
4025 #ifdef SPECTRUM_DEBUG
4026 #ifdef SPECTRUM_PRINT
4035 #ifdef SPECTRUM_DEBUG
4036 #ifdef SPECTRUM_PRINT
4037 #ifdef SPECTRUM_IOSTREAM
4038 cout <<
"\n computing the weight corner...\n";
4040 fputs(
"\n computing the weight corner...\n", stdout );
4045 poly wc = ( fast==0 ?
pCopy( hc ) :
4050 #ifdef SPECTRUM_DEBUG
4051 #ifdef SPECTRUM_PRINT
4052 #ifdef SPECTRUM_IOSTREAM
4055 fputs(
" ", stdout );
4065 #ifdef SPECTRUM_DEBUG
4066 #ifdef SPECTRUM_PRINT
4067 #ifdef SPECTRUM_IOSTREAM
4068 cout <<
"\n computing NF...\n" << endl;
4070 fputs(
"\n computing NF...\n", stdout );
4079 #ifdef SPECTRUM_DEBUG
4080 #ifdef SPECTRUM_PRINT
4082 #ifdef SPECTRUM_IOSTREAM
4085 fputs(
"\n", stdout );
4110 WerrorS(
"polynomial is zero" );
4113 WerrorS(
"polynomial has constant term" );
4116 WerrorS(
"not a singularity" );
4119 WerrorS(
"the singularity is not isolated" );
4122 WerrorS(
"highest corner cannot be computed" );
4125 WerrorS(
"principal part is degenerate" );
4131 WerrorS(
"unknown error occurred" );
4148 WerrorS(
"only works for local orderings" );
4156 WerrorS(
"does not work in quotient rings" );
4202 WerrorS(
"only works for local orderings" );
4207 WerrorS(
"does not work in quotient rings" );
4266 else if(
l->nr > 5 )
4304 int mu = (int)(
long)(
l->m[0].Data( ));
4305 int pg = (int)(
long)(
l->m[1].Data( ));
4306 int n = (int)(
long)(
l->m[2].Data( ));
4317 if( n !=
num->length( ) )
4321 else if( n !=
den->length( ) )
4325 else if( n != mul->
length( ) )
4345 for(
i=0;
i<n;
i++ )
4347 if( (*
num)[
i] <= 0 )
4351 if( (*
den)[
i] <= 0 )
4355 if( (*mul)[
i] <= 0 )
4367 for(
i=0,
j=n-1;
i<=
j;
i++,
j-- )
4371 (*mul)[
i] != (*mul)[
j] )
4381 for(
i=0,
j=1;
i<n/2;
i++,
j++ )
4393 for(
mu=0,
i=0;
i<n;
i++ )
4398 if(
mu != (
int)(
long)(
l->m[0].Data( )) )
4407 for( pg=0,
i=0;
i<n;
i++ )
4415 if( pg != (
int)(
long)(
l->m[1].Data( )) )
4444 WerrorS(
"first argument is not a spectrum:" );
4449 WerrorS(
"second argument is not a spectrum:" );
4482 int k = (int)(
long)second->
Data( );
4486 WerrorS(
"first argument is not a spectrum" );
4491 WerrorS(
"second argument should be positive" );
4517 BOOLEAN qh=(((int)(long)
w->Data())==1);
4528 WerrorS(
"first argument is not a spectrum" );
4533 WerrorS(
"second argument is not a spectrum" );
4576 WerrorS(
"Ground field not implemented!");
4596 LP->
m= (int)(
long)(
v->Data());
4602 LP->
n= (int)(
long)(
v->Data());
4608 LP->
m1= (int)(
long)(
v->Data());
4614 LP->
m2= (int)(
long)(
v->Data());
4620 LP->
m3= (int)(
long)(
v->Data());
4623 Print(
"m (constraints) %d\n",LP->
m);
4624 Print(
"n (columns) %d\n",LP->
n);
4648 lres->
m[4].
data=(
void*)(
long)LP->
m;
4651 lres->
m[5].
data=(
void*)(
long)LP->
n;
4653 res->data= (
void*)lres;
4660 ideal gls = (ideal)(arg1->
Data());
4661 int imtype= (int)(
long)arg2->
Data();
4684 gls= (poly)(arg1->
Data());
4685 int howclean= (int)(
long)arg3->
Data();
4689 WerrorS(
"Input polynomial is constant!");
4698 rlist->
Init( r[0] );
4699 for(
int i=r[0];
i>0;
i--)
4714 WerrorS(
"Ground field not implemented!");
4721 unsigned long int ii = (
unsigned long int)arg2->
Data();
4746 if ( (vpos !=
i) && (
pGetExp( piter,
i ) != 0) )
4748 WerrorS(
"The input polynomial must be univariate!");
4756 number * pcoeffs= (number *)
omAlloc( (deg+1) *
sizeof( number ) );
4758 for (
i= deg;
i >= 0;
i-- )
4773 for (
i=deg;
i >= 0;
i--)
4781 roots->
solver( howclean );
4789 rlist->
Init( elem );
4793 for (
j= 0;
j < elem;
j++ )
4802 for (
j= 0;
j < elem;
j++ )
4806 rlist->
m[
j].
data=(
void *)dummy;
4819 res->data= (
void*)rlist;
4828 p= (ideal)arg1->
Data();
4829 w= (ideal)arg2->
Data();
4840 int tdg= (int)(
long)arg3->
Data();
4847 WerrorS(
"Last input parameter must be > 0!");
4855 if (
m != (
int)
pow((
double)tdg+1,(
double)n) )
4857 Werror(
"Size of second input ideal must be equal to %d!",
4858 (
int)
pow((
double)tdg+1,(
double)n));
4865 WerrorS(
"Ground field not implemented!");
4870 number *pevpoint= (number *)
omAlloc( n *
sizeof( number ) );
4871 for (
i= 0;
i < n;
i++ )
4880 WerrorS(
"Elements of first input ideal must not be equal to -1, 0, 1!");
4889 WerrorS(
"Elements of first input ideal must be numbers!");
4892 pevpoint[
i]=
nCopy( tmp );
4896 number *wresults= (number *)
omAlloc(
m *
sizeof( number ) );
4897 for (
i= 0;
i <
m;
i++ )
4906 WerrorS(
"Elements of second input ideal must be numbers!");
4921 res->data= (
void*)rpoly;
4936 else gls= (ideal)(
v->Data());
4942 else imtype= (int)(
long)
v->Data();
4947 ideal test_id=
idInit(1,1);
4951 if (gls->m[
j]!=
NULL)
4953 test_id->m[0]=gls->m[
j];
4957 WerrorS(
"Newton polytope not of expected dimension");
4971 unsigned long int ii=(
unsigned long int)
v->Data();
4979 else howclean= (int)(
long)
v->Data();
5008 WerrorS(
"Error occurred during matrix setup!");
5021 WerrorS(
"Unsuitable input ideal: Minor of resultant matrix is singular!");
5027 if ( interpolate_det )
5033 if ( interpolate_det )
5040 for (
i=0;
i < c;
i++)
pWrite(iproots[
i]->getPoly());
5042 for (
i=0;
i < c;
i++)
pWrite(muiproots[
i]->getPoly());
5046 arranger=
new rootArranger( iproots, muiproots, howclean );
5057 WerrorS(
"Solver was unable to find any roots!");
5063 for (
i=0;
i <
count;
i++)
delete iproots[
i];
5066 for (
i=0;
i <
count;
i++)
delete muiproots[
i];
5073 res->data= (
void *)listofroots;
5097 onepoint->
Init(elem);
5098 for (
j= 0;
j < elem;
j++ )
5114 listofroots->
m[
i].
data=(
void *)onepoint;
5122 listofroots->
Init( 0 );
5136 if (rg==
NULL)
return;
5160 Warn(
"deleting denom_list for ring change to %s",
IDID(
h));
5174 if ((rg!=
NULL) && (rg->idroot==
NULL))
5202 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5207 (*iv)[
i]= - (*iv)[
i];
5216 if((*iv)[
i]>=0) { neg=
FALSE;
break; }
5221 (*iv)[
i]= -(*iv)[
i];
5230 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5236 (*iv2)[2]=iv->
length()-2;
5248 if((*iv)[
i]!=1) { all_one=
FALSE;
break; }
5254 (*iv2)[2]=iv->
length()-2;
5295 (*iv)[2] += (*iv2)[2];
5302 if (!change)
h=
h->next;
5310 int last = 0, o=0, n = 1,
i=0, typ = 1,
j;
5322 R->wanted_maxExp=(*iv)[2]*2+1;
5335 WerrorS(
"invalid combination of orderings");
5343 WerrorS(
"more than one ordering c/C specified");
5349 R->block0=(
int *)
omAlloc0(n*
sizeof(
int));
5350 R->block1=(
int *)
omAlloc0(n*
sizeof(
int));
5353 int *weights=(
int*)
omAlloc0((
R->N+1)*
sizeof(
int));
5356 for (
j=0;
j < n-1;
j++)
5387 R->block0[n] =
last+1;
5390 R->wvhdl[n][
i-2] = (*iv)[
i];
5392 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5405 R->block0[n] =
last+1;
5407 else last += (*iv)[0];
5412 if (weights[
i]==0) weights[
i]=typ;
5424 const int s = (*iv)[2];
5434 const int s = (*iv)[2];
5436 if( 1 <
s ||
s < -1 )
return TRUE;
5452 R->block0[n] =
last+1;
5457 R->wvhdl[n][
i-2]=(*iv)[
i];
5459 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5461 last=
R->block0[n]-1;
5466 R->block0[n] =
last+1;
5469 if (
R->block1[n]-
R->block0[n]+2>=iv->
length())
5470 WarnS(
"missing module weights");
5471 for (
i=2;
i<=(
R->block1[n]-
R->block0[n]+2);
i++)
5473 R->wvhdl[n][
i-2]=(*iv)[
i];
5475 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5477 R->wvhdl[n][
i-2]=iv->
length() -3 -(
R->block1[n]-
R->block0[n]);
5480 R->wvhdl[n][
i-1]=(*iv)[
i];
5482 last=
R->block0[n]-1;
5487 R->block0[n] =
last+1;
5495 if (weights[
last]==0) weights[
last]=(*iv)[
i]*typ;
5497 last=
R->block0[n]-1;
5503 if (Mtyp==0)
return TRUE;
5504 if (Mtyp==-1) typ = -1;
5508 R->wvhdl[n][
i-2]=(*iv)[
i];
5510 R->block0[n] =
last+1;
5513 for(
i=
R->block1[n];
i>=
R->block0[n];
i--)
5515 if (weights[
i]==0) weights[
i]=typ;
5525 Werror(
"Internal Error: Unknown ordering %d", (*iv)[1]);
5532 Werror(
"mismatch of number of vars (%d) and ordering (>=%d vars)",
5540 for(
i=1;
i<=
R->N;
i++)
5541 {
if (weights[
i]<0) {
R->OrdSgn=-1;
break; }}
5555 if (
R->block1[n] !=
R->N)
5566 R->block0[n] <=
R->N)
5568 R->block1[n] =
R->N;
5572 Werror(
"mismatch of number of vars (%d) and ordering (%d vars)",
5591 *
p = (
char*)sl->
name;
5659 WerrorS(
"parameter expected");
5666 for(
int i=pars-1;
i>=0;
i--)
5678 int ch = (int)(
long)pn->
Data();
5689 if ((ch<2)||(ch!=ch2))
5691 Warn(
"%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5694 #ifndef TEST_ZN_AS_ZP
5698 mpz_init_set_ui(modBase, (
long)ch);
5705 cf->has_simple_Inverse=1;
5718 if ((ch!=0) && (ch!=
IsPrime(ch)) && (pars == 1))
5730 if ((ch!=0) && (ch!=
IsPrime(ch)))
5732 WerrorS(
"too many parameters");
5740 WerrorS(
"parameter expected");
5746 extParam.
r =
rDefault( ch, pars, names);
5747 for(
int i=pars-1;
i>=0;
i--)
5760 && ((strcmp(pn->
name,
"real")==0) || (strcmp(pn->
name,
"complex")==0)))
5763 BOOLEAN complex_flag=(strcmp(pn->
name,
"complex")==0);
5766 float_len=(int)(
long)pnn->
Data();
5767 float_len2=float_len;
5771 float_len2=(int)(
long)pnn->
Data();
5805 else if ((pn->
name !=
NULL) && (strcmp(pn->
name,
"integer") == 0))
5809 unsigned int modExponent = 1;
5810 mpz_init_set_si(modBase, 0);
5817 mpz_set_ui(modBase, (
long) pnn->
Data());
5821 modExponent = (long) pnn->
Data();
5826 mpz_mul_ui(modBase, modBase, (
int)(
long) pnn->
Data());
5839 if ((mpz_cmp_ui(modBase, 1) == 0) && (
mpz_sgn1(modBase) < 0))
5841 WerrorS(
"Wrong ground ring specification (module is 1)");
5844 if (modExponent < 1)
5846 WerrorS(
"Wrong ground ring specification (exponent smaller than 1");
5851 if (modExponent > 1 &&
cf ==
NULL)
5853 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*
sizeof(
unsigned long)))
5864 WerrorS(
"modulus must not be 0 or parameter not allowed");
5870 info.exp= modExponent;
5879 WerrorS(
"modulus must not be 0 or parameter not allowed");
5885 info.exp= modExponent;
5894 ring r=(ring)pn->
Data();
5895 if (r->qideal==
NULL)
5902 else if (
IDELEMS(r->qideal)==1)
5911 WerrorS(
"algebraic extension ring must have one minpoly");
5917 WerrorS(
"Wrong or unknown ground field specification");
5923 Print(
"pn[%p]: type: %d [%s]: %p, name: %s", (
void*)
p,
p->Typ(),
Tok2Cmdname(
p->Typ()),
p->Data(), (
p->name ==
NULL?
"NULL" :
p->name) );
5945 WerrorS(
"Invalid ground field specification");
5969 WerrorS(
"name of ring variable expected");
6022 int *perm=(
int *)
omAlloc0((org_ring->N+1)*
sizeof(
int));
6039 WerrorS(
"name of ring variable expected");
6049 for(;
i<org_ring->N;
i++)
6051 if (strcmp(org_ring->names[
i],
R->names[
j])==0)
6059 Werror(
"variable %d (%s) not in basering",
j+1,
R->names[
j]);
6076 if (min_var==-1) min_var=perm[
j];
6084 R->block0[
i]=min_var;
6085 R->block1[
i]=max_var;
6089 R->wvhdl[
i]=(
int*)
omAlloc0((max_var-min_var+1)*
sizeof(
int));
6094 R->wvhdl[
i][perm[
j]-
R->block0[
i]]=
6095 org_ring->wvhdl[
i][
j-org_ring->block0[
i]];
6121 R->order[
j-1]=
R->order[
j];
6122 R->block0[
j-1]=
R->block0[
j];
6123 R->block1[
j-1]=
R->block1[
j];
6125 R->wvhdl[
j-1]=
R->wvhdl[
j];
6133 while (
R->order[n]==0) n--;
6136 if (
R->block1[n] !=
R->N)
6147 R->block0[n] <=
R->N)
6149 R->block1[n] =
R->N;
6153 Werror(
"mismatch of number of vars (%d) and ordering (%d vars) in block %d",
6154 R->N,
R->block1[n],n);
6160 R->OrdSgn = org_ring->OrdSgn;
6183 if ((r->ref<=0)&&(r->order!=
NULL))
6193 if (
j==0)
WarnS(
"killing the basering for level 0");
6198 while (r->idroot!=
NULL)
6201 killhdl2(r->idroot,&(r->idroot),r);
6247 Warn(
"deleting denom_list for ring change from %s",
IDID(
h));
6321 ideal I=(ideal)u->
Data();
6324 for(
i=I->nrows*I->ncols-1;
i>=0;
i--)
6336 switch (
p->language)
6345 if(
p->libname!=
NULL)
6346 Print(
",%s",
p->libname);
6361 tmp_in.
data=(
void*)(
long)(*aa)[
i];
6369 Werror(
"apply fails at index %d",
i+1);
6372 if (
i==0) { memcpy(
res,&tmp_out,
sizeof(tmp_out)); }
6377 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6399 res->data=(
void *)
l;
6406 for(
int i=0;
i<=aa->
nr;
i++)
6409 tmp_in.
Copy(&(aa->
m[
i]));
6418 Werror(
"apply fails at index %d",
i+1);
6421 if (
i==0) { memcpy(
res,&tmp_out,
sizeof(tmp_out)); }
6426 memcpy(curr,&tmp_out,
sizeof(tmp_out));
6449 WerrorS(
"first argument to `apply` must allow an index");
6459 char assume_yylinebuf[80];
6461 int lev=(long)a->
Data();
6468 if (bo) {
WerrorS(
"syntax error in ASSUME");
return TRUE;}
6470 if (
b->Data()==
NULL) {
Werror(
"ASSUME failed:%s",assume_yylinebuf);
return TRUE;}
6482 size_t len=strlen(a)+strlen(
s)+30;
6485 int end_s=strlen(
s);
6486 while ((end_s>0) && ((
s[end_s]<=
' ')||(
s[end_s]==
';'))) end_s--;
6489 snprintf(
name,len,
"%s->%s",a,
s);
6491 int start_s=end_s-1;
6492 while ((start_s>=0) && (
s[start_s]!=
';')) start_s--;
6495 snprintf(ss,len,
"parameter def %s;return(%s);\n",a,
s);
6500 snprintf(ss,len,
"parameter def %s;%s;return(%s);\n",a,
s,
s+start_s+1);
6561 snprintf(
buf,250,
"wrong length of parameters(%d), expected ",t);
6563 snprintf(
buf,250,
"par. %d is of undefined, expected ",nr);
6565 snprintf(
buf,250,
"par. %d is of type `%s`, expected ",nr,
Tok2Cmdname(t));
6566 for(
int i=1;
i<=
T[0];
i++)
6571 if (
i<
T[0]) strcat(
buf,
",");
6581 if (type_list[0]==0)
return TRUE;
6584 if (
l!=(
int)type_list[0])
6589 for(
int i=1;
i<=
l;
i++,args=args->
next)
6591 short t=type_list[
i];
6595 || (t!=args->
Typ()))
6606void iiReportMethods(
int args,
int iiOp,
char* cmd)
6618 Print(
" %s (%s) -> %s",
Rational pow(const Rational &a, int e)
struct for passing initialization parameters to naInitChar
void atSet(idhdl root, char *name, void *data, int typ)
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
static int si_max(const int a, const int b)
static int si_min(const int a, const int b)
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
unsigned char * proc[NUM_PROC]
poly singclap_resultant(poly f, poly g, poly x, const ring r)
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
matrix singclap_irrCharSeries(ideal I, const ring r)
int * Zp_roots(poly p, const ring r)
void show(int mat=0, int spaces=0) const
virtual number getSubDet()
virtual ideal getMatrix()
virtual IStateType initState() const
rootArranger(rootContainer **_roots, rootContainer **_mu, const int _howclean=PM_CORRUPT)
complex root finder for univariate polynomials based on laguers algorithm
gmp_complex * getRoot(const int i)
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
bool solver(const int polishmode=PM_NONE)
Linear Programming / Linear Optimization using Simplex - Algorithm.
BOOLEAN mapFromMatrix(matrix m)
matrix mapToMatrix(matrix m)
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
void Clean(ring r=currRing)
INLINE_THIS void Init(int l=0)
void delete_node(spectrumPolyNode **)
int mult_spectrum(spectrum &)
int mult_spectrumh(spectrum &)
Base class for solving 0-dim poly systems using u-resultant.
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
resMatrixBase * accessResMat()
vandermonde system solver for interpolating polynomials from their values
poly numvec2poly(const number *q)
number * interpolateDense(const number *q)
Solves the Vandermode linear system \sum_{i=1}^{n} x_i^k-1 w_i = q_k, k=1,..,n.
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
@ n_R
single prescision (6,6) real numbers
@ n_Q
rational (GMP) numbers
@ n_Znm
only used if HAVE_RINGS is defined
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_Zn
only used if HAVE_RINGS is defined
@ n_long_R
real floating point (GMP) numbers
@ n_Z2m
only used if HAVE_RINGS is defined
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
@ n_Z
only used if HAVE_RINGS is defined
@ n_long_C
complex floating point (GMP) numbers
short float_len2
additional char-flags, rInit
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
const char * par_name
parameter name
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
const unsigned short fftable[]
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE char * nCoeffName(const coeffs cf)
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
short float_len
additional char-flags, rInit
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Creation data needed for finite fields.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
factory.h' is the user interface to Factory.
void WerrorS(const char *s)
const char * feSetOptValue(feOptIndex opt, char *optarg)
static void * feOptValue(feOptIndex opt)
VAR char my_yylinebuf[80]
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
ideal maMapIdeal(const ideal map_id, const ring preimage_r, const ideal image_id, const ring image_r, const nMapFunc nMap)
polynomial map for ideals/module/matrix map_id: the ideal to map map_r: the base ring for map_id imag...
int iiTestConvert(int inputType, int outputType)
const char * iiTwoOps(int t)
const char * Tok2Cmdname(int tok)
static int RingDependend(int t)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge)
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
void hKill(monf xmem, int Nvar)
void hDelete(scfmon ev, int ev_length)
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
scfmon hInit(ideal S, ideal Q, int *Nexist)
void hRadical(scfmon rad, int *Nrad, int Nvar)
#define idDelete(H)
delete an ideal
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
static BOOLEAN idIsZeroDim(ideal i)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
STATIC_VAR int * multiplicity
static BOOLEAN length(leftv result, leftv arg)
intvec * ivCopy(const intvec *o)
#define IMATELEM(M, I, J)
int IsCmd(const char *n, int &tok)
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
idhdl ggetid(const char *n)
void killhdl2(idhdl h, idhdl *ih, ring r)
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
VAR proclevel * procstack
idhdl packFindHdl(package r)
EXTERN_VAR omBin sleftv_bin
INST_VAR sleftv iiRETURNEXPR
char * iiGetLibProcBuffer(procinfo *pi, int part)
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
lists rDecompose(const ring r)
@ semicListWrongNumberOfNumerators
@ semicListFirstElementWrongType
@ semicListSecondElementWrongType
@ semicListFourthElementWrongType
@ semicListWrongNumberOfDenominators
@ semicListThirdElementWrongType
@ semicListWrongNumberOfMultiplicities
@ semicListFifthElementWrongType
@ semicListSixthElementWrongType
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
lists rDecompose_list_cf(const ring r)
int iiOpsTwoChar(const char *s)
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
BOOLEAN jjMINRES(leftv res, leftv v)
BOOLEAN killlocals_list(int v, lists L)
BOOLEAN iiParameter(leftv p)
STATIC_VAR BOOLEAN iiNoKeepRing
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
static void rRenameVars(ring R)
void iiCheckPack(package &p)
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
VAR BOOLEAN iiDebugMarker
ring rInit(leftv pn, leftv rv, leftv ord)
leftv iiMap(map theMap, const char *what)
int iiRegularity(lists L)
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
static void rDecomposeC_41(leftv h, const coeffs C)
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
BOOLEAN iiARROW(leftv r, char *a, char *s)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
BOOLEAN syBetti1(leftv res, leftv u)
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
static void rDecomposeC(leftv h, const ring R)
int exprlist_length(leftv v)
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
poly iiHighCorner(ideal I, int ak)
the largest monomial in R/I
BOOLEAN spectrumfProc(leftv result, leftv first)
lists listOfRoots(rootArranger *self, const unsigned int oprec)
static void jjINT_S_TO_ID(int n, int *e, leftv res)
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
BOOLEAN jjCHARSERIES(leftv res, leftv u)
void rDecomposeCF(leftv h, const ring r, const ring R)
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
void list_error(semicState state)
BOOLEAN mpJacobi(leftv res, leftv a)
const char * iiTwoOps(int t)
BOOLEAN iiBranchTo(leftv, leftv args)
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
BOOLEAN iiTestAssume(leftv a, leftv b)
void iiSetReturn(const leftv source)
BOOLEAN iiAssignCR(leftv r, leftv arg)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
spectrumState spectrumCompute(poly h, lists *L, int fast)
idhdl rFindHdl(ring r, idhdl n)
syStrategy syConvList(lists li)
BOOLEAN spectrumProc(leftv result, leftv first)
BOOLEAN iiDefaultParameter(leftv p)
void rComposeC(lists L, ring R)
BOOLEAN iiCheckRing(int i)
#define BREAK_LINE_LENGTH
static void rDecomposeRing_41(leftv h, const coeffs C)
spectrumState spectrumStateFromList(spectrumPolyList &speclist, lists *L, int fast)
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
ring rSubring(ring org_ring, sleftv *rv)
BOOLEAN kWeight(leftv res, leftv id)
static leftv rOptimizeOrdAsSleftv(leftv ord)
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
spectrum spectrumFromList(lists l)
static idhdl rSimpleFindHdl(const ring r, const idhdl root, const idhdl n)
static void iiReportTypes(int nr, int t, const short *T)
void rDecomposeRing(leftv h, const ring R)
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
static BOOLEAN iiInternalExport(leftv v, int toLev)
static void rDecompose_23456(const ring r, lists L)
void copy_deep(spectrum &spec, lists l)
void killlocals_rec(idhdl *root, int v, ring r)
semicState list_is_spectrum(lists l)
static void killlocals0(int v, idhdl *localhdl, const ring r)
BOOLEAN semicProc(leftv res, leftv u, leftv v)
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
const char * lastreserved
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
void paPrint(const char *n, package p)
static resolvente iiCopyRes(resolvente r, int l)
BOOLEAN kQHWeight(leftv res, leftv v)
void rComposeRing(lists L, ring R)
BOOLEAN iiExport(leftv v, int toLev)
BOOLEAN jjBETTI(leftv res, leftv u)
void spectrumPrintError(spectrumState state)
lists getList(spectrum &spec)
BOOLEAN iiWRITE(leftv res, leftv v)
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
static BOOLEAN rComposeVar(const lists L, ring R)
const struct sValCmd1 dArith1[]
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
VAR denominator_list DENOMINATOR_LIST
denominator_list_s * denominator_list
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
char * lString(lists l, BOOLEAN typed, int dim)
BOOLEAN lRingDependend(lists L)
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
static matrix mu(matrix A, const ring R)
matrix mpNew(int r, int c)
create a r x c zero-matrix
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
#define MATELEM(mat, i, j)
1-based access to matrix
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
ideal loNewtonPolytope(const ideal id)
EXTERN_VAR size_t gmp_output_digits
uResultant::resMatType determineMType(int imtype)
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
gmp_float sqrt(const gmp_float &a)
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...
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
BOOLEAN nuVanderSys(leftv res, leftv arg1, leftv arg2, leftv arg3)
COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consi...
BOOLEAN nuMPResMat(leftv res, leftv arg1, leftv arg2)
returns module representing the multipolynomial resultant matrix Arguments 2: ideal i,...
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
BOOLEAN nuUResSolve(leftv res, leftv args)
solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing-...
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nPrint(a)
only for debug, over any initialized currRing
#define SHORT_REAL_LENGTH
#define omFreeSize(addr, size)
#define omCheckAddr(addr)
#define omReallocSize(addr, o_size, size)
#define omCheckAddrSize(addr, size)
#define omFreeBin(addr, bin)
#define omFreeBinAddr(addr)
#define omRealloc0Size(addr, o_size, size)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
static int pLength(poly a)
#define __pp_Mult_nn(p, n, r)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static void p_Setm(poly p, const ring r)
static void p_Delete(poly *p, const ring r)
static poly p_Init(const ring r, omBin bin)
static poly p_Copy(poly p, const ring r)
returns a copy of p
static long p_Totaldegree(poly p, const ring r)
#define __p_Mult_nn(p, n, r)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing).
static long pTotaldegree(poly p)
#define pIsConstant(p)
like above, except that Comp must be 0
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
#define pGetVariables(p, e)
#define pGetExp(p, i)
Exponent.
#define pCopy(p)
return a copy of the poly
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
void PrintS(const char *s)
void Werror(const char *fmt,...)
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...
const char * rSimpleOrdStr(int ord)
int rTypeOfMatrixOrder(const intvec *order)
ring rAssure_HasComp(const ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
BOOLEAN rCheckIV(const intvec *iv)
rRingOrder_t rOrderName(char *ordername)
void rDelete(ring r)
unconditionally deletes fields in r
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
void rSetSyzComp(int k, const ring r)
static BOOLEAN rField_is_R(const ring r)
static BOOLEAN rField_is_Zp_a(const ring r)
static BOOLEAN rField_is_Z(const ring r)
static BOOLEAN rField_is_Zp(const ring r)
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rField_is_long_C(const ring r)
static int rBlocks(const ring r)
static ring rIncRefCnt(ring r)
static BOOLEAN rField_is_Zn(const ring r)
static int rPar(const ring r)
(r->cf->P)
static int rInternalChar(const ring r)
static BOOLEAN rIsLPRing(const ring r)
@ ringorder_a64
for int64 weights
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_IS
Induced (Schreyer) ordering.
static BOOLEAN rField_is_Q_a(const ring r)
static BOOLEAN rField_is_Q(const ring r)
static void rDecRefCnt(ring r)
static char const ** rParameter(const ring r)
(r->cf->parameter)
static BOOLEAN rField_is_long_R(const ring r)
static BOOLEAN rField_is_numeric(const ring r)
static BOOLEAN rField_is_GF(const ring r)
static short rVar(const ring r)
define rVar(r) (r->N)
#define rField_is_Ring(R)
int status int void size_t count
int status int void * buf
BOOLEAN slWrite(si_link l, leftv v)
BOOLEAN ssiWrite2(si_link l, leftv res, leftv v)
ideal idInit(int idsize, int rank)
initialise an ideal / module
intvec * id_QHomWeight(ideal id, const ring r)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
BOOLEAN hasAxis(ideal J, int k, const ring r)
int hasOne(ideal J, const ring r)
BOOLEAN ringIsLocal(const ring r)
static BOOLEAN hasConstTerm(poly h, const ring r)
poly computeWC(const newtonPolygon &np, Rational max_weight, const ring r)
static BOOLEAN hasLinearTerm(poly h, const ring r)
void computeNF(ideal stdJ, poly hc, poly wc, spectrumPolyList *NF, const ring r)
INST_VAR sleftv sLastPrinted
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
void syMinimizeResolvente(resolvente res, int length, int first)
void syKillComputation(syStrategy syzstr, ring r=currRing)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
void syKillEmptyEntres(resolvente res, int length)
int name
New type name for int.
struct for passing initialization parameters to naInitChar
THREAD_VAR double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)