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;
83 d[
i]->cfInpMult(
A[
i],
B[
i],d[
i]);
85 if (d[
i]==
NULL)
return;
101 number *C=(number*)
omAlloc(
i*
sizeof(number));
105 C[
i]=d[
i]->cfInit(
l,d[
i]);
107 if (d[
i]==
NULL)
return (number)C;
120 if (d[
i]->type==
n_R)
return d[
i]->cfInt(n,d[
i]);
121 if (d[
i]->type==
n_long_R)
return d[
i]->cfInt(n,d[
i]);
123 if (d[
i]==
NULL)
return d[
i-1]->cfInt(n,d[
i-1]);
134 if (d[
i]->type==
n_R)
s+=d[
i]->cfSize(n,d[
i]);
139 if (
s==0)
return d[
i-1]->cfSize(n,d[
i-1]);
155 number *C=(number*)
omAlloc(
i*
sizeof(number));
159 C[
i]=d[
i]->cfCopy(
A[
i],d[
i]);
161 if (d[
i]==
NULL)
return (number)C;
176 number *C=(number*)
omAlloc(
i*
sizeof(number));
180 C[
i]=d[
i]->cfAdd(
A[
i],
B[
i],d[
i]);
182 if (d[
i]==
NULL)
return (number)C;
194 d[
i]->cfInpAdd(
A[
i],
B[
i],d[
i]);
196 if (d[
i]==
NULL)
return;
211 number *C=(number*)
omAlloc(
i*
sizeof(number));
215 C[
i]=d[
i]->cfSub(
A[
i],
B[
i],d[
i]);
217 if (d[
i]==
NULL)
return (number)C;
276 number *C=(number*)
omAlloc(
i*
sizeof(number));
280 C[
i]=d[
i]->cfDiv(
A[
i],
B[
i],d[
i]);
282 if (d[
i]==
NULL)
return (number)C;
301 number *C=(number*)
omAlloc(
i*
sizeof(number));
305 C[
i]=d[
i]->cfInvers(
A[
i],d[
i]);
307 if (d[
i]==
NULL)
return (number)C;
324 A[
i]=d[
i]->cfInpNeg(
A[
i],d[
i]);
326 if (d[
i]==
NULL)
return (number)
A;
338 if (d[
i]->type==
n_R)
return d[
i]->cfGreater(
A[
i],
B[
i],d[
i]);
343 return d[
i-1]->cfGreater(
A[
i],
B[
i],d[
i-1]);
369 if (d[
i]->type==
n_R) { d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
370 else if (d[
i]->type==
n_long_R) {d[
i]->cfWriteLong(
A[
i],d[
i]);
return; }
372 if (d[
i]==
NULL) { d[
i-1]->cfWriteLong(
A[
i-1],d[
i-1]);
return; }
384 d[
i]->cfWriteLong(
A[
i],d[
i]);
392static void nrPower (number a,
int i, number *
result,
const coeffs r)
421 number *C=(number*)
omAlloc0(
i*
sizeof(number));
428 if ((d[
i]->type==
n_R)
431 s=d[
i]->cfRead(
s,&(C[
i]),d[
i]);
432 is_zero=d[
i]->cfIsZero(C[
i],d[
i]);
439 s=d[
i-1]->cfRead(
s,&(C[
i-1]),d[
i-1]);
440 is_zero=d[
i-1]->cfIsZero(C[
i-1],d[
i-1]);
452 if (d[
i]->type==
n_Zp)
458 }
while(
l%(d[
i]->ch)==0);
459 C[
i]=d[
i]->cfInit(
l,d[
i]);
461 else if ((d[
i]->type==
n_R)
465 C[
i]=nMap(C[reader],d[reader],d[
i]);
469 WerrorS(
"reading is not suppiorted for such compinations of coeffs");
474 if (d[
i]==
NULL)
break;
482 C[
i]=d[
i]->cfInit(0,d[
i]);
484 if (d[
i]==
NULL)
break;
489 s=d[0]->cfRead(
s,&(C[0]),d[0]);
493 if (d[
i]==
NULL)
break;
497 C[
i]=nMap(C[0],d[0],d[
i]);
503 WerrorS(
"nnRead: should not happen");
520 bo&=d[
i]->cfDBTest(
A[
i],
f,
l,d[
i]);
522 if (d[
i]==
NULL)
return bo;
536 number *C=(number*)
omAlloc(
i*
sizeof(number));
541 nMap=d[
i]->cfSetMap(aRing,d[
i]);
542 if (nMap==
NULL)
Werror(
"no map for compoment %d",
i);
543 else C[
i]=nMap(from,aRing,d[
i]);
545 if (d[
i]==
NULL)
return (number)C;
556 #define SI_BUF_SIZE 1024
563 char *
s=d[
i]->cfCoeffName(d[
i]);
566 if (d[
i]==
NULL)
break;
581 char *
s=d[
i]->cfCoeffName(d[
i]);
584 if (d[
i]==
NULL)
break;
599 d[
i]->cfDelete(&(
A[
i]),d[
i]);
601 if (d[
i]==
NULL)
break;
636 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)
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
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 nnDBTest(number a, const char *f, const int l, 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.
static const char * nnRead(const char *s, number *a, const coeffs r)
static BOOLEAN nnGreater(number a, number b, const coeffs r)
static nMapFunc nnSetMap(const coeffs, const coeffs)
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 nnInpAdd(number &a, number b, const coeffs r)
static void nnWriteLong(number a, const coeffs r)
static void nnInpMult(number &a, number b, const coeffs r)
static char * nnCoeffString(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