19 #define TRANSEXT_PRIVATES
83 #ifdef HAVE_GETTIMEOFDAY
119 #if HAVE_CAN_SHORT_OUT
131 cf->extRing->ShortOut = shortOut;
133 cf = cf->extRing->cf;
146 number one =
nInit(1);
147 number nn=
nMult(n,one);
181 Werror(
"type %d too complex...set minpoly before",
IDTYP(h));
break;
189 WarnS(
"Set minpoly over non-transcendental ground field to 0?!");
198 WarnS(
"Trying to set minpoly over non-transcendental ground field...");
201 WerrorS(
"cannot set minpoly for these coeffients");
208 WerrorS(
"only univarite minpoly allowed");
218 WarnS(
"no minpoly allowed if there are local objects belonging to the basering: ");
239 WarnS(
"minpoly is already 0...");
243 WarnS(
"cannot set minpoly to 0 / alg. extension?");
251 Warn(
"killing a local object due to minpoly change: %s",
IDID(
currRing->idroot));
262 if ((p==
NULL) ||(NUM((fraction)p)==
NULL))
264 Werror(
"Could not construct the alg. extension: minpoly==0");
269 if (DEN((fraction)(p)) !=
NULL)
271 poly z=NUM((fraction)p);
272 poly n=DEN((fraction)(p));
275 DEN((fraction)(p))=
NULL;
279 q->m[0] = NUM((fraction)p);
283 PrintS(
"\nTrying to conver the currRing into an algebraic field: ");
284 PrintS(
"Ground poly. ring: \n");
286 PrintS(
"\nGiven MinPOLY: ");
296 NUM((fractionObject *)p) =
NULL;
305 Werror(
"Could not construct the alg. extension: llegal minpoly?");
370 Werror(
"index[%d] must be positive",i+1);
379 (*iv1)[
i]=(int)((
long)(a->
Data()));
383 res->
data=(
void *)ivn;
386 (*iv)[
i]=(int)((
long)(a->
Data()));
390 int c=e->next->start;
391 if ((i>=iv->
rows())||(c<1)||(c>iv->
cols()))
393 Werror(
"wrong range [%d,%d] in intmat %s(%d,%d)",i+1,c,res->
Name(),iv->
rows(),iv->
cols());
419 number2 nn=(number2)res->
data;
430 Werror(
"index[%d] must be positive",i+1);
436 WerrorS(
"only one index given");
441 int c=e->next->start;
442 if ((i>=iv->
rows())||(c<1)||(c>iv->
cols()))
444 Werror(
"wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->
Name(),iv->
rows(),iv->
cols());
468 number2 nn=(number2)res->
data;
475 WerrorS(
"no (c)ring avialable for conversion from int");
484 Werror(
"index[%d] must be positive",i+1);
490 WerrorS(
"only one index given");
495 int c=e->next->start;
496 if ((i>=iv->
rows())||(c<1)||(c>iv->
cols()))
498 Werror(
"wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->
Name(),iv->
rows(),iv->
cols());
516 number2 nn=(number2)res->
data;
519 number2
n=(number2)
omAlloc(
sizeof(*n));
533 WerrorS(
"no (c)ring avialable for conversion from number");
542 Werror(
"index[%d] must be positive",i+1);
548 WerrorS(
"only one index given");
553 int c=e->next->start;
554 if ((i>=iv->
rows())||(c<1)||(c>iv->
cols()))
556 Werror(
"wrong range [%d,%d] in cmatrix %s(%d,%d)",i+1,c,res->
Name(),iv->
rows(),iv->
cols());
587 Werror(
"index[%d] must be positive",i+1);
593 WerrorS(
"only one index given");
598 int c=e->next->start;
599 if ((i>=iv->
rows())||(c<1)||(c>iv->
cols()))
601 Werror(
"wrong range [%d,%d] in bigintmat %s(%d,%d)",i+1,c,res->
Name(),iv->
rows(),iv->
cols());
618 int add_row_shift = 0;
620 if (weights!=
NULL) add_row_shift=weights->
min_in();
664 Werror(
"index[%d] must be positive",j);
692 if ((am->
rows()!=1) || (am->
cols()!=1))
701 int j=e->next->start;
723 int j=e->next->start;
735 void* tmp = res->
data;
742 char *
s=(
char *)res->
data;
743 if ((e->start>0)&&(e->start<=(int)strlen(s)))
744 s[e->start-1]=(char)(*((
char *)a->
Data()));
747 Werror(
"string index %d out of range 1..%d",e->start,(
int)strlen(s));
756 const char *procname,
int line,
868 res->
data = (
void *) l;
897 char *rn=f->preimage;
918 ideal
id = (ideal)a->
Data();
932 if ( qr->cf != newcf )
954 for(i = 0, j = 0; i<
IDELEMS(
id); i++)
991 Warn(
"%s is no twosided standard basis",a->
Name());
1014 ring
r=(ring)a->
Data();
1044 res->
data=(
void *)0;
1059 #define NULL_VAL NULL
1082 WarnS(
"right side is not a datum, assignment ignored");
1110 memcpy(l,&ll,
sizeof(
sleftv));
1131 WerrorS(
"error in assign: left side is not an l-value");
1137 #ifdef BLACKBOX_DEVEL
1138 Print(
"bb-assign: bb=%lx\n",bb);
1140 return (bb==
NULL) || bb->blackbox_Assign(l,r);
1205 Werror(
"`%s`(%s) = `%s` is not supported",
1208 Werror(
"`%s` = `%s` is not supported"
1217 Werror(
"expected `%s` = `%s`"
1285 Werror(
"`%s` = `%s` is not supported"
1294 Werror(
"expected `%s` = `%s`"
1312 memset(&t,0,
sizeof(
sleftv));
1314 while ((i<iv->length())&&(l!=
NULL))
1316 t.
data=(
char *)(
long)(*iv)[
i];
1321 if (nok)
return TRUE;
1340 memset(&t,0,
sizeof(
sleftv));
1348 t.
data=(
char *)I->m[i];
1446 Warn(
"expression list length(%d) does not match intmat size(%d)",
1453 (*iv)[i++] = (int)((
long)(hh->
Data()));
1462 (*iv)[i++] = (*ivv)[ll++];
1496 Warn(
"expression list length(%d) does not match bigintmat size(%d x %d)",
1509 bim->
set(i++, (number)(hh->
Data()));
1548 sl += strlen((
char *)hh->
Data());
1556 t=(
char *)hh->
Data();
1577 memset(&t,0,
sizeof(
sleftv));
1583 while ((i<mxn )&&(l!=
NULL))
1585 t.
data=(
char *)m->
m[i];
1609 Warn(
"list length mismatch in assign (l>r)");
1616 Warn(
"list length mismatch in assign (l<r)");
1654 char *
s=(
char *)r->
Data();
1657 memset(&t,0,
sizeof(
sleftv));
1659 while ((i<sl)&&(l!=
NULL))
1681 int i=l->
e->start-1;
1684 Werror(
"index[%d] must be positive",i+1);
1709 memset(&(li->
m[li->
nr+1]),0,(i-li->
nr)*
sizeof(
sleftv));
1720 && (ld->
Typ()!=r->
Typ()))
1723 memset(&tmp,0,
sizeof(
sleftv));
1727 memcpy(ld,&tmp,
sizeof(
sleftv));
1729 else if ((ld->
e==
NULL)
1734 memset(&tmp,0,
sizeof(
sleftv));
1739 memcpy(ld,&tmp,
sizeof(
sleftv));
1744 if (l->
e!=
NULL) l->
e->next=ld->
e;
1767 }
while ((!b)&&(l!=
NULL));
1820 if(bb->blackbox_CheckAssign(bb,l,r))
return TRUE;
1823 if((!b) && (like_lists==2))
1847 #ifdef BLACKBOX_DEVEL
1848 Print(
"bb-assign: bb=%lx\n",bb);
1850 return (bb==
NULL) || bb->blackbox_Assign(l,r);
1938 Werror(
"length of lists in assignment does not match (l:%d,r:%d)",
1974 WerrorS(
"expected ring-name");
1980 WerrorS(
"expected image ideal");
1996 char *pr=((
map)olm)->preimage;
2008 num=olm->
cols()*rk ;
2013 Warn(
"expression list length(%d) does not match matrix size(%d)",el,num);
2063 for(k=0;k<
j;k++,i++)
2086 if (module_assign) lm->
rank=rk;
2087 else if (map_assign) ((
map)lm)->preimage=pr;
2105 Werror(
"cannot assign to %s",l->Fullname());
2123 ideal I0=(ideal)I->
Data();
2187 char *vn=(
char *)v->
Name();
2194 WarnS(
"source and destination packages are identical");
2200 Warn(
"redefining `%s`",vn);
2206 memset(&h_expr,0,
sizeof(h_expr));
2210 return iiAssign(&tmp_expr,&h_expr);
static BOOLEAN jiA_BIGINTMAT(leftv res, leftv a, Subexpr)
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
void * idrecDataInit(int t)
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
static BOOLEAN jiA_MAP(leftv res, leftv a, Subexpr)
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
void id_Normalize(ideal I, const ring r)
normialize all polys in id
void ipMoveId(idhdl tomove)
const CanonicalForm int s
int iiTestConvert(int inputType, int outputType)
BOOLEAN jjIMPORTFROM(leftv, leftv u, leftv v)
static void jiAssignAttr(leftv l, leftv r)
Class used for (list of) interpreter objects.
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
static BOOLEAN jjMAXDEG(leftv, leftv a)
void jjNormalizeQRingP(leftv I)
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
ideal idVec2Ideal(poly vec)
static BOOLEAN jiA_QRING(leftv res, leftv a, Subexpr e)
static BOOLEAN jiA_INT(leftv res, leftv a, Subexpr e)
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
static int si_min(const int a, const int b)
Compatiblity layer for legacy polynomial operations (over currRing)
int exprlist_length(leftv v)
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
#define omreallocSize(addr, o_size, size)
static BOOLEAN jiAssign_list(leftv l, leftv r)
static BOOLEAN jiA_NUMBER(leftv res, leftv a, Subexpr)
void n2Delete(number2 &d)
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
static BOOLEAN jjPRINTLEVEL(leftv, leftv a)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
#define idSimpleAdd(A, B)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
static BOOLEAN jjTRACE(leftv, leftv a)
static BOOLEAN jiA_NUMBER2_N(leftv res, leftv a, Subexpr e)
static BOOLEAN jiA_PACKAGE(leftv res, leftv a, Subexpr)
static BOOLEAN jiA_1x1MATRIX(leftv res, leftv a, Subexpr e)
static BOOLEAN jiA_LIST_RES(leftv res, leftv a, Subexpr)
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
void WerrorS(const char *s)
static BOOLEAN jiA_STRING(leftv res, leftv a, Subexpr e)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
static bool rIsPluralRing(const ring r)
we must always have this test!
BOOLEAN piKill(procinfov pi)
char * String(BOOLEAN typed=FALSE)
static BOOLEAN jiA_MODUL_P(leftv res, leftv a, Subexpr)
#define pGetComp(p)
Component.
int int kStrategy strat if(h==NULL) return NULL
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
static BOOLEAN iiAssign_sys(leftv l, leftv r)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void killhdl2(idhdl h, idhdl *ih, ring r)
static number2 n2Init(long i, coeffs c)
static BOOLEAN jiA_INTVEC(leftv res, leftv a, Subexpr)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static BOOLEAN jjTIMER(leftv, leftv a)
static BOOLEAN jjCOLMAX(leftv, leftv a)
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
The main handler for Singular numbers which are suitable for Singular polynomials.
BOOLEAN slInit(si_link l, char *istr)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
struct sValAssign dAssign[]
static BOOLEAN jjRTIMER(leftv, leftv a)
static BOOLEAN jiA_BIGINT(leftv res, leftv a, Subexpr e)
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.
BOOLEAN assumeStdFlag(leftv h)
void PrintS(const char *s)
static poly p_Mult_nn(poly p, number n, const ring r)
void rWrite(ring r, BOOLEAN details)
static BOOLEAN jjMINPOLY(leftv, leftv a)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN jiA_CRING(leftv res, leftv a, Subexpr e)
static BOOLEAN jjMAXMULT(leftv, leftv a)
static BOOLEAN jiA_RING(leftv res, leftv a, Subexpr e)
#define BIMATELEM(M, I, J)
INLINE_THIS void Init(int l=0)
matrix mpNew(int r, int c)
create a r x c zero-matrix
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
const Variable & v
< [in] a sqrfree bivariate poly
void jjNormalizeQRingId(leftv I)
poly p_MinPolyNormalize(poly p, const ring r)
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
static BOOLEAN rField_is_Ring(const ring r)
static BOOLEAN jjECHO(leftv, leftv a)
static BOOLEAN jiAssign_rec(leftv l, leftv r)
void pEnlargeSet(poly **p, int l, int increment)
struct for passing initialization parameters to naInitChar
void rDelete(ring r)
unconditionally deletes fields in r
static BOOLEAN jiA_LINK(leftv res, leftv a, Subexpr)
const char * Tok2Cmdname(int tok)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
void killhdl(idhdl h, package proot)
static BOOLEAN jiA_PROC(leftv res, leftv a, Subexpr)
coeffs basecoeffs() const
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
static bool rIsSCA(const ring r)
void CleanUp(ring r=currRing)
void Clean(ring r=currRing)
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
static BOOLEAN jjSHORTOUT(leftv, leftv a)
static BOOLEAN jiA_1x1INTMAT(leftv res, leftv a, Subexpr e)
static BOOLEAN jjNOETHER(leftv, leftv a)
static BOOLEAN jiA_NUMBER2(leftv res, leftv a, Subexpr e)
int idElem(const ideal F)
count non-zero elements
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
struct sValAssign_sys dAssign_sys[]
static BOOLEAN jiA_LIST(leftv res, leftv a, Subexpr)
static BOOLEAN jiA_IDEAL(leftv res, leftv a, Subexpr)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void p_Write(poly p, ring lmRing, ring tailRing)
void slCleanUp(si_link l)
static BOOLEAN jiA_NUMBER2_I(leftv res, leftv a, Subexpr e)
#define omFreeBin(addr, bin)
#define IMATELEM(M, I, J)
static BOOLEAN jiA_POLY(leftv res, leftv a, Subexpr e)
BOOLEAN lRingDependend(lists L)
void nKillChar(coeffs r)
undo all initialisations
static BOOLEAN jiA_RESOLUTION(leftv res, leftv a, Subexpr)
void Werror(const char *fmt,...)
static BOOLEAN jiA_MAP_ID(leftv res, leftv a, Subexpr)
void idDelete(ideal *h)
delete an ideal
void syKillComputation(syStrategy syzstr, ring r=currRing)
static BOOLEAN jiA_IDEAL_M(leftv res, leftv a, Subexpr)
intvec * ivAdd(intvec *a, intvec *b)
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
si_link slCopy(si_link l)
static BOOLEAN jiA_DEF(leftv res, leftv, Subexpr)
#define MATELEM(mat, i, j)
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static void jjMINPOLY_red(idhdl h)
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)