34 d[
i]->cfCoeffWrite(d[
i],
b);
36 if (d[
i]==
NULL)
break;
48 if (d[
i]->type==
n_R)
return d[
i]->cfGreaterZero(
k,d[
i]);
49 if (d[
i]->type==
n_long_R)
return d[
i]->cfGreaterZero(
k,d[
i]);
51 if (d[
i]==
NULL)
return d[
i-1]->cfGreaterZero(
k,d[
i-1]);
66 number *C=(number*)
omAlloc(
i*
sizeof(number));
70 C[
i]=d[
i]->cfMult(
A[
i],
B[
i],d[
i]);
72 if (d[
i]==
NULL)
return (number)C;
88 number *C=(number*)
omAlloc(
i*
sizeof(number));
92 C[
i]=d[
i]->cfInit(
l,d[
i]);
94 if (d[
i]==
NULL)
return (number)C;
107 if (d[
i]->type==
n_R)
return d[
i]->cfInt(n,d[
i]);
108 if (d[
i]->type==
n_long_R)
return d[
i]->cfInt(n,d[
i]);
110 if (d[
i]==
NULL)
return d[
i-1]->cfInt(n,d[
i-1]);
121 if (d[
i]->type==
n_R)
s+=d[
i]->cfSize(n,d[
i]);
126 if (
s==0)
return d[
i-1]->cfSize(n,d[
i-1]);
142 number *C=(number*)
omAlloc(
i*
sizeof(number));
146 C[
i]=d[
i]->cfCopy(
A[
i],d[
i]);
148 if (d[
i]==
NULL)
return (number)C;
163 number *C=(number*)
omAlloc(
i*
sizeof(number));
167 C[
i]=d[
i]->cfAdd(
A[
i],
B[
i],d[
i]);
169 if (d[
i]==
NULL)
return (number)C;
184 number *C=(number*)
omAlloc(
i*
sizeof(number));
188 C[
i]=d[
i]->cfSub(
A[
i],
B[
i],d[
i]);
190 if (d[
i]==
NULL)
return (number)C;
249 number *C=(number*)
omAlloc(
i*
sizeof(number));
253 C[
i]=d[
i]->cfDiv(
A[
i],
B[
i],d[
i]);
255 if (d[
i]==
NULL)
return (number)C;
274 number *C=(number*)
omAlloc(
i*
sizeof(number));
278 C[
i]=d[
i]->cfInvers(
A[
i],d[
i]);
280 if (d[
i]==
NULL)
return (number)C;
297 A[
i]=d[
i]->cfInpNeg(
A[
i],d[
i]);
299 if (d[
i]==
NULL)
return (number)
A;
311 if (d[
i]->type==
n_R)
return d[
i]->cfGreater(
A[
i],
B[
i],d[
i]);
316 return d[
i-1]->cfGreater(
A[
i],
B[
i],d[
i-1]);
342 if (d[
i]->type==
n_R) { d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
343 else if (d[
i]->type==
n_long_R) {d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
345 if (d[
i]==
NULL) { d[
i-1]->cfWriteLong(
A[
i-1],d[
i-1]);
return; }
357 d[
i]->cfWriteLong(
A[
i],d[
i]);
365 void nrPower (number a,
int i, number *
result,
const coeffs r)
394 number *C=(number*)
omAlloc0(
i*
sizeof(number));
401 if ((d[
i]->type==
n_R)
404 s=d[
i]->cfRead(
s,&(C[
i]),d[
i]);
405 is_zero=d[
i]->cfIsZero(C[
i],d[
i]);
412 s=d[
i-1]->cfRead(
s,&(C[
i-1]),d[
i-1]);
413 is_zero=d[
i-1]->cfIsZero(C[
i-1],d[
i-1]);
425 if (d[
i]->type==
n_Zp)
431 }
while(
l%(d[
i]->ch)==0);
432 C[
i]=d[
i]->cfInit(
l,d[
i]);
434 else if ((d[
i]->type==
n_R)
438 C[
i]=nMap(C[reader],d[reader],d[
i]);
442 WerrorS(
"reading is not suppiorted for such compinations of coeffs");
447 if (d[
i]==
NULL)
break;
455 C[
i]=d[
i]->cfInit(0,d[
i]);
457 if (d[
i]==
NULL)
break;
462 s=d[0]->cfRead(
s,&(C[0]),d[0]);
466 if (d[
i]==
NULL)
break;
470 C[
i]=nMap(C[0],d[0],d[
i]);
476 WerrorS(
"nnRead: should not happen");
493 bo&=d[
i]->cfDBTest(
A[
i],
f,
l,d[
i]);
495 if (d[
i]==
NULL)
return bo;
509 number *C=(number*)
omAlloc(
i*
sizeof(number));
514 nMap=d[
i]->cfSetMap(aRing,d[
i]);
515 if (nMap==
NULL)
Werror(
"no map for compoment %d",
i);
516 else C[
i]=nMap(from,aRing,d[
i]);
518 if (d[
i]==
NULL)
return (number)C;
529 #define SI_BUF_SIZE 1024
536 char *
s=d[
i]->cfCoeffName(d[
i]);
539 if (d[
i]==
NULL)
break;
554 char *
s=d[
i]->cfCoeffName(d[
i]);
557 if (d[
i]==
NULL)
break;
572 d[
i]->cfDelete(&(
A[
i]),d[
i]);
574 if (d[
i]==
NULL)
break;
607 n->cfExactDiv=
nnDiv;
Coefficient rings, fields and other domains suitable for Singular polynomials.
@ n_R
single prescision (6,6) real numbers
@ n_long_R
real floating point (GMP) numbers
@ n_nTupel
n-tupel of cf: ZZ/p1,...
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
const CanonicalForm int s
void WerrorS(const char *s)
The main handler for Singular numbers which are suitable for Singular polynomials.
static char * nnCoeffName(const coeffs r)
static number nnMap(number from, const coeffs aRing, const coeffs r)
static BOOLEAN nnIsZero(number a, const coeffs r)
static number nnChineseRemainder(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
static BOOLEAN nnIsMOne(number a, const coeffs r)
static number nnCopy(number a, const coeffs r)
static number nnDiv(number a, number b, const coeffs r)
static number nnAdd(number a, number b, const coeffs r)
static void nnDelete(number *a, const coeffs r)
static number nnInpNeg(number a, const coeffs r)
static void nnWriteShort(number a, const coeffs r)
static BOOLEAN nnEqual(number a, number b, const coeffs r)
static number nnInit(long l, const coeffs r)
static long nnInt(number &n, const coeffs r)
static si_char_SI_BUF_SIZE nnCoeffName_buf
static number nnMult(number a, number b, const coeffs r)
static BOOLEAN nnGreaterZero(number k, const coeffs r)
BOOLEAN nnInitChar(coeffs n, void *p)
Initialize r.
static BOOLEAN nnGreater(number a, number b, const coeffs r)
static number nnInvers(number a, const coeffs r)
static number nnSub(number a, number b, const coeffs r)
static void nnCoeffWrite(const coeffs r, BOOLEAN b)
static BOOLEAN nnIsOne(number a, const coeffs r)
static int nnSize(number n, const coeffs r)
char si_char_SI_BUF_SIZE[SI_BUF_SIZE]
static void nnWriteLong(number a, const coeffs r)
static const char * nnRead(const char *s, number *a, const coeffs r)
static char * nnCoeffString(const coeffs r)
nMapFunc nnSetMap(const coeffs src, const coeffs dst)
BOOLEAN nnDBTest(number a, const char *f, const int l, const coeffs r)
const char *const nDivBy0
#define omFreeSize(addr, size)
void StringSetS(const char *st)
void StringAppendS(const char *st)
void PrintS(const char *s)
void Werror(const char *fmt,...)
int status int void * buf