38 int i2=(int)(
long)b->
Data();
48 mpz_ptr modBase= (mpz_ptr)
omAlloc(
sizeof(mpz_t));
49 mpz_init_set_ui(modBase,i2);
61 number i2=(number)b->
Data();
65 number modBase= (number)
omAlloc(
sizeof(mpz_t));
67 info.
base= (mpz_ptr)modBase;
79 res->
data=(
void*)(
long)(a2==b2);
85 ring
r=(ring)a->
Data();
99 number2 a2=(number2)a->
Data();
125 a2=(number2)an->
Data();
126 b2=(number2)bn->
Data();
127 if (((a2!=
NULL) && (b2!=
NULL) && (a2->cf!=b2->cf))
135 WerrorS(
"Number not compatible");
142 if (r->cf==
NULL) op=0;
145 case '+': r->n=
n_Add(aa,bb,r->cf);
break;
146 case '-': r->n=
n_Sub(aa,bb,r->cf);
break;
147 case '*': r->n=
n_Mult(aa,bb,r->cf);
break;
148 case '/': r->n=
n_Div(aa,bb,r->cf);
break;
149 case '%': r->n=
n_IntMod(aa,bb,r->cf);
break;
166 Werror(
"cannot convert second operand (%s) to Number",b->
Name());
172 Werror(
"cannot convert first operand (%s) to Number",a->
Name());
180 number2 a2=(number2)a->
Data();
181 number2
r=(number2)
omAlloc(
sizeof(*r));
183 if (a2->cf==
NULL) op=0;
186 case '-': r->n=
n_Copy(a2->n,a2->cf);r->n=
n_InpNeg(r->n,a2->cf);
break;
198 poly2 a2=(poly2)a->
Data();
224 a2=(poly2)an->
Data();
225 b2=(poly2)bn->
Data();
226 if (((a2!=
NULL) && (b2!=
NULL) && (a2->cf!=b2->cf))
234 WerrorS(
"Poly not compatible");
241 if (r->cf==
NULL) op=0;
265 Werror(
"cannot convert second operand (%s) to Poly",b->
Name());
271 Werror(
"cannot convert first operand (%s) to Poly",a->
Name());
279 poly2 a2=(poly2)a->
Data();
282 if (a2->cf==
NULL) op=0;
285 case '-': r->n=
p_Copy(a2->n,a2->cf);r->n=
p_Neg(r->n,a2->cf);
break;
297 number2
r=(number2)
omAlloc(
sizeof(*r));
320 number2 a2=(number2)a->
Data();
326 r->n=nMap(a2->n,a2->cf,r->cf);
332 default: bo=
TRUE;
break;
346 number2 n=(number2)a->
Data();
348 res->
data=(
void*)n->cf;
354 poly2 n=(poly2)a->
Data();
356 res->
data=(
void*)n->cf;
375 (int)(
long)c->
Data(),
383 number2 n2=(number2)a->
Data();
400 number2 n2Copy(
const number2 d)
405 r=(number2)
omAlloc(
sizeof(*r));
415 void n2Delete(number2 &d)
428 char *n2String(number2 d,
BOOLEAN typed)
441 void n2Print(number2 d)
443 char *
s=n2String(d,
FALSE);
452 poly2 p2Copy(
const poly2 d)
467 void p2Delete(poly2 &d)
480 char *p2String(poly2 d,
BOOLEAN typed)
493 void p2Print(poly2 d)
495 char *
s=p2String(d,
FALSE);
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
const CanonicalForm int s
int iiTestConvert(int inputType, int outputType)
Class used for (list of) interpreter objects.
only used if HAVE_RINGS is defined
BOOLEAN jjCRING_Zm(leftv res, leftv a, leftv b)
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
const struct sConvertTypes dConvertTypes[]
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
#define omFreeSize(addr, size)
BOOLEAN jjEQUAL_CR(leftv res, leftv a, leftv b)
void WerrorS(const char *s)
void nlGMP(number &i, number n, const coeffs r)
poly p_Sub(poly p1, poly p2, const ring r)
static poly p_Copy(poly p, const ring r)
returns a copy of p
char * crString(coeffs c)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
The main handler for Singular numbers which are suitable for Singular polynomials.
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
void StringSetS(const char *st)
static poly pp_Mult_qq(poly p, poly q, const ring r)
void StringAppendS(const char *st)
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 FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static FORCE_INLINE char * nCoeffName(const coeffs cf)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
only used if HAVE_RINGS is defined
void PrintS(const char *s)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
BOOLEAN jjR2_CR(leftv res, leftv a)
void p_Write0(poly p, ring lmRing, ring tailRing)
static void p_Delete(poly *p, const ring r)
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
struct for passing initialization parameters to naInitChar
const char * Tok2Cmdname(int tok)
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
coeffs basecoeffs() const
BOOLEAN jjCRING_Zp(leftv res, leftv a, leftv b)
void CleanUp(ring r=currRing)
static poly p_Neg(poly p, const ring r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static poly p_Add_q(poly p, poly q, const ring r)
#define omFreeBin(addr, bin)
void nKillChar(coeffs r)
undo all initialisations
poly p_Power(poly p, int i, const ring r)
void Werror(const char *fmt,...)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL