My Project
Data Structures | Functions | Variables
generics.cc File Reference
#include "misc/auxiliary.h"
#include "factory/factory.h"
#include "misc/mylimits.h"
#include "reporter/reporter.h"
#include "coeffs/coeffs.h"
#include "coeffs/longrat.h"
#include "coeffs/numbers.h"
#include "coeffs/si_gmp.h"
#include "coeffs/generics.h"
#include "coeffs/rintegers.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  gcp
 

Functions

static void gCoeffWrite (const coeffs r, BOOLEAN b)
 
static char * gCoeffName (const coeffs r)
 
static void gKillChar (coeffs r)
 
static void gSetChar (coeffs r)
 
static number gMult (number a, number b, const coeffs cf)
 
static number gSub (number a, number b, const coeffs cf)
 
static number gAdd (number a, number b, const coeffs cf)
 
static number gDiv (number a, number b, const coeffs cf)
 
static number gIntMod (number a, number b, const coeffs cf)
 
static number gExactDiv (number a, number b, const coeffs cf)
 
static number gInit (long i, const coeffs cf)
 
static number gInitMPZ (mpz_t i, const coeffs cf)
 
static int gSize (number a, const coeffs)
 
static long gInt (number &a, const coeffs)
 
static void gMPZ (mpz_t result, number &n, const coeffs r)
 
static number gInpNeg (number a, const coeffs r)
 
static number gInvers (number a, const coeffs r)
 
static number gCopy (number a, const coeffs r)
 
static number gRePart (number a, const coeffs r)
 
static number gImPart (number a, const coeffs r)
 
static void gWriteLong (number a, const coeffs r)
 
static void gWriteShort (number a, const coeffs r)
 
static const char * gRead (const char *s, number *a, const coeffs r)
 
static void gNormalize (number &a, const coeffs r)
 
static BOOLEAN gGreater (number a, number b, const coeffs r)
 
static BOOLEAN gEqual (number a, number b, const coeffs r)
 
static BOOLEAN gIsZero (number a, const coeffs r)
 
static BOOLEAN gIsOne (number a, const coeffs r)
 
static BOOLEAN gIsMOne (number a, const coeffs r)
 
static BOOLEAN gGreaterZero (number a, const coeffs r)
 
static void gPower (number a, int i, number *result, const coeffs r)
 
static number gGcd (number a, number b, const coeffs)
 
static number gSubringGcd (number a, number b, const coeffs)
 
static number gGetDenom (number &a, const coeffs)
 
static number gGetNumerator (number &a, const coeffs)
 
static number gQuotRem (number a, number b, number *rem, const coeffs r)
 
static number gLcm (number a, number b, const coeffs r)
 
static number gNormalizeHelper (number a, number b, const coeffs r)
 
static void gDelete (number *a, const coeffs r)
 
static nMapFunc gSetMap (const coeffs src, const coeffs dst)
 
static void gWriteFd (number a, FILE *f, const coeffs r)
 
static number gReadFd (s_buff f, const coeffs r)
 
static number gFarey (number p, number n, const coeffs)
 
static number gChineseRemainder (number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
 
static number gRandom (siRandProc p, number p1, number p2, const coeffs cf)
 
static BOOLEAN gDivBy (number a, number b, const coeffs)
 
static number gExtGcd (number a, number b, number *s, number *t, const coeffs)
 
static number gGetUnit (number n, const coeffs r)
 
static BOOLEAN gIsUnit (number a, const coeffs)
 
static int gDivComp (number a, number b, const coeffs r)
 
static BOOLEAN gDBTest (number a, const char *f, const int l, const coeffs r)
 
BOOLEAN gInitChar (coeffs r, void *p)
 

Variables

VAR coeffs coeffs1
 
VAR coeffs coeffs2
 

Data Structure Documentation

◆ generic_pair

struct generic_pair

Definition at line 27 of file generics.cc.

Data Fields
number a1
number a2

Function Documentation

◆ gAdd()

static number gAdd ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 76 of file generics.cc.

77 {
78  gcp aa=(gcp)a;
79  gcp bb=(gcp)b;
80  gcp cc=(gcp)omalloc(sizeof(*cc));
81  cc->a1=coeffs1->cfAdd(aa->a1,bb->a1,coeffs1);
82  cc->a2=coeffs2->cfAdd(aa->a2,bb->a2,coeffs2);
83  n_Test((number)cc,cf);
84  return (number)cc;
85 }
CanonicalForm cf
Definition: cfModGcd.cc:4083
CanonicalForm b
Definition: cfModGcd.cc:4103
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:709
VAR coeffs coeffs1
Definition: generics.cc:33
VAR coeffs coeffs2
Definition: generics.cc:33
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gChineseRemainder()

static number gChineseRemainder ( number *  x,
number *  q,
int  rl,
BOOLEAN  sym,
CFArray inv_cache,
const  coeffs 
)
static

Definition at line 398 of file generics.cc.

399 {
400  printf("gChineseREmainder\n");
401  return NULL;
402 }
#define NULL
Definition: omList.c:12

◆ gCoeffName()

static char* gCoeffName ( const coeffs  r)
static

Definition at line 41 of file generics.cc.

42 {
43  return coeffs1->cfCoeffName(coeffs1);
44 }

◆ gCoeffWrite()

static void gCoeffWrite ( const coeffs  r,
BOOLEAN  b 
)
static

Definition at line 35 of file generics.cc.

36 {
37  printf("debug: ");
38  coeffs1->cfCoeffWrite(coeffs1,b);
39 }

◆ gCopy()

static number gCopy ( number  a,
const coeffs  r 
)
static

Definition at line 180 of file generics.cc.

181 {
182  gcp aa=(gcp)a;
183  gcp cc=(gcp)omalloc(sizeof(*cc));
184  cc->a1=coeffs1->cfCopy(aa->a1,coeffs1);
185  cc->a2=coeffs2->cfCopy(aa->a2,coeffs2);
186  return (number)cc;
187 }

◆ gDBTest()

static BOOLEAN gDBTest ( number  a,
const char *  f,
const int  l,
const coeffs  r 
)
static

Definition at line 462 of file generics.cc.

463 {
464  if (a==NULL)
465  printf("NULL in %s:%d\n",f,l);
466  return TRUE;
467 }
#define TRUE
Definition: auxiliary.h:100
int l
Definition: cfEzgcd.cc:100
FILE * f
Definition: checklibs.c:9

◆ gDelete()

static void gDelete ( number *  a,
const coeffs  r 
)
static

Definition at line 365 of file generics.cc.

366 {
367  if (*a!=NULL)
368  {
369  gcp aa=(gcp)*a;
370  coeffs1->cfDelete(&aa->a1,coeffs1);
371  coeffs2->cfDelete(&aa->a2,coeffs2);
372  omFree(aa);
373  *a=NULL;
374  }
375 }
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ gDiv()

static number gDiv ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 86 of file generics.cc.

87 {
88  gcp aa=(gcp)a;
89  gcp bb=(gcp)b;
90  gcp cc=(gcp)omalloc(sizeof(*cc));
91  cc->a1=coeffs1->cfDiv(aa->a1,bb->a1,coeffs1);
92  cc->a2=coeffs2->cfDiv(aa->a2,bb->a2,coeffs2);
93  n_Test((number)cc,cf);
94  return (number)cc;
95 }

◆ gDivBy()

static BOOLEAN gDivBy ( number  a,
number  b,
const  coeffs 
)
static

Definition at line 408 of file generics.cc.

409 {
410  gcp aa=(gcp)a;
411  gcp bb=(gcp)b;
412  BOOLEAN b1=coeffs1->cfDivBy(aa->a1,bb->a1,coeffs1);
413  BOOLEAN b2=coeffs2->cfDivBy(aa->a2,bb->a2,coeffs2);
414  if (b1!=b2)
415  {
416  printf("gDivBy:%d,%d\n",b1,b2);
417  }
418  return b1;
419 }
int BOOLEAN
Definition: auxiliary.h:87

◆ gDivComp()

static int gDivComp ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 450 of file generics.cc.

451 {
452  gcp aa=(gcp)a;
453  gcp bb=(gcp)b;
454  int i1=coeffs1->cfDivComp(aa->a1,bb->a1,coeffs1);
455  int i2=coeffs2->cfDivComp(aa->a2,bb->a2,coeffs2);
456  if (i1!=i2)
457  {
458  printf("gDivComp:%d,%d\n",i1,i2);
459  }
460  return i1;
461 }

◆ gEqual()

static BOOLEAN gEqual ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 243 of file generics.cc.

244 {
245  gcp aa=(gcp)a;
246  gcp bb=(gcp)b;
247  BOOLEAN b1=coeffs1->cfEqual(aa->a1,bb->a1,coeffs1);
248  BOOLEAN b2=coeffs2->cfEqual(aa->a2,bb->a2,coeffs2);
249  if (b1!=b2)
250  {
251  printf("gEqual\n");
252  }
253  return b1;
254 }

◆ gExactDiv()

static number gExactDiv ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 106 of file generics.cc.

107 {
108  gcp aa=(gcp)a;
109  gcp bb=(gcp)b;
110  gcp cc=(gcp)omalloc(sizeof(*cc));
111  cc->a1=coeffs1->cfExactDiv(aa->a1,bb->a1,coeffs1);
112  cc->a2=coeffs2->cfExactDiv(aa->a2,bb->a2,coeffs2);
113  n_Test((number)cc,cf);
114  return (number)cc;
115 }

◆ gExtGcd()

static number gExtGcd ( number  a,
number  b,
number *  s,
number *  t,
const  coeffs 
)
static

Definition at line 420 of file generics.cc.

421 {
422  gcp aa=(gcp)a;
423  gcp bb=(gcp)b;
424  gcp cc=(gcp)omalloc(sizeof(*cc));
425  gcp ss=(gcp)omalloc(sizeof(*ss));
426  gcp tt=(gcp)omalloc(sizeof(*ss));
427  cc->a1=coeffs1->cfExtGcd(aa->a1,bb->a1,&ss->a1,&tt->a1,coeffs1);
428  cc->a2=coeffs2->cfExtGcd(aa->a2,bb->a2,&ss->a2,&tt->a2,coeffs2);
429  return (number)cc;
430 }

◆ gFarey()

static number gFarey ( number  p,
number  n,
const  coeffs 
)
static

Definition at line 390 of file generics.cc.

391 {
392  gcp aa=(gcp)p;
393  gcp cc=(gcp)omalloc(sizeof(*cc));
394  cc->a1=coeffs1->cfFarey(aa->a1,n,coeffs1);
395  cc->a2=coeffs2->cfFarey(aa->a2,n,coeffs2);
396  return (number)cc;
397 }
int p
Definition: cfModGcd.cc:4078

◆ gGcd()

static number gGcd ( number  a,
number  b,
const  coeffs 
)
static

Definition at line 308 of file generics.cc.

309 {
310  gcp aa=(gcp)a;
311  gcp bb=(gcp)b;
312  gcp cc=(gcp)omalloc(sizeof(*cc));
313  cc->a1=coeffs1->cfGcd(aa->a1,bb->a1,coeffs1);
314  cc->a2=coeffs2->cfGcd(aa->a2,bb->a2,coeffs2);
315  return (number)cc;
316 }

◆ gGetDenom()

static number gGetDenom ( number &  a,
const  coeffs 
)
static

Definition at line 326 of file generics.cc.

327 {
328  gcp aa=(gcp)a;
329  gcp cc=(gcp)omalloc(sizeof(*cc));
330  cc->a1=coeffs1->cfGetDenom(aa->a1,coeffs1);
331  cc->a2=coeffs2->cfGetDenom(aa->a2,coeffs2);
332  return (number)cc;
333 }

◆ gGetNumerator()

static number gGetNumerator ( number &  a,
const  coeffs 
)
static

Definition at line 334 of file generics.cc.

335 {
336  gcp aa=(gcp)a;
337  gcp cc=(gcp)omalloc(sizeof(*cc));
338  cc->a1=coeffs1->cfGetNumerator(aa->a1,coeffs1);
339  cc->a2=coeffs2->cfGetNumerator(aa->a2,coeffs2);
340  return (number)cc;
341 }

◆ gGetUnit()

static number gGetUnit ( number  n,
const coeffs  r 
)
static

Definition at line 431 of file generics.cc.

432 {
433  gcp aa=(gcp)n;
434  gcp cc=(gcp)omalloc(sizeof(*cc));
435  cc->a1=coeffs1->cfGetUnit(aa->a1,coeffs1);
436  cc->a2=coeffs2->cfGetUnit(aa->a2,coeffs2);
437  return (number)cc;
438 }

◆ gGreater()

static BOOLEAN gGreater ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 231 of file generics.cc.

232 {
233  gcp aa=(gcp)a;
234  gcp bb=(gcp)b;
235  BOOLEAN b1=coeffs1->cfGreater(aa->a1,bb->a1,coeffs1);
236  BOOLEAN b2=coeffs2->cfGreater(aa->a2,bb->a2,coeffs2);
237  if (b1!=b2)
238  {
239  printf("gGreater\n");
240  }
241  return b1;
242 }

◆ gGreaterZero()

static BOOLEAN gGreaterZero ( number  a,
const coeffs  r 
)
static

Definition at line 289 of file generics.cc.

290 {
291  gcp aa=(gcp)a;
292  BOOLEAN b1=coeffs1->cfGreaterZero(aa->a1,coeffs1);
293  BOOLEAN b2=coeffs2->cfGreaterZero(aa->a2,coeffs2);
294  if (b1!=b2)
295  {
296  printf("gGreaterZero\n");
297  }
298  return b1;
299 }

◆ gImPart()

static number gImPart ( number  a,
const coeffs  r 
)
static

Definition at line 196 of file generics.cc.

197 {
198  gcp aa=(gcp)a;
199  gcp cc=(gcp)omalloc(sizeof(*cc));
200  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
201  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
202  return (number)cc;
203 }

◆ gInit()

static number gInit ( long  i,
const coeffs  cf 
)
static

Definition at line 116 of file generics.cc.

117 {
118  gcp cc=(gcp)omalloc(sizeof(*cc));
119  cc->a1=coeffs1->cfInit(i,coeffs1);
120  cc->a2=coeffs2->cfInit(i,coeffs2);
121  n_Test((number)cc,cf);
122  return (number)cc;
123 }
int i
Definition: cfEzgcd.cc:132

◆ gInitChar()

BOOLEAN gInitChar ( coeffs  r,
void *  p 
)

Definition at line 468 of file generics.cc.

469 {
470  coeffs1=nInitChar(n_Z_1,(void*)1);
471  coeffs2=nInitChar(n_Z_2,(void*)1);
472  r->is_field=FALSE;
473  r->is_domain=TRUE;
474  r->rep=n_rep_unknown;
475  r->ch = 0;
476  r->cfKillChar=gKillChar;
477  //r->nCoeffIsEqual=gCoeffsEqual;
478  r->cfCoeffName=gCoeffName;
479  r->cfCoeffWrite=gCoeffWrite;
480 
481  r->cfMult = gMult;
482  r->cfSub = gSub;
483  r->cfAdd = gAdd;
484  r->cfDiv = gDiv;
485  r->cfInit = gInit;
486  r->cfSize = gSize;
487  r->cfInt = gInt;
488  #ifdef HAVE_RINGS
489  r->cfDivComp = gDivComp;
490  r->cfIsUnit = gIsUnit;
491  r->cfGetUnit = gGetUnit;
492  r->cfExtGcd = gExtGcd;
493  r->cfDivBy = gDivBy;
494  #endif
495  r->cfInpNeg = gInpNeg;
496  r->cfInvers= gInvers;
497  r->cfCopy = gCopy;
498  r->cfRePart = gCopy;
499  //r->cfImPart = ndReturn0;
500  r->cfWriteLong = gWriteLong;
501  r->cfWriteShort = gWriteShort;
502  r->cfRead = gRead;
503  r->cfNormalize=gNormalize;
504  r->cfGreater = gGreater;
505  r->cfEqual = gEqual;
506  r->cfIsZero = gIsZero;
507  r->cfIsOne = gIsOne;
508  r->cfIsMOne = gIsMOne;
509  r->cfGreaterZero = gGreaterZero;
510  r->cfPower = gPower;
511  r->cfGetDenom = gGetDenom;
512  r->cfGetNumerator = gGetNumerator;
513  r->cfGcd = gGcd;
514  r->cfLcm = gGcd;
515  r->cfDelete= gDelete;
516  r->cfSetMap = gSetMap;
517  //r->cfInpMult=ndInpMult;
518  r->cfRandom=gRandom;
519  r->cfWriteFd=gWriteFd;
520  r->cfReadFd=gReadFd;
521  r->type=n_Z;
522  #ifdef LDEBUG
523  r->cfDBTest=gDBTest;
524  #endif
525  return FALSE;
526 }
#define FALSE
Definition: auxiliary.h:96
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:43
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:413
@ n_rep_unknown
Definition: coeffs.h:109
static int gDivComp(number a, number b, const coeffs r)
Definition: generics.cc:450
static void gWriteFd(number a, FILE *f, const coeffs r)
Definition: generics.cc:381
static number gCopy(number a, const coeffs r)
Definition: generics.cc:180
static number gGcd(number a, number b, const coeffs)
Definition: generics.cc:308
static number gMult(number a, number b, const coeffs cf)
Definition: generics.cc:56
static BOOLEAN gIsMOne(number a, const coeffs r)
Definition: generics.cc:278
static void gWriteShort(number a, const coeffs r)
Definition: generics.cc:209
static BOOLEAN gDivBy(number a, number b, const coeffs)
Definition: generics.cc:408
static void gNormalize(number &a, const coeffs r)
Definition: generics.cc:225
static long gInt(number &a, const coeffs)
Definition: generics.cc:143
static number gAdd(number a, number b, const coeffs cf)
Definition: generics.cc:76
static BOOLEAN gIsUnit(number a, const coeffs)
Definition: generics.cc:439
static void gPower(number a, int i, number *result, const coeffs r)
Definition: generics.cc:300
static number gInpNeg(number a, const coeffs r)
Definition: generics.cc:165
static BOOLEAN gGreaterZero(number a, const coeffs r)
Definition: generics.cc:289
static void gKillChar(coeffs r)
Definition: generics.cc:45
static number gGetUnit(number n, const coeffs r)
Definition: generics.cc:431
static number gInit(long i, const coeffs cf)
Definition: generics.cc:116
static void gCoeffWrite(const coeffs r, BOOLEAN b)
Definition: generics.cc:35
static number gGetDenom(number &a, const coeffs)
Definition: generics.cc:326
static BOOLEAN gEqual(number a, number b, const coeffs r)
Definition: generics.cc:243
static char * gCoeffName(const coeffs r)
Definition: generics.cc:41
static number gGetNumerator(number &a, const coeffs)
Definition: generics.cc:334
static number gRandom(siRandProc p, number p1, number p2, const coeffs cf)
Definition: generics.cc:403
static BOOLEAN gGreater(number a, number b, const coeffs r)
Definition: generics.cc:231
static number gExtGcd(number a, number b, number *s, number *t, const coeffs)
Definition: generics.cc:420
static void gWriteLong(number a, const coeffs r)
Definition: generics.cc:204
static BOOLEAN gDBTest(number a, const char *f, const int l, const coeffs r)
Definition: generics.cc:462
static number gReadFd(s_buff f, const coeffs r)
Definition: generics.cc:385
static nMapFunc gSetMap(const coeffs src, const coeffs dst)
Definition: generics.cc:376
static const char * gRead(const char *s, number *a, const coeffs r)
Definition: generics.cc:214
static BOOLEAN gIsZero(number a, const coeffs r)
Definition: generics.cc:255
static number gInvers(number a, const coeffs r)
Definition: generics.cc:172
static void gDelete(number *a, const coeffs r)
Definition: generics.cc:365
static int gSize(number a, const coeffs)
Definition: generics.cc:132
static number gSub(number a, number b, const coeffs cf)
Definition: generics.cc:66
static number gDiv(number a, number b, const coeffs cf)
Definition: generics.cc:86
static BOOLEAN gIsOne(number a, const coeffs r)
Definition: generics.cc:267

◆ gInitMPZ()

static number gInitMPZ ( mpz_t  i,
const coeffs  cf 
)
static

Definition at line 124 of file generics.cc.

125 {
126  gcp cc=(gcp)omalloc(sizeof(*cc));
127  cc->a1=coeffs1->cfInitMPZ(i,coeffs1);
128  cc->a2=coeffs2->cfInitMPZ(i,coeffs2);
129  n_Test((number)cc,cf);
130  return (number)cc;
131 }

◆ gInpNeg()

static number gInpNeg ( number  a,
const coeffs  r 
)
static

Definition at line 165 of file generics.cc.

166 {
167  gcp aa=(gcp)a;
168  aa->a1=coeffs1->cfInpNeg(aa->a1,coeffs1);
169  aa->a2=coeffs2->cfInpNeg(aa->a2,coeffs2);
170  return (number)aa;
171 }

◆ gInt()

static long gInt ( number &  a,
const  coeffs 
)
static

Definition at line 143 of file generics.cc.

144 {
145  gcp aa=(gcp)a;
146  long s1=coeffs1->cfInt(aa->a1,coeffs1);
147  long s2=coeffs2->cfInt(aa->a2,coeffs2);
148  if (s1!=s2)
149  {
150  printf("gInt: %ld, %ld\n",s1,s2);
151  }
152  return s1;
153 }

◆ gIntMod()

static number gIntMod ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 96 of file generics.cc.

97 {
98  gcp aa=(gcp)a;
99  gcp bb=(gcp)b;
100  gcp cc=(gcp)omalloc(sizeof(*cc));
101  cc->a1=coeffs1->cfIntMod(aa->a1,bb->a1,coeffs1);
102  cc->a2=coeffs2->cfIntMod(aa->a2,bb->a2,coeffs2);
103  n_Test((number)cc,cf);
104  return (number)cc;
105 }

◆ gInvers()

static number gInvers ( number  a,
const coeffs  r 
)
static

Definition at line 172 of file generics.cc.

173 {
174  gcp aa=(gcp)a;
175  gcp cc=(gcp)omalloc(sizeof(*cc));
176  cc->a1=coeffs1->cfInvers(aa->a1,coeffs1);
177  cc->a2=coeffs2->cfInvers(aa->a2,coeffs2);
178  return (number)cc;
179 }

◆ gIsMOne()

static BOOLEAN gIsMOne ( number  a,
const coeffs  r 
)
static

Definition at line 278 of file generics.cc.

279 {
280  gcp aa=(gcp)a;
281  BOOLEAN b1=coeffs1->cfIsMOne(aa->a1,coeffs1);
282  BOOLEAN b2=coeffs2->cfIsMOne(aa->a2,coeffs2);
283  if (b1!=b2)
284  {
285  printf("gIsMOne\n");
286  }
287  return b1;
288 }

◆ gIsOne()

static BOOLEAN gIsOne ( number  a,
const coeffs  r 
)
static

Definition at line 267 of file generics.cc.

268 {
269  gcp aa=(gcp)a;
270  BOOLEAN b1=coeffs1->cfIsOne(aa->a1,coeffs1);
271  BOOLEAN b2=coeffs2->cfIsOne(aa->a2,coeffs2);
272  if (b1!=b2)
273  {
274  printf("gIsOne\n");
275  }
276  return b1;
277 }

◆ gIsUnit()

static BOOLEAN gIsUnit ( number  a,
const  coeffs 
)
static

Definition at line 439 of file generics.cc.

440 {
441  gcp aa=(gcp)a;
442  BOOLEAN b1=coeffs1->cfIsUnit(aa->a1,coeffs1);
443  BOOLEAN b2=coeffs2->cfIsUnit(aa->a2,coeffs2);
444  if (b1!=b2)
445  {
446  printf("gIsUnit:%d,%d\n",b1,b2);
447  }
448  return b1;
449 }

◆ gIsZero()

static BOOLEAN gIsZero ( number  a,
const coeffs  r 
)
static

Definition at line 255 of file generics.cc.

256 {
257  if (a==NULL) return TRUE;
258  gcp aa=(gcp)a;
259  BOOLEAN b1=coeffs1->cfIsZero(aa->a1,coeffs1);
260  BOOLEAN b2=coeffs2->cfIsZero(aa->a2,coeffs2);
261  if (b1!=b2)
262  {
263  printf("gIsZero\n");
264  }
265  return b1;
266 }

◆ gKillChar()

static void gKillChar ( coeffs  r)
static

Definition at line 45 of file generics.cc.

46 {
47  coeffs1->cfKillChar(coeffs1);
48  coeffs2->cfKillChar(coeffs2);
49 }

◆ gLcm()

static number gLcm ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 347 of file generics.cc.

348 {
349  gcp aa=(gcp)a;
350  gcp bb=(gcp)b;
351  gcp cc=(gcp)omalloc(sizeof(*cc));
352  cc->a1=coeffs1->cfLcm(aa->a1,bb->a1,coeffs1);
353  cc->a2=coeffs2->cfLcm(aa->a2,bb->a2,coeffs2);
354  return (number)cc;
355 }

◆ gMPZ()

static void gMPZ ( mpz_t  result,
number &  n,
const coeffs  r 
)
static

Definition at line 154 of file generics.cc.

155 {
156  coeffs1->cfMPZ(result,n,coeffs1);
157  mpz_t r2;
158  coeffs2->cfMPZ(r2,n,coeffs2);
159  if(mpz_cmp(result,r2)!=0)
160  {
161  printf("gMPZ\n");
162  }
163  mpz_clear(r2);
164 }
return result
Definition: facAbsBiFact.cc:75

◆ gMult()

static number gMult ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 56 of file generics.cc.

57 {
58  gcp aa=(gcp)a;
59  gcp bb=(gcp)b;
60  gcp cc=(gcp)omalloc(sizeof(*cc));
61  cc->a1=coeffs1->cfMult(aa->a1,bb->a1,coeffs1);
62  cc->a2=coeffs2->cfMult(aa->a2,bb->a2,coeffs2);
63  n_Test((number)cc,cf);
64  return (number)cc;
65 }

◆ gNormalize()

static void gNormalize ( number &  a,
const coeffs  r 
)
static

Definition at line 225 of file generics.cc.

226 {
227  gcp aa=(gcp)a;
228  coeffs1->cfNormalize(aa->a1,coeffs1);
229  coeffs2->cfNormalize(aa->a2,coeffs2);
230 }

◆ gNormalizeHelper()

static number gNormalizeHelper ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 356 of file generics.cc.

357 {
358  gcp aa=(gcp)a;
359  gcp bb=(gcp)b;
360  gcp cc=(gcp)omalloc(sizeof(*cc));
361  cc->a1=coeffs1->cfNormalizeHelper(aa->a1,bb->a1,coeffs1);
362  cc->a2=coeffs2->cfNormalizeHelper(aa->a2,bb->a2,coeffs2);
363  return (number)cc;
364 }

◆ gPower()

static void gPower ( number  a,
int  i,
number *  result,
const coeffs  r 
)
static

Definition at line 300 of file generics.cc.

301 {
302  gcp aa=(gcp)a;
303  gcp cc=(gcp)omalloc(sizeof(*cc));
304  coeffs1->cfPower(aa->a1,i,&cc->a1,coeffs1);
305  coeffs2->cfPower(aa->a2,i,&cc->a2,coeffs2);
306  *result=(number)cc;
307 }

◆ gQuotRem()

static number gQuotRem ( number  a,
number  b,
number *  rem,
const coeffs  r 
)
static

Definition at line 342 of file generics.cc.

343 {
344  printf("gQuotRem\n");
345  return NULL;
346 }

◆ gRandom()

static number gRandom ( siRandProc  p,
number  p1,
number  p2,
const coeffs  cf 
)
static

Definition at line 403 of file generics.cc.

404 {
405  printf("gRandom\n");
406  return NULL;
407 }

◆ gRead()

static const char* gRead ( const char *  s,
number *  a,
const coeffs  r 
)
static

Definition at line 214 of file generics.cc.

215 {
216  gcp cc=(gcp)omalloc(sizeof(*cc));
217  const char* ss=coeffs1->cfRead(s,&(cc->a1),coeffs1);
218  number tmp=coeffs2->cfInit(1,coeffs2);
219  mpz_ptr tt=(mpz_ptr)tmp;
220  coeffs1->cfMPZ(tt,cc->a1,coeffs1);
221  cc->a2=(number)tt;
222  *a=(number)cc;
223  return ss;
224 }
const CanonicalForm int s
Definition: facAbsFact.cc:51

◆ gReadFd()

static number gReadFd ( s_buff  f,
const coeffs  r 
)
static

Definition at line 385 of file generics.cc.

386 {
387  printf("gReadFd\n");
388  return NULL;
389 }

◆ gRePart()

static number gRePart ( number  a,
const coeffs  r 
)
static

Definition at line 188 of file generics.cc.

189 {
190  gcp aa=(gcp)a;
191  gcp cc=(gcp)omalloc(sizeof(*cc));
192  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
193  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
194  return (number)cc;
195 }

◆ gSetChar()

static void gSetChar ( coeffs  r)
static

Definition at line 50 of file generics.cc.

51 {
52  coeffs1->cfSetChar(coeffs1);
53  coeffs2->cfSetChar(coeffs2);
54 }

◆ gSetMap()

static nMapFunc gSetMap ( const coeffs  src,
const coeffs  dst 
)
static

Definition at line 376 of file generics.cc.

377 {
378  printf("gSetMap\n");
379  return NULL;
380 }

◆ gSize()

static int gSize ( number  a,
const  coeffs 
)
static

Definition at line 132 of file generics.cc.

133 {
134  gcp aa=(gcp)a;
135  int s1=coeffs1->cfSize(aa->a1,coeffs1);
136  int s2=coeffs2->cfSize(aa->a2,coeffs2);
137  if (s1!=s2)
138  {
139  printf("gSize: %d, %d\n",s1,s2);
140  }
141  return s1;
142 }

◆ gSub()

static number gSub ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 66 of file generics.cc.

67 {
68  gcp aa=(gcp)a;
69  gcp bb=(gcp)b;
70  gcp cc=(gcp)omalloc(sizeof(*cc));
71  cc->a1=coeffs1->cfSub(aa->a1,bb->a1,coeffs1);
72  cc->a2=coeffs2->cfSub(aa->a2,bb->a2,coeffs2);
73  n_Test((number)cc,cf);
74  return (number)cc;
75 }

◆ gSubringGcd()

static number gSubringGcd ( number  a,
number  b,
const  coeffs 
)
static

Definition at line 317 of file generics.cc.

318 {
319  gcp aa=(gcp)a;
320  gcp bb=(gcp)b;
321  gcp cc=(gcp)omalloc(sizeof(*cc));
322  cc->a1=coeffs1->cfSubringGcd(aa->a1,bb->a1,coeffs1);
323  cc->a2=coeffs2->cfSubringGcd(aa->a2,bb->a2,coeffs2);
324  return (number)cc;
325 }

◆ gWriteFd()

static void gWriteFd ( number  a,
FILE *  f,
const coeffs  r 
)
static

Definition at line 381 of file generics.cc.

382 {
383  printf("gWriteFd\n");
384 }

◆ gWriteLong()

static void gWriteLong ( number  a,
const coeffs  r 
)
static

Definition at line 204 of file generics.cc.

205 {
206  gcp aa=(gcp)a;
207  coeffs1->cfWriteLong(aa->a1,coeffs1);
208 }

◆ gWriteShort()

static void gWriteShort ( number  a,
const coeffs  r 
)
static

Definition at line 209 of file generics.cc.

210 {
211  gcp aa=(gcp)a;
212  coeffs1->cfWriteShort(aa->a1,coeffs1);
213 }

Variable Documentation

◆ coeffs1

VAR coeffs coeffs1

Definition at line 33 of file generics.cc.

◆ coeffs2

VAR coeffs coeffs2

Definition at line 33 of file generics.cc.