11 #include "factory/factory.h" 39 coeffs1->cfCoeffWrite(coeffs1,b);
44 return coeffs1->cfCoeffString(coeffs1);
48 return coeffs1->cfCoeffName(coeffs1);
52 coeffs1->cfKillChar(coeffs1);
53 coeffs2->cfKillChar(coeffs2);
57 coeffs1->cfSetChar(coeffs1);
58 coeffs2->cfSetChar(coeffs2);
65 gcp cc=(gcp)
omalloc(
sizeof(*cc));
66 cc->a1=coeffs1->cfMult(aa->a1,bb->a1,coeffs1);
67 cc->a2=coeffs2->cfMult(aa->a2,bb->a2,coeffs2);
75 gcp cc=(gcp)
omalloc(
sizeof(*cc));
76 cc->a1=coeffs1->cfSub(aa->a1,bb->a1,coeffs1);
77 cc->a2=coeffs2->cfSub(aa->a2,bb->a2,coeffs2);
85 gcp cc=(gcp)
omalloc(
sizeof(*cc));
86 cc->a1=coeffs1->cfAdd(aa->a1,bb->a1,coeffs1);
87 cc->a2=coeffs2->cfAdd(aa->a2,bb->a2,coeffs2);
95 gcp cc=(gcp)
omalloc(
sizeof(*cc));
96 cc->a1=coeffs1->cfDiv(aa->a1,bb->a1,coeffs1);
97 cc->a2=coeffs2->cfDiv(aa->a2,bb->a2,coeffs2);
105 gcp cc=(gcp)
omalloc(
sizeof(*cc));
106 cc->a1=coeffs1->cfIntMod(aa->a1,bb->a1,coeffs1);
107 cc->a2=coeffs2->cfIntMod(aa->a2,bb->a2,coeffs2);
115 gcp cc=(gcp)
omalloc(
sizeof(*cc));
116 cc->a1=coeffs1->cfExactDiv(aa->a1,bb->a1,coeffs1);
117 cc->a2=coeffs2->cfExactDiv(aa->a2,bb->a2,coeffs2);
123 gcp cc=(gcp)
omalloc(
sizeof(*cc));
124 cc->a1=coeffs1->cfInit(i,coeffs1);
125 cc->a2=coeffs2->cfInit(i,coeffs2);
131 gcp cc=(gcp)
omalloc(
sizeof(*cc));
132 cc->a1=coeffs1->cfInitMPZ(i,coeffs1);
133 cc->a2=coeffs2->cfInitMPZ(i,coeffs2);
140 int s1=coeffs1->cfSize(aa->a1,coeffs1);
141 int s2=coeffs2->cfSize(aa->a2,coeffs2);
144 printf(
"gSize: %d, %d\n",s1,s2);
151 long s1=coeffs1->cfInt(aa->a1,coeffs1);
152 long s2=coeffs2->cfInt(aa->a2,coeffs2);
155 printf(
"gInt: %ld, %ld\n",s1,s2);
161 coeffs1->cfMPZ(result,n,coeffs1);
163 coeffs2->cfMPZ(r2,n,coeffs2);
164 if(mpz_cmp(result,r2)!=0)
173 aa->
a1=coeffs1->cfInpNeg(aa->a1,coeffs1);
174 aa->a2=coeffs2->cfInpNeg(aa->a2,coeffs2);
180 gcp cc=(gcp)
omalloc(
sizeof(*cc));
181 cc->a1=coeffs1->cfInvers(aa->a1,coeffs1);
182 cc->a2=coeffs2->cfInvers(aa->a2,coeffs2);
188 gcp cc=(gcp)
omalloc(
sizeof(*cc));
189 cc->a1=coeffs1->cfCopy(aa->a1,coeffs1);
190 cc->a2=coeffs2->cfCopy(aa->a2,coeffs2);
196 gcp cc=(gcp)
omalloc(
sizeof(*cc));
197 cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
198 cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
204 gcp cc=(gcp)
omalloc(
sizeof(*cc));
205 cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
206 cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
212 coeffs1->cfWriteLong(aa->a1,coeffs1);
217 coeffs1->cfWriteShort(aa->a1,coeffs1);
221 gcp cc=(gcp)
omalloc(
sizeof(*cc));
222 const char* ss=coeffs1->cfRead(s,&(cc->a1),coeffs1);
223 number tmp=coeffs2->cfInit(1,coeffs2);
224 mpz_ptr tt=(mpz_ptr)tmp;
225 coeffs1->cfMPZ(tt,cc->a1,coeffs1);
233 coeffs1->cfNormalize(aa->a1,coeffs1);
234 coeffs2->cfNormalize(aa->a2,coeffs2);
240 BOOLEAN b1=coeffs1->cfGreater(aa->a1,bb->a1,coeffs1);
241 BOOLEAN b2=coeffs2->cfGreater(aa->a2,bb->a2,coeffs2);
244 printf(
"gGreater\n");
252 BOOLEAN b1=coeffs1->cfEqual(aa->a1,bb->a1,coeffs1);
253 BOOLEAN b2=coeffs2->cfEqual(aa->a2,bb->a2,coeffs2);
264 BOOLEAN b1=coeffs1->cfIsZero(aa->a1,coeffs1);
265 BOOLEAN b2=coeffs2->cfIsZero(aa->a2,coeffs2);
275 BOOLEAN b1=coeffs1->cfIsOne(aa->a1,coeffs1);
276 BOOLEAN b2=coeffs2->cfIsOne(aa->a2,coeffs2);
286 BOOLEAN b1=coeffs1->cfIsMOne(aa->a1,coeffs1);
287 BOOLEAN b2=coeffs2->cfIsMOne(aa->a2,coeffs2);
297 BOOLEAN b1=coeffs1->cfGreaterZero(aa->a1,coeffs1);
298 BOOLEAN b2=coeffs2->cfGreaterZero(aa->a2,coeffs2);
301 printf(
"gGreaterZero\n");
308 gcp cc=(gcp)
omalloc(
sizeof(*cc));
309 coeffs1->cfPower(aa->a1,i,&cc->a1,coeffs1);
310 coeffs2->cfPower(aa->a2,i,&cc->a2,coeffs2);
317 gcp cc=(gcp)
omalloc(
sizeof(*cc));
318 cc->a1=coeffs1->cfGcd(aa->a1,bb->a1,coeffs1);
319 cc->a2=coeffs2->cfGcd(aa->a2,bb->a2,coeffs2);
326 gcp cc=(gcp)
omalloc(
sizeof(*cc));
327 cc->a1=coeffs1->cfSubringGcd(aa->a1,bb->a1,coeffs1);
328 cc->a2=coeffs2->cfSubringGcd(aa->a2,bb->a2,coeffs2);
334 gcp cc=(gcp)
omalloc(
sizeof(*cc));
335 cc->a1=coeffs1->cfGetDenom(aa->a1,coeffs1);
336 cc->a2=coeffs2->cfGetDenom(aa->a2,coeffs2);
342 gcp cc=(gcp)
omalloc(
sizeof(*cc));
343 cc->a1=coeffs1->cfGetNumerator(aa->a1,coeffs1);
344 cc->a2=coeffs2->cfGetNumerator(aa->a2,coeffs2);
349 printf(
"gQuotRem\n");
356 gcp cc=(gcp)
omalloc(
sizeof(*cc));
357 cc->a1=coeffs1->cfLcm(aa->a1,bb->a1,coeffs1);
358 cc->a2=coeffs2->cfLcm(aa->a2,bb->a2,coeffs2);
365 gcp cc=(gcp)
omalloc(
sizeof(*cc));
366 cc->a1=coeffs1->cfNormalizeHelper(aa->a1,bb->a1,coeffs1);
367 cc->a2=coeffs2->cfNormalizeHelper(aa->a2,bb->a2,coeffs2);
375 coeffs1->cfDelete(&aa->a1,coeffs1);
376 coeffs2->cfDelete(&aa->a2,coeffs2);
388 printf(
"gWriteFd\n");
398 gcp cc=(gcp)
omalloc(
sizeof(*cc));
399 cc->a1=coeffs1->cfFarey(aa->a1,n,coeffs1);
400 cc->a2=coeffs2->cfFarey(aa->a2,n,coeffs2);
405 printf(
"gChineseREmainder\n");
417 BOOLEAN b1=coeffs1->cfDivBy(aa->a1,bb->a1,coeffs1);
418 BOOLEAN b2=coeffs2->cfDivBy(aa->a2,bb->a2,coeffs2);
421 printf(
"gDivBy:%d,%d\n",b1,b2);
429 gcp cc=(gcp)
omalloc(
sizeof(*cc));
430 gcp ss=(gcp)
omalloc(
sizeof(*ss));
431 gcp tt=(gcp)
omalloc(
sizeof(*ss));
432 cc->a1=coeffs1->cfExtGcd(aa->a1,bb->a1,&ss->a1,&tt->a1,coeffs1);
433 cc->a2=coeffs2->cfExtGcd(aa->a2,bb->a2,&ss->a2,&tt->a2,coeffs2);
439 gcp cc=(gcp)
omalloc(
sizeof(*cc));
440 cc->a1=coeffs1->cfGetUnit(aa->a1,coeffs1);
441 cc->a2=coeffs2->cfGetUnit(aa->a2,coeffs2);
447 BOOLEAN b1=coeffs1->cfIsUnit(aa->a1,coeffs1);
448 BOOLEAN b2=coeffs2->cfIsUnit(aa->a2,coeffs2);
451 printf(
"gIsUnit:%d,%d\n",b1,b2);
459 int i1=coeffs1->cfDivComp(aa->a1,bb->a1,coeffs1);
460 int i2=coeffs2->cfDivComp(aa->a2,bb->a2,coeffs2);
463 printf(
"gDivComp:%d,%d\n",i1,i2);
470 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