My Project  debian-1:4.1.2-p1+ds-2
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)
 
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

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 80 of file generics.cc.

81 {
82  gcp aa=(gcp)a;
83  gcp bb=(gcp)b;
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);
87  n_Test((number)cc,cf);
88  return (number)cc;
89 }
CanonicalForm cf
Definition: cfModGcd.cc:4024
CanonicalForm b
Definition: cfModGcd.cc:4044
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
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 402 of file generics.cc.

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

◆ gCoeffName()

char* gCoeffName ( const coeffs  r)

Definition at line 45 of file generics.cc.

46 {
47  return coeffs1->cfCoeffName(coeffs1);
48 }

◆ gCoeffString()

char* gCoeffString ( const coeffs  r)

Definition at line 41 of file generics.cc.

42 {
43  return coeffs1->cfCoeffString(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 184 of file generics.cc.

185 {
186  gcp aa=(gcp)a;
187  gcp cc=(gcp)omalloc(sizeof(*cc));
188  cc->a1=coeffs1->cfCopy(aa->a1,coeffs1);
189  cc->a2=coeffs2->cfCopy(aa->a2,coeffs2);
190  return (number)cc;
191 }

◆ gDBTest()

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

Definition at line 466 of file generics.cc.

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

◆ gDelete()

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

Definition at line 369 of file generics.cc.

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

◆ gDiv()

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

Definition at line 90 of file generics.cc.

91 {
92  gcp aa=(gcp)a;
93  gcp bb=(gcp)b;
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);
97  n_Test((number)cc,cf);
98  return (number)cc;
99 }

◆ gDivBy()

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

Definition at line 412 of file generics.cc.

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

◆ gDivComp()

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

Definition at line 454 of file generics.cc.

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

◆ gEqual()

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

Definition at line 247 of file generics.cc.

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

◆ gExactDiv()

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

Definition at line 110 of file generics.cc.

111 {
112  gcp aa=(gcp)a;
113  gcp bb=(gcp)b;
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);
117  n_Test((number)cc,cf);
118  return (number)cc;
119 }

◆ gExtGcd()

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

Definition at line 424 of file generics.cc.

425 {
426  gcp aa=(gcp)a;
427  gcp bb=(gcp)b;
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);
433  return (number)cc;
434 }

◆ gFarey()

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

Definition at line 394 of file generics.cc.

395 {
396  gcp aa=(gcp)p;
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);
400  return (number)cc;
401 }
int p
Definition: cfModGcd.cc:4019

◆ gGcd()

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

Definition at line 312 of file generics.cc.

313 {
314  gcp aa=(gcp)a;
315  gcp bb=(gcp)b;
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);
319  return (number)cc;
320 }

◆ gGetDenom()

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

Definition at line 330 of file generics.cc.

331 {
332  gcp aa=(gcp)a;
333  gcp cc=(gcp)omalloc(sizeof(*cc));
334  cc->a1=coeffs1->cfGetDenom(aa->a1,coeffs1);
335  cc->a2=coeffs2->cfGetDenom(aa->a2,coeffs2);
336  return (number)cc;
337 }

◆ gGetNumerator()

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

Definition at line 338 of file generics.cc.

339 {
340  gcp aa=(gcp)a;
341  gcp cc=(gcp)omalloc(sizeof(*cc));
342  cc->a1=coeffs1->cfGetNumerator(aa->a1,coeffs1);
343  cc->a2=coeffs2->cfGetNumerator(aa->a2,coeffs2);
344  return (number)cc;
345 }

◆ gGetUnit()

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

Definition at line 435 of file generics.cc.

436 {
437  gcp aa=(gcp)n;
438  gcp cc=(gcp)omalloc(sizeof(*cc));
439  cc->a1=coeffs1->cfGetUnit(aa->a1,coeffs1);
440  cc->a2=coeffs2->cfGetUnit(aa->a2,coeffs2);
441  return (number)cc;
442 }

◆ gGreater()

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

Definition at line 235 of file generics.cc.

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

◆ gGreaterZero()

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

Definition at line 293 of file generics.cc.

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

◆ gImPart()

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

Definition at line 200 of file generics.cc.

201 {
202  gcp aa=(gcp)a;
203  gcp cc=(gcp)omalloc(sizeof(*cc));
204  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
205  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
206  return (number)cc;
207 }

◆ gInit()

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

Definition at line 120 of file generics.cc.

121 {
122  gcp cc=(gcp)omalloc(sizeof(*cc));
123  cc->a1=coeffs1->cfInit(i,coeffs1);
124  cc->a2=coeffs2->cfInit(i,coeffs2);
125  n_Test((number)cc,cf);
126  return (number)cc;
127 }
int i
Definition: cfEzgcd.cc:125

◆ gInitChar()

BOOLEAN gInitChar ( coeffs  r,
void *  p 
)

Definition at line 472 of file generics.cc.

473 {
474  coeffs1=nInitChar(n_Z_1,(void*)1);
475  coeffs2=nInitChar(n_Z_2,(void*)1);
476  r->is_field=FALSE;
477  r->is_domain=TRUE;
478  r->rep=n_rep_unknown;
479  r->ch = 0;
480  r->cfKillChar=gKillChar;
481  //r->nCoeffIsEqual=gCoeffsEqual;
482  r->cfCoeffString=gCoeffString;
483  r->cfCoeffName=gCoeffName;
484  r->cfCoeffWrite=gCoeffWrite;
485 
486  r->cfMult = gMult;
487  r->cfSub = gSub;
488  r->cfAdd = gAdd;
489  r->cfDiv = gDiv;
490  r->cfInit = gInit;
491  r->cfSize = gSize;
492  r->cfInt = gInt;
493  #ifdef HAVE_RINGS
494  r->cfDivComp = gDivComp;
495  r->cfIsUnit = gIsUnit;
496  r->cfGetUnit = gGetUnit;
497  r->cfExtGcd = gExtGcd;
498  r->cfDivBy = gDivBy;
499  #endif
500  r->cfInpNeg = gInpNeg;
501  r->cfInvers= gInvers;
502  r->cfCopy = gCopy;
503  r->cfRePart = gCopy;
504  //r->cfImPart = ndReturn0;
505  r->cfWriteLong = gWriteLong;
506  r->cfWriteShort = gWriteShort;
507  r->cfRead = gRead;
508  r->cfNormalize=gNormalize;
509  r->cfGreater = gGreater;
510  r->cfEqual = gEqual;
511  r->cfIsZero = gIsZero;
512  r->cfIsOne = gIsOne;
513  r->cfIsMOne = gIsMOne;
514  r->cfGreaterZero = gGreaterZero;
515  r->cfPower = gPower;
516  r->cfGetDenom = gGetDenom;
517  r->cfGetNumerator = gGetNumerator;
518  r->cfGcd = gGcd;
519  r->cfLcm = gGcd;
520  r->cfDelete= gDelete;
521  r->cfSetMap = gSetMap;
522  //r->cfInpMult=ndInpMult;
523  r->cfRandom=gRandom;
524  r->cfWriteFd=gWriteFd;
525  r->cfReadFd=gReadFd;
526  r->type=n_Z;
527  #ifdef LDEBUG
528  r->cfDBTest=gDBTest;
529  #endif
530  return FALSE;
531 }
#define FALSE
Definition: auxiliary.h:96
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
@ n_rep_unknown
Definition: coeffs.h:109
static int gDivComp(number a, number b, const coeffs r)
Definition: generics.cc:454
char * gCoeffName(const coeffs r)
Definition: generics.cc:45
static void gWriteFd(number a, FILE *f, const coeffs r)
Definition: generics.cc:385
static number gCopy(number a, const coeffs r)
Definition: generics.cc:184
static number gGcd(number a, number b, const coeffs)
Definition: generics.cc:312
static number gMult(number a, number b, const coeffs cf)
Definition: generics.cc:60
static BOOLEAN gIsMOne(number a, const coeffs r)
Definition: generics.cc:282
static void gWriteShort(number a, const coeffs r)
Definition: generics.cc:213
static BOOLEAN gDivBy(number a, number b, const coeffs)
Definition: generics.cc:412
static void gNormalize(number &a, const coeffs r)
Definition: generics.cc:229
static long gInt(number &a, const coeffs)
Definition: generics.cc:147
static number gAdd(number a, number b, const coeffs cf)
Definition: generics.cc:80
static BOOLEAN gIsUnit(number a, const coeffs)
Definition: generics.cc:443
static void gPower(number a, int i, number *result, const coeffs r)
Definition: generics.cc:304
static number gInpNeg(number a, const coeffs r)
Definition: generics.cc:169
static BOOLEAN gGreaterZero(number a, const coeffs r)
Definition: generics.cc:293
static number gGetUnit(number n, const coeffs r)
Definition: generics.cc:435
static number gInit(long i, const coeffs cf)
Definition: generics.cc:120
static void gCoeffWrite(const coeffs r, BOOLEAN b)
Definition: generics.cc:35
static number gGetDenom(number &a, const coeffs)
Definition: generics.cc:330
static BOOLEAN gEqual(number a, number b, const coeffs r)
Definition: generics.cc:247
void gKillChar(coeffs r)
Definition: generics.cc:49
static number gGetNumerator(number &a, const coeffs)
Definition: generics.cc:338
char * gCoeffString(const coeffs r)
Definition: generics.cc:41
static number gRandom(siRandProc p, number p1, number p2, const coeffs cf)
Definition: generics.cc:407
static BOOLEAN gGreater(number a, number b, const coeffs r)
Definition: generics.cc:235
static number gExtGcd(number a, number b, number *s, number *t, const coeffs)
Definition: generics.cc:424
static void gWriteLong(number a, const coeffs r)
Definition: generics.cc:208
static BOOLEAN gDBTest(number a, const char *f, const int l, const coeffs r)
Definition: generics.cc:466
static number gReadFd(s_buff f, const coeffs r)
Definition: generics.cc:389
static nMapFunc gSetMap(const coeffs src, const coeffs dst)
Definition: generics.cc:380
static const char * gRead(const char *s, number *a, const coeffs r)
Definition: generics.cc:218
static BOOLEAN gIsZero(number a, const coeffs r)
Definition: generics.cc:259
static number gInvers(number a, const coeffs r)
Definition: generics.cc:176
static void gDelete(number *a, const coeffs r)
Definition: generics.cc:369
static int gSize(number a, const coeffs)
Definition: generics.cc:136
static number gSub(number a, number b, const coeffs cf)
Definition: generics.cc:70
static number gDiv(number a, number b, const coeffs cf)
Definition: generics.cc:90
static BOOLEAN gIsOne(number a, const coeffs r)
Definition: generics.cc:271

◆ gInitMPZ()

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

Definition at line 128 of file generics.cc.

129 {
130  gcp cc=(gcp)omalloc(sizeof(*cc));
131  cc->a1=coeffs1->cfInitMPZ(i,coeffs1);
132  cc->a2=coeffs2->cfInitMPZ(i,coeffs2);
133  n_Test((number)cc,cf);
134  return (number)cc;
135 }

◆ gInpNeg()

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

Definition at line 169 of file generics.cc.

170 {
171  gcp aa=(gcp)a;
172  aa->a1=coeffs1->cfInpNeg(aa->a1,coeffs1);
173  aa->a2=coeffs2->cfInpNeg(aa->a2,coeffs2);
174  return (number)aa;
175 }

◆ gInt()

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

Definition at line 147 of file generics.cc.

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

◆ gIntMod()

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

Definition at line 100 of file generics.cc.

101 {
102  gcp aa=(gcp)a;
103  gcp bb=(gcp)b;
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);
107  n_Test((number)cc,cf);
108  return (number)cc;
109 }

◆ gInvers()

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

Definition at line 176 of file generics.cc.

177 {
178  gcp aa=(gcp)a;
179  gcp cc=(gcp)omalloc(sizeof(*cc));
180  cc->a1=coeffs1->cfInvers(aa->a1,coeffs1);
181  cc->a2=coeffs2->cfInvers(aa->a2,coeffs2);
182  return (number)cc;
183 }

◆ gIsMOne()

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

Definition at line 282 of file generics.cc.

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

◆ gIsOne()

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

Definition at line 271 of file generics.cc.

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

◆ gIsUnit()

static BOOLEAN gIsUnit ( number  a,
const  coeffs 
)
static

Definition at line 443 of file generics.cc.

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

◆ gIsZero()

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

Definition at line 259 of file generics.cc.

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

◆ gKillChar()

void gKillChar ( coeffs  r)

Definition at line 49 of file generics.cc.

50 {
51  coeffs1->cfKillChar(coeffs1);
52  coeffs2->cfKillChar(coeffs2);
53 }

◆ gLcm()

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

Definition at line 351 of file generics.cc.

352 {
353  gcp aa=(gcp)a;
354  gcp bb=(gcp)b;
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);
358  return (number)cc;
359 }

◆ gMPZ()

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

Definition at line 158 of file generics.cc.

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

◆ gMult()

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

Definition at line 60 of file generics.cc.

61 {
62  gcp aa=(gcp)a;
63  gcp bb=(gcp)b;
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);
67  n_Test((number)cc,cf);
68  return (number)cc;
69 }

◆ gNormalize()

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

Definition at line 229 of file generics.cc.

230 {
231  gcp aa=(gcp)a;
232  coeffs1->cfNormalize(aa->a1,coeffs1);
233  coeffs2->cfNormalize(aa->a2,coeffs2);
234 }

◆ gNormalizeHelper()

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

Definition at line 360 of file generics.cc.

361 {
362  gcp aa=(gcp)a;
363  gcp bb=(gcp)b;
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);
367  return (number)cc;
368 }

◆ gPower()

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

Definition at line 304 of file generics.cc.

305 {
306  gcp aa=(gcp)a;
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);
310  *result=(number)cc;
311 }

◆ gQuotRem()

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

Definition at line 346 of file generics.cc.

347 {
348  printf("gQuotRem\n");
349  return NULL;
350 }

◆ gRandom()

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

Definition at line 407 of file generics.cc.

408 {
409  printf("gRandom\n");
410  return NULL;
411 }

◆ gRead()

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

Definition at line 218 of file generics.cc.

219 {
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);
225  cc->a2=(number)tt;
226  *a=(number)cc;
227  return ss;
228 }
const CanonicalForm int s
Definition: facAbsFact.cc:55

◆ gReadFd()

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

Definition at line 389 of file generics.cc.

390 {
391  printf("gReadFd\n");
392  return NULL;
393 }

◆ gRePart()

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

Definition at line 192 of file generics.cc.

193 {
194  gcp aa=(gcp)a;
195  gcp cc=(gcp)omalloc(sizeof(*cc));
196  cc->a1=coeffs1->cfRePart(aa->a1,coeffs1);
197  cc->a2=coeffs2->cfRePart(aa->a2,coeffs2);
198  return (number)cc;
199 }

◆ gSetChar()

void gSetChar ( coeffs  r)

Definition at line 54 of file generics.cc.

55 {
56  coeffs1->cfSetChar(coeffs1);
57  coeffs2->cfSetChar(coeffs2);
58 }

◆ gSetMap()

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

Definition at line 380 of file generics.cc.

381 {
382  printf("gSetMap\n");
383  return NULL;
384 }

◆ gSize()

static int gSize ( number  a,
const  coeffs 
)
static

Definition at line 136 of file generics.cc.

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

◆ gSub()

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

Definition at line 70 of file generics.cc.

71 {
72  gcp aa=(gcp)a;
73  gcp bb=(gcp)b;
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);
77  n_Test((number)cc,cf);
78  return (number)cc;
79 }

◆ gSubringGcd()

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

Definition at line 321 of file generics.cc.

322 {
323  gcp aa=(gcp)a;
324  gcp bb=(gcp)b;
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);
328  return (number)cc;
329 }

◆ gWriteFd()

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

Definition at line 385 of file generics.cc.

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

◆ gWriteLong()

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

Definition at line 208 of file generics.cc.

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

◆ gWriteShort()

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

Definition at line 213 of file generics.cc.

214 {
215  gcp aa=(gcp)a;
216  coeffs1->cfWriteShort(aa->a1,coeffs1);
217 }

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.