33 d[
i]->cfCoeffWrite(d[
i],
b);
35 if (d[
i]==
NULL)
break;
47 if (d[
i]->type==
n_R)
return d[
i]->cfGreaterZero(
k,d[
i]);
48 if (d[
i]->type==
n_long_R)
return d[
i]->cfGreaterZero(
k,d[
i]);
50 if (d[
i]==
NULL)
return d[
i-1]->cfGreaterZero(
k,d[
i-1]);
65 number *C=(number*)
omAlloc(
i*
sizeof(number));
69 C[
i]=d[
i]->cfMult(
A[
i],
B[
i],d[
i]);
71 if (d[
i]==
NULL)
return (number)C;
87 number *C=(number*)
omAlloc(
i*
sizeof(number));
91 C[
i]=d[
i]->cfInit(
l,d[
i]);
93 if (d[
i]==
NULL)
return (number)C;
106 if (d[
i]->type==
n_R)
return d[
i]->cfInt(n,d[
i]);
107 if (d[
i]->type==
n_long_R)
return d[
i]->cfInt(n,d[
i]);
109 if (d[
i]==
NULL)
return d[
i-1]->cfInt(n,d[
i-1]);
120 if (d[
i]->type==
n_R)
s+=d[
i]->cfSize(n,d[
i]);
125 if (
s==0)
return d[
i-1]->cfSize(n,d[
i-1]);
141 number *C=(number*)
omAlloc(
i*
sizeof(number));
145 C[
i]=d[
i]->cfCopy(
A[
i],d[
i]);
147 if (d[
i]==
NULL)
return (number)C;
162 number *C=(number*)
omAlloc(
i*
sizeof(number));
166 C[
i]=d[
i]->cfAdd(
A[
i],
B[
i],d[
i]);
168 if (d[
i]==
NULL)
return (number)C;
183 number *C=(number*)
omAlloc(
i*
sizeof(number));
187 C[
i]=d[
i]->cfSub(
A[
i],
B[
i],d[
i]);
189 if (d[
i]==
NULL)
return (number)C;
248 number *C=(number*)
omAlloc(
i*
sizeof(number));
252 C[
i]=d[
i]->cfDiv(
A[
i],
B[
i],d[
i]);
254 if (d[
i]==
NULL)
return (number)C;
273 number *C=(number*)
omAlloc(
i*
sizeof(number));
277 C[
i]=d[
i]->cfInvers(
A[
i],d[
i]);
279 if (d[
i]==
NULL)
return (number)C;
296 A[
i]=d[
i]->cfInpNeg(
A[
i],d[
i]);
298 if (d[
i]==
NULL)
return (number)
A;
310 if (d[
i]->type==
n_R)
return d[
i]->cfGreater(
A[
i],
B[
i],d[
i]);
315 return d[
i-1]->cfGreater(
A[
i],
B[
i],d[
i-1]);
341 if (d[
i]->type==
n_R) { d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
342 else if (d[
i]->type==
n_long_R) {d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
344 if (d[
i]==
NULL) { d[
i-1]->cfWriteLong(
A[
i-1],d[
i-1]);
return; }
356 d[
i]->cfWriteLong(
A[
i],d[
i]);
364void nrPower (number a,
int i, number *
result,
const coeffs r)
393 number *C=(number*)
omAlloc0(
i*
sizeof(number));
400 if ((d[
i]->type==
n_R)
403 s=d[
i]->cfRead(
s,&(C[
i]),d[
i]);
404 is_zero=d[
i]->cfIsZero(C[
i],d[
i]);
411 s=d[
i-1]->cfRead(
s,&(C[
i-1]),d[
i-1]);
412 is_zero=d[
i-1]->cfIsZero(C[
i-1],d[
i-1]);
424 if (d[
i]->type==
n_Zp)
430 }
while(
l%(d[
i]->ch)==0);
431 C[
i]=d[
i]->cfInit(
l,d[
i]);
433 else if ((d[
i]->type==
n_R)
437 C[
i]=nMap(C[reader],d[reader],d[
i]);
441 WerrorS(
"reading is not suppiorted for such compinations of coeffs");
446 if (d[
i]==
NULL)
break;
454 C[
i]=d[
i]->cfInit(0,d[
i]);
456 if (d[
i]==
NULL)
break;
461 s=d[0]->cfRead(
s,&(C[0]),d[0]);
465 if (d[
i]==
NULL)
break;
469 C[
i]=nMap(C[0],d[0],d[
i]);
475 WerrorS(
"nnRead: should not happen");
492 bo&=d[
i]->cfDBTest(
A[
i],
f,
l,d[
i]);
494 if (d[
i]==
NULL)
return bo;
508 number *C=(number*)
omAlloc(
i*
sizeof(number));
513 nMap=d[
i]->cfSetMap(aRing,d[
i]);
514 if (nMap==
NULL)
Werror(
"no map for compoment %d",
i);
515 else C[
i]=nMap(from,aRing,d[
i]);
517 if (d[
i]==
NULL)
return (number)C;
528 #define SI_BUF_SIZE 1024
535 char *
s=d[
i]->cfCoeffName(d[
i]);
538 if (d[
i]==
NULL)
break;
553 char *
s=d[
i]->cfCoeffName(d[
i]);
556 if (d[
i]==
NULL)
break;
571 d[
i]->cfDelete(&(
A[
i]),d[
i]);
573 if (d[
i]==
NULL)
break;
606 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,... ZZ/pn, R, long_R
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 number nnMap(number from, const coeffs aRing, const coeffs r)
static BOOLEAN nnIsZero(number a, const coeffs r)
static char * nnCoeffName(const coeffs r)
static BOOLEAN nnIsMOne(number a, const coeffs r)
STATIC_VAR si_char_SI_BUF_SIZE nnCoeffName_buf
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 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.
nMapFunc nnSetMap(const coeffs, const coeffs)
static const char * nnRead(const char *s, number *a, const coeffs 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 number nnChineseRemainder(number *, number *, int, BOOLEAN, CFArray &, const coeffs)
static void nnWriteLong(number a, const coeffs r)
static char * nnCoeffString(const coeffs r)
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