Data Structures | Functions | Variables
generics.cc File Reference
#include "misc/auxiliary.h"
#include "omalloc/omalloc.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)
 
char * gCoeffString (const coeffs r)
 
char * gCoeffName (const coeffs r)
 
void gKillChar (coeffs r)
 
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

coeffs coeffs1
 
coeffs coeffs2
 

Data Structure Documentation

◆ generic_pair

struct generic_pair

Definition at line 28 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 81 of file generics.cc.

82 {
83  gcp aa=(gcp)a;
84  gcp bb=(gcp)b;
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);
88  n_Test((number)cc,cf);
89  return (number)cc;
90 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#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 403 of file generics.cc.

404 {
405  printf("gChineseREmainder\n");
406  return NULL;
407 }
#define NULL
Definition: omList.c:10

◆ gCoeffName()

char* gCoeffName ( const coeffs  r)

Definition at line 46 of file generics.cc.

47 {
48  return coeffs1->cfCoeffName(coeffs1);
49 }
coeffs coeffs1
Definition: generics.cc:34

◆ gCoeffString()

char* gCoeffString ( const coeffs  r)

Definition at line 42 of file generics.cc.

43 {
44  return coeffs1->cfCoeffString(coeffs1);
45 }
coeffs coeffs1
Definition: generics.cc:34

◆ gCoeffWrite()

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

Definition at line 36 of file generics.cc.

37 {
38  printf("debug: ");
39  coeffs1->cfCoeffWrite(coeffs1,b);
40 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044

◆ gCopy()

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

Definition at line 185 of file generics.cc.

186 {
187  gcp aa=(gcp)a;
188  gcp cc=(gcp)omalloc(sizeof(*cc));
189  cc->a1=coeffs1->cfCopy(aa->a1,coeffs1);
190  cc->a2=coeffs2->cfCopy(aa->a2,coeffs2);
191  return (number)cc;
192 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gDBTest()

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

Definition at line 467 of file generics.cc.

468 {
469  if (a==NULL)
470  printf("NULL in %s:%d\n",f,l);
471  return TRUE;
472 }
#define TRUE
Definition: auxiliary.h:98
FILE * f
Definition: checklibs.c:9
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:93

◆ gDelete()

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

Definition at line 370 of file generics.cc.

371 {
372  if (*a!=NULL)
373  {
374  gcp aa=(gcp)*a;
375  coeffs1->cfDelete(&aa->a1,coeffs1);
376  coeffs2->cfDelete(&aa->a2,coeffs2);
377  omFree(aa);
378  *a=NULL;
379  }
380 }
coeffs coeffs1
Definition: generics.cc:34
#define omFree(addr)
Definition: omAllocDecl.h:261
coeffs coeffs2
Definition: generics.cc:34
#define NULL
Definition: omList.c:10

◆ gDiv()

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

Definition at line 91 of file generics.cc.

92 {
93  gcp aa=(gcp)a;
94  gcp bb=(gcp)b;
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);
98  n_Test((number)cc,cf);
99  return (number)cc;
100 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gDivBy()

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

Definition at line 413 of file generics.cc.

414 {
415  gcp aa=(gcp)a;
416  gcp bb=(gcp)b;
417  BOOLEAN b1=coeffs1->cfDivBy(aa->a1,bb->a1,coeffs1);
418  BOOLEAN b2=coeffs2->cfDivBy(aa->a2,bb->a2,coeffs2);
419  if (b1!=b2)
420  {
421  printf("gDivBy:%d,%d\n",b1,b2);
422  }
423  return b1;
424 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gDivComp()

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

Definition at line 455 of file generics.cc.

456 {
457  gcp aa=(gcp)a;
458  gcp bb=(gcp)b;
459  int i1=coeffs1->cfDivComp(aa->a1,bb->a1,coeffs1);
460  int i2=coeffs2->cfDivComp(aa->a2,bb->a2,coeffs2);
461  if (i1!=i2)
462  {
463  printf("gDivComp:%d,%d\n",i1,i2);
464  }
465  return i1;
466 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34

◆ gEqual()

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

Definition at line 248 of file generics.cc.

249 {
250  gcp aa=(gcp)a;
251  gcp bb=(gcp)b;
252  BOOLEAN b1=coeffs1->cfEqual(aa->a1,bb->a1,coeffs1);
253  BOOLEAN b2=coeffs2->cfEqual(aa->a2,bb->a2,coeffs2);
254  if (b1!=b2)
255  {
256  printf("gEqual\n");
257  }
258  return b1;
259 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gExactDiv()

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

Definition at line 111 of file generics.cc.

112 {
113  gcp aa=(gcp)a;
114  gcp bb=(gcp)b;
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);
118  n_Test((number)cc,cf);
119  return (number)cc;
120 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gExtGcd()

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

Definition at line 425 of file generics.cc.

426 {
427  gcp aa=(gcp)a;
428  gcp bb=(gcp)b;
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);
434  return (number)cc;
435 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gFarey()

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

Definition at line 395 of file generics.cc.

396 {
397  gcp aa=(gcp)p;
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);
401  return (number)cc;
402 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228
int p
Definition: cfModGcd.cc:4019

◆ gGcd()

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

Definition at line 313 of file generics.cc.

314 {
315  gcp aa=(gcp)a;
316  gcp bb=(gcp)b;
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);
320  return (number)cc;
321 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gGetDenom()

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

Definition at line 331 of file generics.cc.

332 {
333  gcp aa=(gcp)a;
334  gcp cc=(gcp)omalloc(sizeof(*cc));
335  cc->a1=coeffs1->cfGetDenom(aa->a1,coeffs1);
336  cc->a2=coeffs2->cfGetDenom(aa->a2,coeffs2);
337  return (number)cc;
338 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gGetNumerator()

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

Definition at line 339 of file generics.cc.

340 {
341  gcp aa=(gcp)a;
342  gcp cc=(gcp)omalloc(sizeof(*cc));
343  cc->a1=coeffs1->cfGetNumerator(aa->a1,coeffs1);
344  cc->a2=coeffs2->cfGetNumerator(aa->a2,coeffs2);
345  return (number)cc;
346 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gGetUnit()

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

Definition at line 436 of file generics.cc.

437 {
438  gcp aa=(gcp)n;
439  gcp cc=(gcp)omalloc(sizeof(*cc));
440  cc->a1=coeffs1->cfGetUnit(aa->a1,coeffs1);
441  cc->a2=coeffs2->cfGetUnit(aa->a2,coeffs2);
442  return (number)cc;
443 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gGreater()

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

Definition at line 236 of file generics.cc.

237 {
238  gcp aa=(gcp)a;
239  gcp bb=(gcp)b;
240  BOOLEAN b1=coeffs1->cfGreater(aa->a1,bb->a1,coeffs1);
241  BOOLEAN b2=coeffs2->cfGreater(aa->a2,bb->a2,coeffs2);
242  if (b1!=b2)
243  {
244  printf("gGreater\n");
245  }
246  return b1;
247 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gGreaterZero()

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

Definition at line 294 of file generics.cc.

295 {
296  gcp aa=(gcp)a;
297  BOOLEAN b1=coeffs1->cfGreaterZero(aa->a1,coeffs1);
298  BOOLEAN b2=coeffs2->cfGreaterZero(aa->a2,coeffs2);
299  if (b1!=b2)
300  {
301  printf("gGreaterZero\n");
302  }
303  return b1;
304 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gImPart()

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

Definition at line 201 of file generics.cc.

202 {
203  gcp aa=(gcp)a;
204  gcp cc=(gcp)omalloc(sizeof(*cc));
205  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
206  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
207  return (number)cc;
208 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gInit()

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

Definition at line 121 of file generics.cc.

122 {
123  gcp cc=(gcp)omalloc(sizeof(*cc));
124  cc->a1=coeffs1->cfInit(i,coeffs1);
125  cc->a2=coeffs2->cfInit(i,coeffs2);
126  n_Test((number)cc,cf);
127  return (number)cc;
128 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
int i
Definition: cfEzgcd.cc:125
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gInitChar()

BOOLEAN gInitChar ( coeffs  r,
void *  p 
)

Definition at line 473 of file generics.cc.

474 {
475  coeffs1=nInitChar(n_Z_1,(void*)1);
476  coeffs2=nInitChar(n_Z_2,(void*)1);
477  r->is_field=FALSE;
478  r->is_domain=TRUE;
479  r->rep=n_rep_unknown;
480  r->ch = 0;
481  r->cfKillChar=gKillChar;
482  //r->nCoeffIsEqual=gCoeffsEqual;
483  r->cfCoeffString=gCoeffString;
484  r->cfCoeffName=gCoeffName;
485  r->cfCoeffWrite=gCoeffWrite;
486 
487  r->cfMult = gMult;
488  r->cfSub = gSub;
489  r->cfAdd = gAdd;
490  r->cfDiv = gDiv;
491  r->cfInit = gInit;
492  r->cfSize = gSize;
493  r->cfInt = gInt;
494  #ifdef HAVE_RINGS
495  r->cfDivComp = gDivComp;
496  r->cfIsUnit = gIsUnit;
497  r->cfGetUnit = gGetUnit;
498  r->cfExtGcd = gExtGcd;
499  r->cfDivBy = gDivBy;
500  #endif
501  r->cfInpNeg = gInpNeg;
502  r->cfInvers= gInvers;
503  r->cfCopy = gCopy;
504  r->cfRePart = gCopy;
505  //r->cfImPart = ndReturn0;
506  r->cfWriteLong = gWriteLong;
507  r->cfWriteShort = gWriteShort;
508  r->cfRead = gRead;
509  r->cfNormalize=gNormalize;
510  r->cfGreater = gGreater;
511  r->cfEqual = gEqual;
512  r->cfIsZero = gIsZero;
513  r->cfIsOne = gIsOne;
514  r->cfIsMOne = gIsMOne;
515  r->cfGreaterZero = gGreaterZero;
516  r->cfPower = gPower;
517  r->cfGetDenom = gGetDenom;
518  r->cfGetNumerator = gGetNumerator;
519  r->cfGcd = gGcd;
520  r->cfLcm = gGcd;
521  r->cfDelete= gDelete;
522  r->cfSetMap = gSetMap;
523  //r->cfInpMult=ndInpMult;
524  r->cfRandom=gRandom;
525  r->cfWriteFd=gWriteFd;
526  r->cfReadFd=gReadFd;
527  r->type=n_Z;
528  #ifdef LDEBUG
529  r->cfDBTest=gDBTest;
530  #endif
531  return FALSE;
532 }
static void gCoeffWrite(const coeffs r, BOOLEAN b)
Definition: generics.cc:36
char * gCoeffName(const coeffs r)
Definition: generics.cc:46
char * gCoeffString(const coeffs r)
Definition: generics.cc:42
static void gDelete(number *a, const coeffs r)
Definition: generics.cc:370
static BOOLEAN gGreaterZero(number a, const coeffs r)
Definition: generics.cc:294
static int gSize(number a, const coeffs)
Definition: generics.cc:137
static number gAdd(number a, number b, const coeffs cf)
Definition: generics.cc:81
#define FALSE
Definition: auxiliary.h:94
static number gGetUnit(number n, const coeffs r)
Definition: generics.cc:436
static number gDiv(number a, number b, const coeffs cf)
Definition: generics.cc:91
static void gPower(number a, int i, number *result, const coeffs r)
Definition: generics.cc:305
static BOOLEAN gIsZero(number a, const coeffs r)
Definition: generics.cc:260
static BOOLEAN gIsOne(number a, const coeffs r)
Definition: generics.cc:272
static BOOLEAN gGreater(number a, number b, const coeffs r)
Definition: generics.cc:236
coeffs coeffs1
Definition: generics.cc:34
#define TRUE
Definition: auxiliary.h:98
static void gNormalize(number &a, const coeffs r)
Definition: generics.cc:230
static number gReadFd(s_buff f, const coeffs r)
Definition: generics.cc:390
static number gInvers(number a, const coeffs r)
Definition: generics.cc:177
static number gExtGcd(number a, number b, number *s, number *t, const coeffs)
Definition: generics.cc:425
static BOOLEAN gIsMOne(number a, const coeffs r)
Definition: generics.cc:283
static void gWriteLong(number a, const coeffs r)
Definition: generics.cc:209
static number gRandom(siRandProc p, number p1, number p2, const coeffs cf)
Definition: generics.cc:408
static void gWriteFd(number a, FILE *f, const coeffs r)
Definition: generics.cc:386
static void gWriteShort(number a, const coeffs r)
Definition: generics.cc:214
static number gInpNeg(number a, const coeffs r)
Definition: generics.cc:170
coeffs coeffs2
Definition: generics.cc:34
void gKillChar(coeffs r)
Definition: generics.cc:50
static BOOLEAN gDBTest(number a, const char *f, const int l, const coeffs r)
Definition: generics.cc:467
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
static int gDivComp(number a, number b, const coeffs r)
Definition: generics.cc:455
static number gGetNumerator(number &a, const coeffs)
Definition: generics.cc:339
static number gMult(number a, number b, const coeffs cf)
Definition: generics.cc:61
static BOOLEAN gEqual(number a, number b, const coeffs r)
Definition: generics.cc:248
static nMapFunc gSetMap(const coeffs src, const coeffs dst)
Definition: generics.cc:381
static BOOLEAN gIsUnit(number a, const coeffs)
Definition: generics.cc:444
static number gInit(long i, const coeffs cf)
Definition: generics.cc:121
static number gSub(number a, number b, const coeffs cf)
Definition: generics.cc:71
static number gCopy(number a, const coeffs r)
Definition: generics.cc:185
static const char * gRead(const char *s, number *a, const coeffs r)
Definition: generics.cc:219
static long gInt(number &a, const coeffs)
Definition: generics.cc:148
static number gGetDenom(number &a, const coeffs)
Definition: generics.cc:331
static number gGcd(number a, number b, const coeffs)
Definition: generics.cc:313
static BOOLEAN gDivBy(number a, number b, const coeffs)
Definition: generics.cc:413
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349

◆ gInitMPZ()

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

Definition at line 129 of file generics.cc.

130 {
131  gcp cc=(gcp)omalloc(sizeof(*cc));
132  cc->a1=coeffs1->cfInitMPZ(i,coeffs1);
133  cc->a2=coeffs2->cfInitMPZ(i,coeffs2);
134  n_Test((number)cc,cf);
135  return (number)cc;
136 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
int i
Definition: cfEzgcd.cc:125
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gInpNeg()

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

Definition at line 170 of file generics.cc.

171 {
172  gcp aa=(gcp)a;
173  aa->a1=coeffs1->cfInpNeg(aa->a1,coeffs1);
174  aa->a2=coeffs2->cfInpNeg(aa->a2,coeffs2);
175  return (number)aa;
176 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gInt()

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

Definition at line 148 of file generics.cc.

149 {
150  gcp aa=(gcp)a;
151  long s1=coeffs1->cfInt(aa->a1,coeffs1);
152  long s2=coeffs2->cfInt(aa->a2,coeffs2);
153  if (s1!=s2)
154  {
155  printf("gInt: %ld, %ld\n",s1,s2);
156  }
157  return s1;
158 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gIntMod()

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

Definition at line 101 of file generics.cc.

102 {
103  gcp aa=(gcp)a;
104  gcp bb=(gcp)b;
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);
108  n_Test((number)cc,cf);
109  return (number)cc;
110 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gInvers()

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

Definition at line 177 of file generics.cc.

178 {
179  gcp aa=(gcp)a;
180  gcp cc=(gcp)omalloc(sizeof(*cc));
181  cc->a1=coeffs1->cfInvers(aa->a1,coeffs1);
182  cc->a2=coeffs2->cfInvers(aa->a2,coeffs2);
183  return (number)cc;
184 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gIsMOne()

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

Definition at line 283 of file generics.cc.

284 {
285  gcp aa=(gcp)a;
286  BOOLEAN b1=coeffs1->cfIsMOne(aa->a1,coeffs1);
287  BOOLEAN b2=coeffs2->cfIsMOne(aa->a2,coeffs2);
288  if (b1!=b2)
289  {
290  printf("gIsMOne\n");
291  }
292  return b1;
293 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gIsOne()

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

Definition at line 272 of file generics.cc.

273 {
274  gcp aa=(gcp)a;
275  BOOLEAN b1=coeffs1->cfIsOne(aa->a1,coeffs1);
276  BOOLEAN b2=coeffs2->cfIsOne(aa->a2,coeffs2);
277  if (b1!=b2)
278  {
279  printf("gIsOne\n");
280  }
281  return b1;
282 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gIsUnit()

static BOOLEAN gIsUnit ( number  a,
const coeffs   
)
static

Definition at line 444 of file generics.cc.

445 {
446  gcp aa=(gcp)a;
447  BOOLEAN b1=coeffs1->cfIsUnit(aa->a1,coeffs1);
448  BOOLEAN b2=coeffs2->cfIsUnit(aa->a2,coeffs2);
449  if (b1!=b2)
450  {
451  printf("gIsUnit:%d,%d\n",b1,b2);
452  }
453  return b1;
454 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
int BOOLEAN
Definition: auxiliary.h:85

◆ gIsZero()

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

Definition at line 260 of file generics.cc.

261 {
262  if (a==NULL) return TRUE;
263  gcp aa=(gcp)a;
264  BOOLEAN b1=coeffs1->cfIsZero(aa->a1,coeffs1);
265  BOOLEAN b2=coeffs2->cfIsZero(aa->a2,coeffs2);
266  if (b1!=b2)
267  {
268  printf("gIsZero\n");
269  }
270  return b1;
271 }
coeffs coeffs1
Definition: generics.cc:34
#define TRUE
Definition: auxiliary.h:98
coeffs coeffs2
Definition: generics.cc:34
#define NULL
Definition: omList.c:10
int BOOLEAN
Definition: auxiliary.h:85

◆ gKillChar()

void gKillChar ( coeffs  r)

Definition at line 50 of file generics.cc.

51 {
52  coeffs1->cfKillChar(coeffs1);
53  coeffs2->cfKillChar(coeffs2);
54 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gLcm()

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

Definition at line 352 of file generics.cc.

353 {
354  gcp aa=(gcp)a;
355  gcp bb=(gcp)b;
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);
359  return (number)cc;
360 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gMPZ()

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

Definition at line 159 of file generics.cc.

160 {
161  coeffs1->cfMPZ(result,n,coeffs1);
162  mpz_t r2;
163  coeffs2->cfMPZ(r2,n,coeffs2);
164  if(mpz_cmp(result,r2)!=0)
165  {
166  printf("gMPZ\n");
167  }
168  mpz_clear(r2);
169 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
return result
Definition: facAbsBiFact.cc:76

◆ gMult()

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

Definition at line 61 of file generics.cc.

62 {
63  gcp aa=(gcp)a;
64  gcp bb=(gcp)b;
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);
68  n_Test((number)cc,cf);
69  return (number)cc;
70 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gNormalize()

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

Definition at line 230 of file generics.cc.

231 {
232  gcp aa=(gcp)a;
233  coeffs1->cfNormalize(aa->a1,coeffs1);
234  coeffs2->cfNormalize(aa->a2,coeffs2);
235 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gNormalizeHelper()

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

Definition at line 361 of file generics.cc.

362 {
363  gcp aa=(gcp)a;
364  gcp bb=(gcp)b;
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);
368  return (number)cc;
369 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gPower()

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

Definition at line 305 of file generics.cc.

306 {
307  gcp aa=(gcp)a;
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);
311  *result=(number)cc;
312 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
int i
Definition: cfEzgcd.cc:125
#define omalloc(size)
Definition: omAllocDecl.h:228
return result
Definition: facAbsBiFact.cc:76

◆ gQuotRem()

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

Definition at line 347 of file generics.cc.

348 {
349  printf("gQuotRem\n");
350  return NULL;
351 }
#define NULL
Definition: omList.c:10

◆ gRandom()

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

Definition at line 408 of file generics.cc.

409 {
410  printf("gRandom\n");
411  return NULL;
412 }
#define NULL
Definition: omList.c:10

◆ gRead()

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

Definition at line 219 of file generics.cc.

220 {
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);
226  cc->a2=(number)tt;
227  *a=(number)cc;
228  return ss;
229 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gReadFd()

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

Definition at line 390 of file generics.cc.

391 {
392  printf("gReadFd\n");
393  return NULL;
394 }
#define NULL
Definition: omList.c:10

◆ gRePart()

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

Definition at line 193 of file generics.cc.

194 {
195  gcp aa=(gcp)a;
196  gcp cc=(gcp)omalloc(sizeof(*cc));
197  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
198  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
199  return (number)cc;
200 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gSetChar()

void gSetChar ( coeffs  r)

Definition at line 55 of file generics.cc.

56 {
57  coeffs1->cfSetChar(coeffs1);
58  coeffs2->cfSetChar(coeffs2);
59 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gSetMap()

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

Definition at line 381 of file generics.cc.

382 {
383  printf("gSetMap\n");
384  return NULL;
385 }
#define NULL
Definition: omList.c:10

◆ gSize()

static int gSize ( number  a,
const coeffs   
)
static

Definition at line 137 of file generics.cc.

138 {
139  gcp aa=(gcp)a;
140  int s1=coeffs1->cfSize(aa->a1,coeffs1);
141  int s2=coeffs2->cfSize(aa->a2,coeffs2);
142  if (s1!=s2)
143  {
144  printf("gSize: %d, %d\n",s1,s2);
145  }
146  return s1;
147 }
coeffs coeffs1
Definition: generics.cc:34
coeffs coeffs2
Definition: generics.cc:34

◆ gSub()

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

Definition at line 71 of file generics.cc.

72 {
73  gcp aa=(gcp)a;
74  gcp bb=(gcp)b;
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);
78  n_Test((number)cc,cf);
79  return (number)cc;
80 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gSubringGcd()

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

Definition at line 322 of file generics.cc.

323 {
324  gcp aa=(gcp)a;
325  gcp bb=(gcp)b;
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);
329  return (number)cc;
330 }
coeffs coeffs1
Definition: generics.cc:34
CanonicalForm b
Definition: cfModGcd.cc:4044
coeffs coeffs2
Definition: generics.cc:34
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ gWriteFd()

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

Definition at line 386 of file generics.cc.

387 {
388  printf("gWriteFd\n");
389 }

◆ gWriteLong()

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

Definition at line 209 of file generics.cc.

210 {
211  gcp aa=(gcp)a;
212  coeffs1->cfWriteLong(aa->a1,coeffs1);
213 }
coeffs coeffs1
Definition: generics.cc:34

◆ gWriteShort()

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

Definition at line 214 of file generics.cc.

215 {
216  gcp aa=(gcp)a;
217  coeffs1->cfWriteShort(aa->a1,coeffs1);
218 }
coeffs coeffs1
Definition: generics.cc:34

Variable Documentation

◆ coeffs1

coeffs coeffs1

Definition at line 34 of file generics.cc.

◆ coeffs2

coeffs coeffs2

Definition at line 34 of file generics.cc.