My Project
Data Structures | Functions | Variables
numbers.cc File Reference
#include <string.h>
#include <stdlib.h>
#include "misc/auxiliary.h"
#include "misc/mylimits.h"
#include "factory/factory.h"
#include "reporter/reporter.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "coeffs/longrat.h"
#include "coeffs/modulop.h"
#include "coeffs/gnumpfl.h"
#include "coeffs/gnumpc.h"
#include "coeffs/ffields.h"
#include "coeffs/shortfl.h"
#include "coeffs/ntupel.h"
#include "coeffs/flintcf_Qrat.h"
#include "coeffs/rmodulo2m.h"
#include "coeffs/rmodulon.h"
#include "coeffs/rintegers.h"
#include "polys/ext_fields/algext.h"
#include "polys/ext_fields/transext.h"

Go to the source code of this file.

Data Structures

struct  nFindCoeffByName_p
 

Functions

static void ndDelete (number *d, const coeffs)
 
static number ndAnn (number, const coeffs cf)
 
static char * ndCoeffString (const coeffs r)
 
static void ndCoeffWrite (const coeffs r, BOOLEAN)
 
static char * ndCoeffName (const coeffs r)
 
static void ndInpMult (number &a, number b, const coeffs r)
 
static void ndInpAdd (number &a, number b, const coeffs r)
 
static void ndPower (number a, int i, number *res, const coeffs r)
 
static number ndInvers (number a, const coeffs r)
 
static number ndInvers_Ring (number a, const coeffs r)
 
static BOOLEAN ndIsUnit_Ring (number a, const coeffs r)
 
static BOOLEAN ndIsUnit_Field (number a, const coeffs r)
 
static number ndGetUnit_Ring (number, const coeffs r)
 
static number ndRandom (siRandProc p, number, number, const coeffs cf)
 
static number ndEucNorm (number a, const coeffs cf)
 
static BOOLEAN ndDBTest (number, const char *, const int, const coeffs)
 
static number ndFarey (number, number, const coeffs r)
 
static number ndXExtGcd (number, number, number *, number *, number *, number *, const coeffs r)
 
static number ndChineseRemainder (number *, number *, int, BOOLEAN, CFArray &, const coeffs r)
 
number ndReadFd (const ssiInfo *, const coeffs r)
 
static void ndWriteFd (number, const ssiInfo *, const coeffs r)
 
static int ndParDeg (number n, const coeffs r)
 
static number ndParameter (const int, const coeffs r)
 
BOOLEAN n_IsZeroDivisor (number a, const coeffs r)
 Test whether a is a zero divisor in r i.e. not coprime with char. of r very inefficient implementation: should ONLY be used for debug stuff /tests. More...
 
void ndNormalize (number &, const coeffs)
 
static number ndReturn0 (number, const coeffs r)
 
number ndGcd (number, number, const coeffs r)
 
static number ndIntMod (number a, number b, const coeffs R)
 
static number ndGetDenom (number &, const coeffs r)
 
static number ndGetNumerator (number &a, const coeffs r)
 
static int ndSize (number a, const coeffs r)
 
static void ndClearContent (ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
 
static void ndClearDenominators (ICoeffsEnumerator &, number &d, const coeffs r)
 
number ndCopyMap (number a, const coeffs aRing, const coeffs r)
 
static void ndKillChar (coeffs)
 
static void ndSetChar (const coeffs)
 
static number ndCopy (number a, const coeffs)
 
number nd_Copy (number a, const coeffs r)
 
static BOOLEAN ndDivBy (number, number, const coeffs)
 
static int ndDivComp (number, number, const coeffs)
 
static number ndExtGcd (number, number, number *, number *, const coeffs r)
 
CanonicalForm ndConvSingNFactoryN (number, BOOLEAN, const coeffs)
 
static number ndConvFactoryNSingN (const CanonicalForm, const coeffs r)
 [in, out] a bigint number >= 0
More...
 
static void ndMPZ (mpz_t result, number &n, const coeffs r)
 Converts a non-negative bigint number into a GMP number. More...
 
static number ndInitMPZ (mpz_t m, const coeffs r)
 
static const char * ndRead (const char *s, number *n, const coeffs r)
 
static nMapFunc ndSetMap (const coeffs src, const coeffs dst)
 
static BOOLEAN ndCoeffIsEqual (const coeffs r, n_coeffType n, void *)
 
number ndQuotRem (number a, number b, number *r, const coeffs R)
 
coeffs nInitChar (n_coeffType t, void *parameter)
 one-time initialisations for new coeffs in case of an error return NULL More...
 
void nKillChar (coeffs r)
 undo all initialisations More...
 
n_coeffType nRegister (n_coeffType n, cfInitCharProc p)
 
void nRegisterCfByName (cfInitCfByNameProc p, n_coeffType n)
 
coeffs nFindCoeffByName (char *cf_name)
 find an existing coeff by its "CoeffName" More...
 
void n_Print (number &a, const coeffs r)
 print a number (BEWARE of string buffers!) mostly for debugging More...
 
char * nEati (char *s, int *i, int m)
 divide by the first (leading) number and return it, i.e. make monic More...
 
char * nEati (char *s, long *i, int m)
 
char * nEatLong (char *s, mpz_ptr i)
 extracts a long integer from s, returns the rest More...
 

Variables

VAR n_Procs_scf_root =NULL
 
STATIC_VAR n_coeffType nLastCoeffs =n_CF
 
VAR cfInitCharProc nInitCharTableDefault []
 
STATIC_VAR cfInitCharProcnInitCharTable =nInitCharTableDefault
 
VAR nFindCoeffByName_p nFindCoeffByName_Root =NULL
 

Data Structure Documentation

◆ nFindCoeffByName_s

struct nFindCoeffByName_s

Definition at line 629 of file numbers.cc.

Data Fields
n_coeffType n
nFindCoeffByName_p next
cfInitCfByNameProc p

Function Documentation

◆ n_IsZeroDivisor()

BOOLEAN n_IsZeroDivisor ( number  a,
const coeffs  r 
)

Test whether a is a zero divisor in r i.e. not coprime with char. of r very inefficient implementation: should ONLY be used for debug stuff /tests.

Definition at line 173 of file numbers.cc.

174{
175 BOOLEAN ret = n_IsZero(a, r);
176 int c = n_GetChar(r);
177 if (ret || (c==0) || (r->is_field))
178 return ret; /*n_IsZero(a, r)*/
179 number ch = n_Init( c, r );
180 number g = n_Gcd( ch, a, r );
181 ret = !n_IsOne (g, r);
182 n_Delete(&ch, r);
183 n_Delete(&g, r);
184 return ret;
185}
int BOOLEAN
Definition: auxiliary.h:87
g
Definition: cfModGcd.cc:4090
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:661
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:461
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:441
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:452
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:535
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:465

◆ n_Print()

void n_Print ( number &  a,
const coeffs  r 
)

print a number (BEWARE of string buffers!) mostly for debugging

Definition at line 668 of file numbers.cc.

670{
671 assume(r != NULL);
672 n_Test(a,r);
673
674 StringSetS("");
675 n_Write(a, r);
676 { char* s = StringEndS(); Print("%s", s); omFree(s); }
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:709
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:588
#define Print
Definition: emacs.cc:80
const CanonicalForm int s
Definition: facAbsFact.cc:51
#define assume(x)
Definition: mod2.h:389
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:12
void StringSetS(const char *st)
Definition: reporter.cc:128
char * StringEndS()
Definition: reporter.cc:151

◆ nd_Copy()

number nd_Copy ( number  a,
const coeffs  r 
)

Definition at line 305 of file numbers.cc.

305{ return r->cfCopy(a, r); }

◆ ndAnn()

static number ndAnn ( number  ,
const coeffs  cf 
)
static

Definition at line 48 of file numbers.cc.

48{ WarnS("cfAnn undefined"); return n_Init(0,cf); }
CanonicalForm cf
Definition: cfModGcd.cc:4083
#define WarnS
Definition: emacs.cc:78

◆ ndChineseRemainder()

static number ndChineseRemainder ( number *  ,
number *  ,
int  ,
BOOLEAN  ,
CFArray ,
const coeffs  r 
)
static

Definition at line 147 of file numbers.cc.

148{
149 Werror("ChineseRemainder not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
150 return r->cfInit(0,r);
151}
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ ndClearContent()

static void ndClearContent ( ICoeffsEnumerator numberCollectionEnumerator,
number &  c,
const coeffs  r 
)
static

TODO: move to a separate implementation

Definition at line 208 of file numbers.cc.

209{
210 assume(r != NULL);
211
212 // no fractions
213 assume(!( nCoeff_is_Q(r) ));
214 // all coeffs are given by integers!!!
215
216 numberCollectionEnumerator.Reset();
217
218 if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial?
219 {
220 c = n_Init(1, r);
221 return;
222 }
223
224 number &curr = numberCollectionEnumerator.Current();
225
226#ifdef HAVE_RINGS
227 /// TODO: move to a separate implementation
228 if (nCoeff_is_Ring(r))
229 {
230 if (nCoeff_has_Units(r))
231 {
232 c = n_GetUnit(curr, r);
233
234 if (!n_IsOne(c, r))
235 {
236 number inv = n_Invers(c, r);
237
238 n_InpMult(curr, inv, r);
239
240 while( numberCollectionEnumerator.MoveNext() )
241 {
242 number &n = numberCollectionEnumerator.Current();
243 n_Normalize(n, r); // ?
244 n_InpMult(n, inv, r); // TODO: either this or directly divide!!!?
245 }
246
247 n_Delete(&inv, r);
248 }
249 } else c = n_Init(1, r);
250
251 return;
252 }
253#endif
254
257
258 n_Normalize(curr, r); // Q: good/bad/ugly??
259
260 if (!n_IsOne(curr, r))
261 {
262 number t = curr; // takes over the curr! note: not a reference!!!
263
264 curr = n_Init(1, r); // ???
265
266 number inv = n_Invers(t, r);
267
268 while( numberCollectionEnumerator.MoveNext() )
269 {
270 number &n = numberCollectionEnumerator.Current();
271 n_InpMult(n, inv, r); // TODO: either this or directly divide!!!?
272// n_Normalize(n, r); // ?
273 }
274
275 n_Delete(&inv, r);
276
277 c = t;
278 } else
279 c = n_Copy(curr, r); // c == 1 and nothing else to do...
280}
virtual reference Current()=0
Gets the current element in the collection (read and write).
virtual void Reset()=0
Sets the enumerator to its initial position: -1, which is before the first element in the collection.
virtual bool MoveNext()=0
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
Definition: coeffs.h:794
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:836
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:561
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
Definition: coeffs.h:829
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
Definition: coeffs.h:856
static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r)
is it an alg. ext. of Q?
Definition: coeffs.h:911
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:803
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition: coeffs.h:529
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition: coeffs.h:727
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:797
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
Definition: coeffs.h:638
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:575

◆ ndClearDenominators()

static void ndClearDenominators ( ICoeffsEnumerator ,
number &  d,
const coeffs  r 
)
static

Definition at line 282 of file numbers.cc.

283{
284 assume( r != NULL );
287
288 d = n_Init(1, r);
289}
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:907
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:915

◆ ndCoeffIsEqual()

static BOOLEAN ndCoeffIsEqual ( const coeffs  r,
n_coeffType  n,
void *   
)
static

Definition at line 351 of file numbers.cc.

353{
354 /* test, if r is an instance of nInitCoeffs(n,parameter) */
355 /* if parameter is not needed */
356 return (n==r->type);

◆ ndCoeffName()

static char * ndCoeffName ( const coeffs  r)
static

Definition at line 57 of file numbers.cc.

58{
59 STATIC_VAR char s[20];
60 snprintf(s,11,"Coeffs(%d)",r->type);
61 return s;
62}
#define STATIC_VAR
Definition: globaldefs.h:7

◆ ndCoeffString()

static char * ndCoeffString ( const coeffs  r)
static

Definition at line 49 of file numbers.cc.

50{
51 return omStrDup(r->cfCoeffName(r));
52}
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ndCoeffWrite()

static void ndCoeffWrite ( const coeffs  r,
BOOLEAN   
)
static

Definition at line 53 of file numbers.cc.

54{
55 PrintS(r->cfCoeffName(r));
56}
void PrintS(const char *s)
Definition: reporter.cc:284

◆ ndConvFactoryNSingN()

static number ndConvFactoryNSingN ( const  CanonicalForm,
const coeffs  r 
)
static

[in, out] a bigint number >= 0

[out] the GMP equivalent

Definition at line 320 of file numbers.cc.

◆ ndConvSingNFactoryN()

CanonicalForm ndConvSingNFactoryN ( number  ,
BOOLEAN  ,
const  coeffs 
)

Definition at line 313 of file numbers.cc.

314{
316 WerrorS("no conversion to factory");
317 return term;
318}
factory's main class
Definition: canonicalform.h:86
Definition: int_poly.h:33
void WerrorS(const char *s)
Definition: feFopen.cc:24

◆ ndCopy()

static number ndCopy ( number  a,
const  coeffs 
)
static

Definition at line 304 of file numbers.cc.

304{ return a; }

◆ ndCopyMap()

number ndCopyMap ( number  a,
const coeffs  aRing,
const coeffs  r 
)

Definition at line 291 of file numbers.cc.

292{
293 // aRing and r need not be the same, but must be the same representation
294 assume(aRing->rep==r->rep);
296 return a;
297 else
298 return r->cfCopy(a, r);
299}
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete is empty operation.
Definition: coeffs.h:903

◆ ndDBTest()

static BOOLEAN ndDBTest ( number  ,
const char *  ,
const int  ,
const  coeffs 
)
static

Definition at line 134 of file numbers.cc.

134{ return TRUE; }
#define TRUE
Definition: auxiliary.h:100

◆ ndDelete()

static void ndDelete ( number *  d,
const  coeffs 
)
static

Definition at line 47 of file numbers.cc.

47{ *d=NULL; }

◆ ndDivBy()

static BOOLEAN ndDivBy ( number  ,
number  ,
const  coeffs 
)
static

Definition at line 308 of file numbers.cc.

308{ return TRUE; } // assume a,b !=0

◆ ndDivComp()

static int ndDivComp ( number  ,
number  ,
const  coeffs 
)
static

Definition at line 309 of file numbers.cc.

309{ return 2; }

◆ ndEucNorm()

static number ndEucNorm ( number  a,
const coeffs  cf 
)
static

Definition at line 130 of file numbers.cc.

131{ return cf->cfInit(cf->cfSize(a,cf),cf); }

◆ ndExtGcd()

static number ndExtGcd ( number  ,
number  ,
number *  ,
number *  ,
const coeffs  r 
)
static

Definition at line 310 of file numbers.cc.

310{ return r->cfInit(1,r); }

◆ ndFarey()

static number ndFarey ( number  ,
number  ,
const coeffs  r 
)
static

Definition at line 137 of file numbers.cc.

138{
139 Werror("farey not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
140 return n_Init(0,r);
141}

◆ ndGcd()

number ndGcd ( number  a,
number  b,
const coeffs  r 
)

Definition at line 189 of file numbers.cc.

189{ return r->cfInit(1,r); }

◆ ndGetDenom()

static number ndGetDenom ( number &  ,
const coeffs  r 
)
static

Definition at line 204 of file numbers.cc.

204{ return r->cfInit(1,r); }

◆ ndGetNumerator()

static number ndGetNumerator ( number &  a,
const coeffs  r 
)
static

Definition at line 205 of file numbers.cc.

205{ return r->cfCopy(a,r); }

◆ ndGetUnit_Ring()

static number ndGetUnit_Ring ( number  ,
const coeffs  r 
)
static

Definition at line 126 of file numbers.cc.

127{ return r->cfInit(1,r); }

◆ ndInitMPZ()

static number ndInitMPZ ( mpz_t  m,
const coeffs  r 
)
static

Definition at line 333 of file numbers.cc.

335{
336 return r->cfInit( mpz_get_si(m), r);
int m
Definition: cfEzgcd.cc:128

◆ ndInpAdd()

static void ndInpAdd ( number &  a,
number  b,
const coeffs  r 
)
static

Definition at line 69 of file numbers.cc.

70{
71 number n=r->cfAdd(a,b,r);
72 r->cfDelete(&a,r);
73 a=n;
74}
CanonicalForm b
Definition: cfModGcd.cc:4103

◆ ndInpMult()

static void ndInpMult ( number &  a,
number  b,
const coeffs  r 
)
static

Definition at line 63 of file numbers.cc.

64{
65 number n=r->cfMult(a,b,r);
66 r->cfDelete(&a,r);
67 a=n;
68}

◆ ndIntMod()

static number ndIntMod ( number  a,
number  b,
const coeffs  R 
)
static

Definition at line 190 of file numbers.cc.

191{
192 if (R->is_field)
193 return R->cfInit(0,R);
194 else // implementation for a non-field:
195 {
196 number d=n_Div(a,b,R);
197 number p=n_Mult(b,d,R);
198 number r=n_Sub(a,p,R);
199 n_Delete(&p,R);
200 n_Delete(&d,R);
201 return r;
202 }
203}
int p
Definition: cfModGcd.cc:4078
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:612
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:652
#define R
Definition: sirandom.c:27

◆ ndInvers()

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

Definition at line 106 of file numbers.cc.

107{
108 number one=r->cfInit(1,r);
109 number res=r->cfDiv(one,a,r);
110 r->cfDelete(&one,r);
111 return res;
112}
CanonicalForm res
Definition: facAbsFact.cc:60

◆ ndInvers_Ring()

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

Definition at line 113 of file numbers.cc.

114{
115 if (!r->cfIsUnit(a,r)) Print("ndInvers_Ring used with non-unit\n");
116 number one=r->cfInit(1,r);
117 number res=r->cfDiv(one,a,r);
118 r->cfDelete(&one,r);
119 return res;
120}

◆ ndIsUnit_Field()

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

Definition at line 124 of file numbers.cc.

125{ return !r->cfIsZero(a,r); }

◆ ndIsUnit_Ring()

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

Definition at line 122 of file numbers.cc.

123{ return r->cfIsOne(a,r)|| r->cfIsMOne(a,r); }

◆ ndKillChar()

static void ndKillChar ( coeffs  )
static

Definition at line 301 of file numbers.cc.

301{}

◆ ndMPZ()

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

Converts a non-negative bigint number into a GMP number.

Definition at line 328 of file numbers.cc.

330{
331 mpz_init_set_si( result, r->cfInt(n, r) );
return result
Definition: facAbsBiFact.cc:76

◆ ndNormalize()

void ndNormalize ( number &  ,
const  coeffs 
)

Definition at line 187 of file numbers.cc.

187{ }

◆ ndParameter()

static number ndParameter ( const int  ,
const coeffs  r 
)
static

Definition at line 168 of file numbers.cc.

169{
170 return r->cfInit(1,r);
171}

◆ ndParDeg()

static int ndParDeg ( number  n,
const coeffs  r 
)
static

Definition at line 163 of file numbers.cc.

164{
165 return (-r->cfIsZero(n,r));
166}

◆ ndPower()

static void ndPower ( number  a,
int  i,
number *  res,
const coeffs  r 
)
static

Definition at line 76 of file numbers.cc.

77{
78 if (i==0)
79 {
80 *res = r->cfInit(1, r);
81 }
82 else if (i==1)
83 {
84 *res = r->cfCopy(a, r);
85 }
86 else if (i==2)
87 {
88 *res = r->cfMult(a, a, r);
89 }
90 else if (i<0)
91 {
92 number b = r->cfInvers(a, r);
93 ndPower(b, -i, res, r);
94 r->cfDelete(&b, r);
95 }
96 else
97 {
98 ndPower(a, i/2, res, r);
99 r->cfInpMult(*res, *res, r);
100 if (i&1)
101 {
102 r->cfInpMult(*res, a, r);
103 }
104 }
105}
int i
Definition: cfEzgcd.cc:132
static void ndPower(number a, int i, number *res, const coeffs r)
Definition: numbers.cc:76

◆ ndQuotRem()

number ndQuotRem ( number  a,
number  b,
number *  r,
const coeffs  R 
)

Definition at line 358 of file numbers.cc.

360{
361 // implementation for a field: r: 0, result: n_Div
362 if(R->is_field)
363 {
364 *r=n_Init(0,R);
365 return n_Div(a,b,R);
366 }
367 else
368 // implementation for a non-field:
369 {
370 number d=n_Div(a,b,R);
371 number p=n_Mult(b,d,R);
372 *r=n_Sub(a,p,R);
373 n_Delete(&p,R);
374 return d;
375 }

◆ ndRandom()

static number ndRandom ( siRandProc  p,
number  ,
number  ,
const coeffs  cf 
)
static

Definition at line 128 of file numbers.cc.

129{ return cf->cfInit(p(),cf); }

◆ ndRead()

static const char * ndRead ( const char *  s,
number *  n,
const coeffs  r 
)
static

Definition at line 338 of file numbers.cc.

340{
341 Werror("cfRead is undefined for %s",nCoeffString(r));
342 *n=n_Init(0,r);
343 return s;
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: coeffs.h:956

◆ ndReadFd()

number ndReadFd ( const ssiInfo f,
const coeffs  r 
)

Definition at line 152 of file numbers.cc.

153{
154 Warn("ReadFd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
155 return n_Init(0,r);
156}
#define Warn
Definition: emacs.cc:77

◆ ndReturn0()

static number ndReturn0 ( number  ,
const coeffs  r 
)
static

Definition at line 188 of file numbers.cc.

188{ return r->cfInit(0,r); }

◆ ndSetChar()

static void ndSetChar ( const  coeffs)
static

Definition at line 302 of file numbers.cc.

302{}

◆ ndSetMap()

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

Definition at line 344 of file numbers.cc.

346{
347 if (src==dst) return ndCopyMap;
348 Werror("cfSetMap is undefined for %s",nCoeffString(dst));
349 return ndCopyMap;
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:291

◆ ndSize()

static int ndSize ( number  a,
const coeffs  r 
)
static

Definition at line 206 of file numbers.cc.

206{ return (int)r->cfIsZero(a,r)==FALSE; }
#define FALSE
Definition: auxiliary.h:96

◆ ndWriteFd()

static void ndWriteFd ( number  ,
const ssiInfo ,
const coeffs  r 
)
static

Definition at line 158 of file numbers.cc.

159{
160 Warn("WriteFd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
161}

◆ ndXExtGcd()

static number ndXExtGcd ( number  ,
number  ,
number *  ,
number *  ,
number *  ,
number *  ,
const coeffs  r 
)
static

Definition at line 142 of file numbers.cc.

143{
144 Werror("XExtGcd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
145 return n_Init(0,r);
146}

◆ nEati() [1/2]

char * nEati ( char *  s,
int *  i,
int  m 
)

divide by the first (leading) number and return it, i.e. make monic

does nothing (just returns a dummy one number) helper routine: read an int from a string (mod m), return a pointer to the rest

Definition at line 678 of file numbers.cc.

680{
681
682 if (((*s) >= '0') && ((*s) <= '9'))
683 {
684 unsigned long ii=0L;
685 do
686 {
687 ii *= 10;
688 ii += *s++ - '0';
689 if ((m!=0) && (ii > (MAX_INT_VAL / 10))) ii = ii % m;
690 }
691 while (((*s) >= '0') && ((*s) <= '9'));
692 if ((m!=0) && (ii>=(unsigned)m)) ii=ii%m;
693 *i=(int)ii;
694 }
695 else (*i) = 1;
696 return s;
const int MAX_INT_VAL
Definition: mylimits.h:12

◆ nEati() [2/2]

char * nEati ( char *  s,
long *  i,
int  m 
)

Definition at line 698 of file numbers.cc.

700{
701
702 if (((*s) >= '0') && ((*s) <= '9'))
703 {
704 unsigned long ii=0L;
705 do
706 {
707 ii *= 10;
708 ii += *s++ - '0';
709 if ((m!=0) && (ii > (LONG_MAX / 10))) ii = ii % m;
710 }
711 while (((*s) >= '0') && ((*s) <= '9'));
712 if ((m!=0) && (ii>=(long)m)) ii=ii%m;
713 *i=ii;
714 }
715 else (*i) = 1;
716 return s;

◆ nEatLong()

char * nEatLong ( char *  s,
mpz_ptr  i 
)

extracts a long integer from s, returns the rest

Definition at line 719 of file numbers.cc.

721{
722 const char * start=s;
723
724 while (*s >= '0' && *s <= '9') s++;
725 if (*s=='\0')
726 {
727 mpz_set_str(i,start,10);
728 }
729 else
730 {
731 char c=*s;
732 *s='\0';
733 mpz_set_str(i,start,10);
734 *s=c;
735 }
736 return s;

◆ nFindCoeffByName()

coeffs nFindCoeffByName ( char *  cf_name)

find an existing coeff by its "CoeffName"

Definition at line 646 of file numbers.cc.

648{
650 // try existings coeffs:
651 while(n!=NULL)
652 {
653 if ((n->cfCoeffName!=NULL)
654 && (strcmp(cf_name,n->cfCoeffName(n))==0)) return n;
655 n=n->next;
656 }
657 // TODO: parametrized cf, e.g. flint:Z/26[a]
658 // try existing types:
659 nFindCoeffByName_p p=nFindCoeffByName_Root;
660 while(p!=NULL)
661 {
662 coeffs cf=p->p(cf_name,p->n);
663 if (cf!=NULL) return cf;
664 p=p->next;
665 }
666 return NULL;
The main handler for Singular numbers which are suitable for Singular polynomials.
VAR nFindCoeffByName_p nFindCoeffByName_Root
Definition: numbers.cc:636
VAR n_Procs_s * cf_root
Definition: numbers.cc:45
coeffs next
Definition: coeffs.h:125
char *(* cfCoeffName)(const coeffs r)
default name of cf, should substitue cfCoeffWrite, cfCoeffString
Definition: coeffs.h:154

◆ nInitChar()

coeffs nInitChar ( n_coeffType  t,
void *  parameter 
)

one-time initialisations for new coeffs in case of an error return NULL

Definition at line 414 of file numbers.cc.

416{
418
419 while((n!=NULL) && (n->nCoeffIsEqual!=NULL) && (!n->nCoeffIsEqual(n,t,parameter)))
420 n=n->next;
421
422 if (n==NULL)
423 {
424 n=(n_Procs_s*)omAlloc0(sizeof(n_Procs_s));
425 n->next=cf_root;
426 n->ref=1;
427 n->type=t;
428
429 // default entries (different from NULL) for some routines:
431 n->cfSize = ndSize;
435 n->cfDelete= ndDelete;
436 n->cfAnn = ndAnn;
439 n->cfCoeffName = ndCoeffName; // should alway be changed!
442 n->cfCopy = ndCopy;
443 n->cfIntMod=ndIntMod; /* dummy !! */
445 n->cfGcd = ndGcd;
446 n->cfNormalizeHelper = ndGcd; /* tricky, isn't it ?*/
447 n->cfLcm = ndGcd; /* tricky, isn't it ?*/
448 n->cfInitMPZ = ndInitMPZ;
449 n->cfMPZ = ndMPZ;
450 n->cfPower = ndPower;
451 n->cfQuotRem = ndQuotRem;
452 n->cfInvers = ndInvers;
453 n->cfRandom = ndRandom;
454
455 n->cfKillChar = ndKillChar; /* dummy */
456 n->cfSetChar = ndSetChar; /* dummy */
457 // temp. removed to catch all the coeffs which miss to implement this!
458
459 n->cfChineseRemainder = ndChineseRemainder; /* not implemented */
460 n->cfFarey = ndFarey; /* not implemented */
461 n->cfParDeg = ndParDeg; /* not implemented */
462 n->cfReadFd = ndReadFd; /* not implemented */
463 n->cfWriteFd = ndWriteFd; /* not implemented */
464
466
469
470 n->cfEucNorm = ndEucNorm;
471#ifdef HAVE_RINGS
472 n->cfDivComp = ndDivComp;
473 n->cfDivBy = ndDivBy;
474 n->cfExtGcd = ndExtGcd;
475 n->cfXExtGcd = ndXExtGcd;
476 //n->cfGetUnit = ndGetUnit_Ring;// set afterwards
477#endif
478
479 // report error, if not redefined
480 n->cfRead=ndRead;
482
483#ifdef LDEBUG
485#endif
486
489
490 BOOLEAN nOK=TRUE;
491 // init
492 if ((t<=nLastCoeffs) && (nInitCharTable[t]!=NULL))
493 nOK = (nInitCharTable[t])(n,parameter);
494 else
495 Werror("Sorry: the coeff type [%d] was not registered: it is missing in nInitCharTable", (int)t);
496 if (nOK)
497 {
498 omFreeSize(n,sizeof(*n));
499 return NULL;
500 }
501 cf_root=n;
502 // post init settings:
503 if (n->cfRePart==NULL) n->cfRePart=n->cfCopy;
504 if (n->cfExactDiv==NULL) n->cfExactDiv=n->cfDiv;
505 if (n->cfSubringGcd==NULL) n->cfSubringGcd=n->cfGcd;
506 if (n->cfWriteShort==NULL) n->cfWriteShort = n->cfWriteLong;
507 if (n->cfIsUnit==NULL)
508 {
510 else n->cfIsUnit=ndIsUnit_Ring;
511 }
512 #ifdef HAVE_RINGS
513 if (n->cfGetUnit==NULL)
514 {
515 if (n->is_field) n->cfGetUnit=n->cfCopy;
517 }
518 if ((n->cfInvers==ndInvers)&&(n->is_field))
519 {
521 }
522 #endif
523
524
525 if(n->cfMult==NULL) PrintS("cfMult missing\n");
526 if(n->cfSub==NULL) PrintS("cfSub missing\n");
527 if(n->cfAdd==NULL) PrintS("cfAdd missing\n");
528 if(n->cfDiv==NULL) PrintS("cfDiv missing\n");
529 if(n->cfExactDiv==NULL) PrintS("cfExactDiv missing\n");
530 if(n->cfInit==NULL) PrintS("cfInit missing\n");
531 if(n->cfInt==NULL) PrintS("cfInt missing\n");
532 if(n->cfIsUnit==NULL) PrintS("cfIsUnit missing\n");
533 if(n->cfGetUnit==NULL) PrintS("cfGetUnit missing\n");
534 if(n->cfInpNeg==NULL) PrintS("cfInpNeg missing\n");
535 if(n->cfXExtGcd==NULL) PrintS("cfXExtGcd missing\n");
536 if(n->cfAnn==NULL) PrintS("cfAnn missing\n");
537 if(n->cfWriteLong==NULL) PrintS("cfWriteLong missing\n");
538
540
541 assume( (n->iNumberOfParameters == 0 && n->pParameterNames == NULL) ||
542 (n->iNumberOfParameters > 0 && n->pParameterNames != NULL) );
543
544
545 if(n->cfGreater==NULL) PrintS("cfGreater missing\n");
546 if(n->cfEqual==NULL) PrintS("cfEqual missing\n");
547 if(n->cfIsZero==NULL) PrintS("cfIsZero missing\n");
548 if(n->cfIsOne==NULL) PrintS("cfIsOne missing\n");
549 if(n->cfIsMOne==NULL) PrintS("cfIsMOne missing\n");
550 if(n->cfGreaterZero==NULL) PrintS("cfGreaterZero missing\n");
551 /* error reporter:
552 if(n->cfRead==ndRead) PrintS("cfRead missing\n");
553 if(n->cfSetMap==ndSetMap) PrintS("cfSetMap missing\n");
554 */
555
556 assume(n->type==t);
557
558#ifndef SING_NDEBUG
559 if(n->cfWriteLong==NULL) Warn("cfWrite is NULL for coeff %d",t);
560 if(n->cfWriteShort==NULL) Warn("cfWriteShort is NULL for coeff %d",t);
561#endif
562 }
563 else
564 {
565 n->ref++;
566 }
567 return n;
static BOOLEAN ndIsUnit_Field(number a, const coeffs r)
Definition: numbers.cc:124
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:313
number ndReadFd(const ssiInfo *, const coeffs r)
Definition: numbers.cc:152
static int ndDivComp(number, number, const coeffs)
Definition: numbers.cc:309
static number ndEucNorm(number a, const coeffs cf)
Definition: numbers.cc:130
static number ndGetUnit_Ring(number, const coeffs r)
Definition: numbers.cc:126
static BOOLEAN ndDBTest(number, const char *, const int, const coeffs)
Definition: numbers.cc:134
number ndGcd(number, number, const coeffs r)
Definition: numbers.cc:189
static void ndKillChar(coeffs)
Definition: numbers.cc:301
static void ndClearDenominators(ICoeffsEnumerator &, number &d, const coeffs r)
Definition: numbers.cc:282
static void ndClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Definition: numbers.cc:208
static int ndParDeg(number n, const coeffs r)
Definition: numbers.cc:163
static BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *)
Definition: numbers.cc:351
static BOOLEAN ndIsUnit_Ring(number a, const coeffs r)
Definition: numbers.cc:122
void ndNormalize(number &, const coeffs)
Definition: numbers.cc:187
static int ndSize(number a, const coeffs r)
Definition: numbers.cc:206
static number ndFarey(number, number, const coeffs r)
Definition: numbers.cc:137
static number ndRandom(siRandProc p, number, number, const coeffs cf)
Definition: numbers.cc:128
static void ndMPZ(mpz_t result, number &n, const coeffs r)
Converts a non-negative bigint number into a GMP number.
Definition: numbers.cc:328
STATIC_VAR n_coeffType nLastCoeffs
Definition: numbers.cc:376
static number ndGetDenom(number &, const coeffs r)
Definition: numbers.cc:204
static void ndDelete(number *d, const coeffs)
Definition: numbers.cc:47
STATIC_VAR cfInitCharProc * nInitCharTable
Definition: numbers.cc:410
static number ndInvers_Ring(number a, const coeffs r)
Definition: numbers.cc:113
static number ndParameter(const int, const coeffs r)
Definition: numbers.cc:168
static number ndCopy(number a, const coeffs)
Definition: numbers.cc:304
static void ndInpMult(number &a, number b, const coeffs r)
Definition: numbers.cc:63
static void ndWriteFd(number, const ssiInfo *, const coeffs r)
Definition: numbers.cc:158
static number ndChineseRemainder(number *, number *, int, BOOLEAN, CFArray &, const coeffs r)
Definition: numbers.cc:147
static char * ndCoeffString(const coeffs r)
Definition: numbers.cc:49
static number ndGetNumerator(number &a, const coeffs r)
Definition: numbers.cc:205
static BOOLEAN ndDivBy(number, number, const coeffs)
Definition: numbers.cc:308
static number ndInitMPZ(mpz_t m, const coeffs r)
Definition: numbers.cc:333
static void ndInpAdd(number &a, number b, const coeffs r)
Definition: numbers.cc:69
static nMapFunc ndSetMap(const coeffs src, const coeffs dst)
Definition: numbers.cc:344
static number ndAnn(number, const coeffs cf)
Definition: numbers.cc:48
static number ndInvers(number a, const coeffs r)
Definition: numbers.cc:106
static number ndIntMod(number a, number b, const coeffs R)
Definition: numbers.cc:190
static void ndCoeffWrite(const coeffs r, BOOLEAN)
Definition: numbers.cc:53
static number ndConvFactoryNSingN(const CanonicalForm, const coeffs r)
[in, out] a bigint number >= 0
Definition: numbers.cc:320
static number ndReturn0(number, const coeffs r)
Definition: numbers.cc:188
static number ndExtGcd(number, number, number *, number *, const coeffs r)
Definition: numbers.cc:310
static const char * ndRead(const char *s, number *n, const coeffs r)
Definition: numbers.cc:338
static char * ndCoeffName(const coeffs r)
Definition: numbers.cc:57
static void ndSetChar(const coeffs)
Definition: numbers.cc:302
static number ndXExtGcd(number, number, number *, number *, number *, number *, const coeffs r)
Definition: numbers.cc:142
number ndQuotRem(number a, number b, number *r, const coeffs R)
Definition: numbers.cc:358
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc0(size)
Definition: omAllocDecl.h:211
BOOLEAN(* cfIsUnit)(number a, const coeffs r)
Definition: coeffs.h:378
number(* cfChineseRemainder)(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
chinese remainder returns X with X mod q[i]=x[i], i=0..rl-1
Definition: coeffs.h:297
number(* cfNormalizeHelper)(number a, number b, const coeffs r)
Definition: coeffs.h:271
int(* cfDivComp)(number a, number b, const coeffs r)
Definition: coeffs.h:377
BOOLEAN(*)(*)(*)(*)(*)(*) cfGreaterZero(number a, const coeffs r)
Definition: coeffs.h:237
number(* cfExtGcd)(number a, number b, number *s, number *t, const coeffs r)
Definition: coeffs.h:248
number(* cfGetUnit)(number a, const coeffs r)
Definition: coeffs.h:379
number(* cfLcm)(number a, number b, const coeffs r)
Definition: coeffs.h:270
number(* cfGetNumerator)(number &n, const coeffs r)
Definition: coeffs.h:241
number(* cfInvers)(number a, const coeffs r)
return 1/a
Definition: coeffs.h:197
number(* cfInit)(long i, const coeffs r)
init with an integer
Definition: coeffs.h:178
int iNumberOfParameters
Number of Parameters in the coeffs (default 0)
Definition: coeffs.h:319
number(* cfInpNeg)(number a, const coeffs r)
changes argument inline: a:= -a return -a! (no copy is returned) the result should be assigned to the...
Definition: coeffs.h:195
number(* cfInitMPZ)(mpz_t i, const coeffs r)
init with a GMP integer
Definition: coeffs.h:181
BOOLEAN is_field
TRUE, if cf is a field.
Definition: coeffs.h:140
nMapFunc(* cfSetMap)(const coeffs src, const coeffs dst)
Definition: coeffs.h:275
number(* cfParameter)(const int i, const coeffs r)
create i^th parameter or NULL if not possible
Definition: coeffs.h:303
void(* cfSetChar)(const coeffs r)
Definition: coeffs.h:161
number(* convFactoryNSingN)(const CanonicalForm n, const coeffs r)
conversion to CanonicalForm(factory) to number
Definition: coeffs.h:315
number(* cfGcd)(number a, number b, const coeffs r)
Definition: coeffs.h:246
number(* cfImPart)(number a, const coeffs r)
Definition: coeffs.h:201
number(* cfFarey)(number p, number n, const coeffs)
rational reconstruction: "best" rational a/b with a/b = p mod n
Definition: coeffs.h:291
number(* cfCopy)(number a, const coeffs r)
return a copy of a
Definition: coeffs.h:199
int ref
Definition: coeffs.h:126
BOOLEAN(*)(*)(*) cfIsZero(number a, const coeffs r)
Definition: coeffs.h:228
void(* cfKillChar)(coeffs r)
Definition: coeffs.h:159
BOOLEAN(*)(*) cfEqual(number a, number b, const coeffs r)
tests
Definition: coeffs.h:227
numberfunc cfIntMod
Definition: coeffs.h:175
numberfunc cfExactDiv
Definition: coeffs.h:175
void(* cfMPZ)(mpz_t result, number &n, const coeffs r)
Converts a (integer) number n into a GMP number, 0 if impossible.
Definition: coeffs.h:190
BOOLEAN(* nCoeffIsEqual)(const coeffs r, n_coeffType n, void *parameter)
Definition: coeffs.h:145
number(* cfXExtGcd)(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
Definition: coeffs.h:256
void(* cfWriteShort)(number a, const coeffs r)
print a given number in a shorter way, if possible e.g. in K(a): a2 instead of a^2
Definition: coeffs.h:208
number(* cfRePart)(number a, const coeffs r)
Definition: coeffs.h:200
void(* cfNormalize)(number &a, const coeffs r)
Definition: coeffs.h:223
numberfunc cfMult
Definition: coeffs.h:175
number(* cfGetDenom)(number &n, const coeffs r)
Definition: coeffs.h:240
void(* cfWriteLong)(number a, const coeffs r)
print a given number (long format)
Definition: coeffs.h:204
number(* cfSubringGcd)(number a, number b, const coeffs r)
Definition: coeffs.h:247
BOOLEAN(*)(*)(*)(*) cfIsOne(number a, const coeffs r)
Definition: coeffs.h:229
number(* cfEucNorm)(number a, const coeffs r)
Definition: coeffs.h:258
number(* cfAnn)(number a, const coeffs r)
Definition: coeffs.h:261
char *(* cfCoeffString)(const coeffs r)
string output of coeff description
Definition: coeffs.h:151
number(* cfReadFd)(const ssiInfo *f, const coeffs r)
Definition: coeffs.h:278
void(* cfPower)(number a, int i, number *result, const coeffs r)
Definition: coeffs.h:239
CanonicalForm(* convSingNFactoryN)(number n, BOOLEAN setChar, const coeffs r)
Definition: coeffs.h:316
long(* cfInt)(number &n, const coeffs r)
convertion to long, 0 if impossible
Definition: coeffs.h:187
BOOLEAN(* cfGreater)(number a, number b, const coeffs r)
Definition: coeffs.h:225
number(* cfQuotRem)(number a, number b, number *rem, const coeffs r)
Definition: coeffs.h:269
void(* cfCoeffWrite)(const coeffs r, BOOLEAN details)
output of coeff description via Print
Definition: coeffs.h:148
void(* cfDelete)(number *a, const coeffs r)
Definition: coeffs.h:272
numberfunc cfSub
Definition: coeffs.h:175
BOOLEAN(* cfDBTest)(number a, const char *f, const int l, const coeffs r)
Test: is "a" a correct number?
Definition: coeffs.h:416
void(* cfWriteFd)(number a, const ssiInfo *f, const coeffs r)
Definition: coeffs.h:277
n_coeffType type
Definition: coeffs.h:128
numberfunc cfAdd
Definition: coeffs.h:175
number(* cfRandom)(siRandProc p, number p1, number p2, const coeffs cf)
a function returning random elements
Definition: coeffs.h:306
BOOLEAN(*)(*)(*)(*)(*) cfIsMOne(number a, const coeffs r)
Definition: coeffs.h:232
numberfunc cfDiv
Definition: coeffs.h:175
char const ** pParameterNames
array containing the names of Parameters (default NULL)
Definition: coeffs.h:322
int(* cfParDeg)(number x, const coeffs r)
degree for coeffcients: -1 for 0, 0 for "constants", ...
Definition: coeffs.h:300
void(* cfInpMult)(number &a, number b, const coeffs r)
Inplace: a *= b.
Definition: coeffs.h:281
int(* cfSize)(number n, const coeffs r)
how complicated, (0) => 0, or positive
Definition: coeffs.h:184
void(* cfInpAdd)(number &a, number b, const coeffs r)
Inplace: a += b.
Definition: coeffs.h:284
BOOLEAN(* cfDivBy)(number a, number b, const coeffs r)
test if b divides a cfDivBy(zero,b,r) is true, if b is a zero divisor
Definition: coeffs.h:382
nCoeffsEnumeratorFunc cfClearContent
function pointer behind n_ClearContent
Definition: coeffs.h:309
nCoeffsEnumeratorFunc cfClearDenominators
function pointer behind n_ClearDenominators
Definition: coeffs.h:312
const char *(* cfRead)(const char *s, number *a, const coeffs r)
Definition: coeffs.h:221

◆ nKillChar()

void nKillChar ( coeffs  r)

undo all initialisations

Definition at line 569 of file numbers.cc.

571{
572 if (r!=NULL)
573 {
574 r->ref--;
575 if (r->ref<=0)
576 {
577 n_Procs_s tmp;
578 n_Procs_s* n=&tmp;
579 tmp.next=cf_root;
580 while((n->next!=NULL) && (n->next!=r)) n=n->next;
581 if (n->next==r)
582 {
583 n->next=n->next->next;
584 if (cf_root==r) cf_root=n->next;
585 assume (r->cfKillChar!=NULL); r->cfKillChar(r);
586 omFreeSize((void *)r, sizeof(n_Procs_s));
587 r=NULL;
588 }
589 else
590 {
591 WarnS("cf_root list destroyed");
592 }
593 }
594 }

◆ nRegister()

n_coeffType nRegister ( n_coeffType  n,
cfInitCharProc  p 
)

Definition at line 596 of file numbers.cc.

598{
599 if (n==n_unknown)
600 {
603 {
605 ((int)nLastCoeffs+1)*sizeof(cfInitCharProc));
607 ((int)nLastCoeffs)*sizeof(cfInitCharProc));
608 }
609 else
610 {
612 ((int)nLastCoeffs)*sizeof(cfInitCharProc),
613 (((int)nLastCoeffs)+1)*sizeof(cfInitCharProc));
614 }
615
617 return nLastCoeffs;
618 }
619 else
620 {
621 if (nInitCharTable[n]!=NULL) Print("coeff %d already initialized\n",n);
622 nInitCharTable[n]=p;
623 return n;
624 }
n_coeffType
Definition: coeffs.h:27
@ n_unknown
Definition: coeffs.h:28
VAR cfInitCharProc nInitCharTableDefault[]
Definition: numbers.cc:377
BOOLEAN(* cfInitCharProc)(coeffs, void *)
initialize an object of type coeff, return FALSE in case of success
Definition: numbers.h:95
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220

◆ nRegisterCfByName()

void nRegisterCfByName ( cfInitCfByNameProc  p,
n_coeffType  n 
)

Definition at line 637 of file numbers.cc.

639{
640 nFindCoeffByName_p h=(nFindCoeffByName_p)omAlloc0(sizeof(*h));
641 h->p=p;
642 h->n=n;
STATIC_VAR Poly * h
Definition: janet.cc:971

Variable Documentation

◆ cf_root

VAR n_Procs_s* cf_root =NULL

Definition at line 45 of file numbers.cc.

◆ nFindCoeffByName_Root

VAR nFindCoeffByName_p nFindCoeffByName_Root =NULL

Definition at line 636 of file numbers.cc.

◆ nInitCharTable

Definition at line 410 of file numbers.cc.

◆ nInitCharTableDefault

VAR cfInitCharProc nInitCharTableDefault[]

Definition at line 377 of file numbers.cc.

◆ nLastCoeffs

STATIC_VAR n_coeffType nLastCoeffs =n_CF

Definition at line 376 of file numbers.cc.