10 #include "factory/factory.h" 38 coeffs1->cfCoeffWrite(coeffs1,b);
43 return coeffs1->cfCoeffString(coeffs1);
47 return coeffs1->cfCoeffName(coeffs1);
51 coeffs1->cfKillChar(coeffs1);
52 coeffs2->cfKillChar(coeffs2);
56 coeffs1->cfSetChar(coeffs1);
57 coeffs2->cfSetChar(coeffs2);
64 gcp cc=(gcp)
omalloc(
sizeof(*cc));
65 cc->a1=coeffs1->cfMult(aa->a1,bb->a1,coeffs1);
66 cc->a2=coeffs2->cfMult(aa->a2,bb->a2,coeffs2);
74 gcp cc=(gcp)
omalloc(
sizeof(*cc));
75 cc->a1=coeffs1->cfSub(aa->a1,bb->a1,coeffs1);
76 cc->a2=coeffs2->cfSub(aa->a2,bb->a2,coeffs2);
84 gcp cc=(gcp)
omalloc(
sizeof(*cc));
85 cc->a1=coeffs1->cfAdd(aa->a1,bb->a1,coeffs1);
86 cc->a2=coeffs2->cfAdd(aa->a2,bb->a2,coeffs2);
94 gcp cc=(gcp)
omalloc(
sizeof(*cc));
95 cc->a1=coeffs1->cfDiv(aa->a1,bb->a1,coeffs1);
96 cc->a2=coeffs2->cfDiv(aa->a2,bb->a2,coeffs2);
104 gcp cc=(gcp)
omalloc(
sizeof(*cc));
105 cc->a1=coeffs1->cfIntMod(aa->a1,bb->a1,coeffs1);
106 cc->a2=coeffs2->cfIntMod(aa->a2,bb->a2,coeffs2);
114 gcp cc=(gcp)
omalloc(
sizeof(*cc));
115 cc->a1=coeffs1->cfExactDiv(aa->a1,bb->a1,coeffs1);
116 cc->a2=coeffs2->cfExactDiv(aa->a2,bb->a2,coeffs2);
122 gcp cc=(gcp)
omalloc(
sizeof(*cc));
123 cc->a1=coeffs1->cfInit(i,coeffs1);
124 cc->a2=coeffs2->cfInit(i,coeffs2);
130 gcp cc=(gcp)
omalloc(
sizeof(*cc));
131 cc->a1=coeffs1->cfInitMPZ(i,coeffs1);
132 cc->a2=coeffs2->cfInitMPZ(i,coeffs2);
139 int s1=coeffs1->cfSize(aa->a1,coeffs1);
140 int s2=coeffs2->cfSize(aa->a2,coeffs2);
143 printf(
"gSize: %d, %d\n",s1,s2);
150 long s1=coeffs1->cfInt(aa->a1,coeffs1);
151 long s2=coeffs2->cfInt(aa->a2,coeffs2);
154 printf(
"gInt: %ld, %ld\n",s1,s2);
160 coeffs1->cfMPZ(result,n,coeffs1);
162 coeffs2->cfMPZ(r2,n,coeffs2);
163 if(mpz_cmp(result,r2)!=0)
172 aa->
a1=coeffs1->cfInpNeg(aa->a1,coeffs1);
173 aa->a2=coeffs2->cfInpNeg(aa->a2,coeffs2);
179 gcp cc=(gcp)
omalloc(
sizeof(*cc));
180 cc->a1=coeffs1->cfInvers(aa->a1,coeffs1);
181 cc->a2=coeffs2->cfInvers(aa->a2,coeffs2);
187 gcp cc=(gcp)
omalloc(
sizeof(*cc));
188 cc->a1=coeffs1->cfCopy(aa->a1,coeffs1);
189 cc->a2=coeffs2->cfCopy(aa->a2,coeffs2);
195 gcp cc=(gcp)
omalloc(
sizeof(*cc));
196 cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
197 cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
203 gcp cc=(gcp)
omalloc(
sizeof(*cc));
204 cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
205 cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
211 coeffs1->cfWriteLong(aa->a1,coeffs1);
216 coeffs1->cfWriteShort(aa->a1,coeffs1);
220 gcp cc=(gcp)
omalloc(
sizeof(*cc));
221 const char* ss=coeffs1->cfRead(s,&(cc->a1),coeffs1);
222 number tmp=coeffs2->cfInit(1,coeffs2);
223 mpz_ptr tt=(mpz_ptr)tmp;
224 coeffs1->cfMPZ(tt,cc->a1,coeffs1);
232 coeffs1->cfNormalize(aa->a1,coeffs1);
233 coeffs2->cfNormalize(aa->a2,coeffs2);
239 BOOLEAN b1=coeffs1->cfGreater(aa->a1,bb->a1,coeffs1);
240 BOOLEAN b2=coeffs2->cfGreater(aa->a2,bb->a2,coeffs2);
243 printf(
"gGreater\n");
251 BOOLEAN b1=coeffs1->cfEqual(aa->a1,bb->a1,coeffs1);
252 BOOLEAN b2=coeffs2->cfEqual(aa->a2,bb->a2,coeffs2);
263 BOOLEAN b1=coeffs1->cfIsZero(aa->a1,coeffs1);
264 BOOLEAN b2=coeffs2->cfIsZero(aa->a2,coeffs2);
274 BOOLEAN b1=coeffs1->cfIsOne(aa->a1,coeffs1);
275 BOOLEAN b2=coeffs2->cfIsOne(aa->a2,coeffs2);
285 BOOLEAN b1=coeffs1->cfIsMOne(aa->a1,coeffs1);
286 BOOLEAN b2=coeffs2->cfIsMOne(aa->a2,coeffs2);
296 BOOLEAN b1=coeffs1->cfGreaterZero(aa->a1,coeffs1);
297 BOOLEAN b2=coeffs2->cfGreaterZero(aa->a2,coeffs2);
300 printf(
"gGreaterZero\n");
307 gcp cc=(gcp)
omalloc(
sizeof(*cc));
308 coeffs1->cfPower(aa->a1,i,&cc->a1,coeffs1);
309 coeffs2->cfPower(aa->a2,i,&cc->a2,coeffs2);
316 gcp cc=(gcp)
omalloc(
sizeof(*cc));
317 cc->a1=coeffs1->cfGcd(aa->a1,bb->a1,coeffs1);
318 cc->a2=coeffs2->cfGcd(aa->a2,bb->a2,coeffs2);
325 gcp cc=(gcp)
omalloc(
sizeof(*cc));
326 cc->a1=coeffs1->cfSubringGcd(aa->a1,bb->a1,coeffs1);
327 cc->a2=coeffs2->cfSubringGcd(aa->a2,bb->a2,coeffs2);
333 gcp cc=(gcp)
omalloc(
sizeof(*cc));
334 cc->a1=coeffs1->cfGetDenom(aa->a1,coeffs1);
335 cc->a2=coeffs2->cfGetDenom(aa->a2,coeffs2);
341 gcp cc=(gcp)
omalloc(
sizeof(*cc));
342 cc->a1=coeffs1->cfGetNumerator(aa->a1,coeffs1);
343 cc->a2=coeffs2->cfGetNumerator(aa->a2,coeffs2);
348 printf(
"gQuotRem\n");
355 gcp cc=(gcp)
omalloc(
sizeof(*cc));
356 cc->a1=coeffs1->cfLcm(aa->a1,bb->a1,coeffs1);
357 cc->a2=coeffs2->cfLcm(aa->a2,bb->a2,coeffs2);
364 gcp cc=(gcp)
omalloc(
sizeof(*cc));
365 cc->a1=coeffs1->cfNormalizeHelper(aa->a1,bb->a1,coeffs1);
366 cc->a2=coeffs2->cfNormalizeHelper(aa->a2,bb->a2,coeffs2);
374 coeffs1->cfDelete(&aa->a1,coeffs1);
375 coeffs2->cfDelete(&aa->a2,coeffs2);
387 printf(
"gWriteFd\n");
397 gcp cc=(gcp)
omalloc(
sizeof(*cc));
398 cc->a1=coeffs1->cfFarey(aa->a1,n,coeffs1);
399 cc->a2=coeffs2->cfFarey(aa->a2,n,coeffs2);
404 printf(
"gChineseREmainder\n");
416 BOOLEAN b1=coeffs1->cfDivBy(aa->a1,bb->a1,coeffs1);
417 BOOLEAN b2=coeffs2->cfDivBy(aa->a2,bb->a2,coeffs2);
420 printf(
"gDivBy:%d,%d\n",b1,b2);
428 gcp cc=(gcp)
omalloc(
sizeof(*cc));
429 gcp ss=(gcp)
omalloc(
sizeof(*ss));
430 gcp tt=(gcp)
omalloc(
sizeof(*ss));
431 cc->a1=coeffs1->cfExtGcd(aa->a1,bb->a1,&ss->a1,&tt->a1,coeffs1);
432 cc->a2=coeffs2->cfExtGcd(aa->a2,bb->a2,&ss->a2,&tt->a2,coeffs2);
438 gcp cc=(gcp)
omalloc(
sizeof(*cc));
439 cc->a1=coeffs1->cfGetUnit(aa->a1,coeffs1);
440 cc->a2=coeffs2->cfGetUnit(aa->a2,coeffs2);
446 BOOLEAN b1=coeffs1->cfIsUnit(aa->a1,coeffs1);
447 BOOLEAN b2=coeffs2->cfIsUnit(aa->a2,coeffs2);
450 printf(
"gIsUnit:%d,%d\n",b1,b2);
458 int i1=coeffs1->cfDivComp(aa->a1,bb->a1,coeffs1);
459 int i2=coeffs2->cfDivComp(aa->a2,bb->a2,coeffs2);
462 printf(
"gDivComp:%d,%d\n",i1,i2);
469 printf(
"NULL in %s:%d\n",f,l);
const CanonicalForm int s
static void gCoeffWrite(const coeffs r, BOOLEAN b)
char * gCoeffName(const coeffs r)
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
char * gCoeffString(const coeffs r)
static void gDelete(number *a, const coeffs r)
static BOOLEAN gGreaterZero(number a, const coeffs r)
static int gSize(number a, const coeffs)
static number gInitMPZ(mpz_t i, const coeffs cf)
static number gAdd(number a, number b, const coeffs cf)
static number gGetUnit(number n, const coeffs r)
static number gDiv(number a, number b, const coeffs cf)
static void gPower(number a, int i, number *result, const coeffs r)
static BOOLEAN gIsZero(number a, const coeffs r)
static BOOLEAN gIsOne(number a, const coeffs r)
static BOOLEAN gGreater(number a, number b, const coeffs r)
static void gNormalize(number &a, const coeffs r)
static number gReadFd(s_buff f, const coeffs r)
static number gNormalizeHelper(number a, number b, const coeffs r)
static number gIntMod(number a, number b, const coeffs cf)
static number gInvers(number a, const coeffs r)
static number gExtGcd(number a, number b, number *s, number *t, const coeffs)
static BOOLEAN gIsMOne(number a, const coeffs r)
static void gWriteLong(number a, const coeffs r)
static number gExactDiv(number a, number b, const coeffs cf)
static number gImPart(number a, const coeffs r)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static number gRandom(siRandProc p, number p1, number p2, const coeffs cf)
static void gWriteFd(number a, FILE *f, const coeffs r)
static void gWriteShort(number a, const coeffs r)
static number gInpNeg(number a, const coeffs r)
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static number gRePart(number a, const coeffs r)
static BOOLEAN gDBTest(number a, const char *f, const int l, const coeffs r)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
only used if HAVE_RINGS is defined
static int gDivComp(number a, number b, const coeffs r)
static number gFarey(number p, number n, const coeffs)
static number gQuotRem(number a, number b, number *rem, const coeffs r)
static number gGetNumerator(number &a, const coeffs)
static number gMult(number a, number b, const coeffs cf)
BOOLEAN gInitChar(coeffs r, void *p)
static number gSubringGcd(number a, number b, const coeffs)
static BOOLEAN gEqual(number a, number b, const coeffs r)
static nMapFunc gSetMap(const coeffs src, const coeffs dst)
static number gChineseRemainder(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
static BOOLEAN gIsUnit(number a, const coeffs)
static number gInit(long i, const coeffs cf)
static number gSub(number a, number b, const coeffs cf)
static number gCopy(number a, const coeffs r)
static const char * gRead(const char *s, number *a, const coeffs r)
static long gInt(number &a, const coeffs)
static number gLcm(number a, number b, const coeffs r)
static number gGetDenom(number &a, const coeffs)
static void gMPZ(mpz_t result, number &n, const coeffs r)
static number gGcd(number a, number b, const coeffs)
static BOOLEAN gDivBy(number a, number b, const coeffs)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL