10#include "factory/factory.h"
28#if defined(DO_LINLINE) && defined(P_NUMBERS_H) && !defined(LDEBUG)
29#define LINLINE static FORCE_INLINE
72const char *
nlRead (
const char *
s, number *a,
const coeffs r);
87#define nlTest(a, r) nlDBTest(a,__FILE__,__LINE__, r)
90#define nlTest(a, r) do {} while (0)
97#define MAX_NUM_SIZE 60
98#define POW_2_28 (1L<<60)
99#define POW_2_28_32 (1L<<28)
102#define MAX_NUM_SIZE 28
103#define POW_2_28 (1L<<28)
104#define POW_2_28_32 (1L<<28)
120 LONG ui=mpz_get_si(
x->z);
121 if ((((ui<<3)>>3)==ui)
122 && (mpz_cmp_si(
x->z,(
long)ui)==0))
135#ifndef BYTES_PER_MP_LIMB
136#define BYTES_PER_MP_LIMB sizeof(mp_limb_t)
146#define mpz_isNeg(A) ((A)->_mp_size<0)
147#define mpz_limb_size(A) ((A)->_mp_size)
148#define mpz_limb_d(A) ((A)->_mp_d)
171 mpz_init_set(z->z,
m);
176#if (__GNU_MP_VERSION*10+__GNU_MP_VERSION_MINOR < 31)
229 mpz_init_set_ui(z->z,(
unsigned long) from);
242 Print(
"!!longrat: NULL in %s:%d\n",
f,
l);
246 if ((((
long)a)&3L)==3L)
248 Print(
" !!longrat:ptr(3) in %s:%d\n",
f,
l);
251 if ((((
long)a)&3L)==1L)
253 if (((((
LONG)(
long)a)<<1)>>1)!=((
LONG)(
long)a))
255 Print(
" !!longrat:arith:%lx in %s:%d\n",(
long)a,
f,
l);
265 if (a->debug!=123456)
267 Print(
"!!longrat:debug:%d in %s:%d\n",a->debug,
f,
l);
271 if ((a->s<0)||(a->s>4))
273 Print(
"!!longrat:s=%d in %s:%d\n",a->s,
f,
l);
281 if (a->z[0]._mp_alloc==0)
282 Print(
"!!longrat:z->alloc=0 in %s:%d\n",
f,
l);
286 if ((a->n[0]._mp_d[0]==0)&&(a->n[0]._mp_alloc<=1))
288 Print(
"!!longrat: n==0 in %s:%d\n",
f,
l);
296 if (a->z[0]._mp_alloc==0)
297 Print(
"!!longrat:n->alloc=0 in %s:%d\n",
f,
l);
298 if ((
mpz_size1(a->n) ==1) && (mpz_cmp_si(a->n,1L)==0))
300 Print(
"!!longrat:integer as rational in %s:%d\n",
f,
l);
301 mpz_clear(a->n); a->s=3;
306 Print(
"!!longrat:div. by negative in %s:%d\n",
f,
l);
320 if ((((ui<<3)>>3)==ui)
321 && (mpz_cmp_si(a->z,(
long)ui)==0))
323 Print(
"!!longrat:im int %d in %s:%d\n",ui,
f,
l);
345 long lz=mpz_get_si(n->z);
346 if (mpz_cmp_si(n->z,lz)==0)
term=lz;
349 mpz_init_set( dummy,n->z );
358 mpz_init_set(
num, n->z );
359 mpz_init_set(
den, n->n );
381 if (
f.den().isOne() )
409 mpz_init_set_ui(h1,1);
410 while((FLT_RADIX*
f) < DBL_MAX &&
i<DBL_MANT_DIG)
413 mpz_mul_ui(h1,h1,FLT_RADIX);
418 memcpy(&(re->n),&h1,
sizeof(h1));
420 if(f_sign==-1) re=
nlNeg(re,dst);
443 int size,
i,negative;
447 size = (*f)[0]._mp_size;
465 e=(*f)[0]._mp_exp-
size;
472 void* (*allocfunc) (size_t);
473 mp_get_memory_functions (&allocfunc,
NULL,
NULL);
476 al = dest->_mp_size =
size;
478 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
481 nn = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*bl);
482 memset(nn,0,
sizeof(mp_limb_t)*bl);
486 ndest->_mp_alloc = ndest->_mp_size = bl;
491 al = dest->_mp_size =
size+e;
493 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
494 memset(dd,0,
sizeof(mp_limb_t)*al);
496 for (
i=0;
i<e;
i++) dd[
i] = 0;
501 dest->_mp_alloc = al;
502 if (negative) mpz_neg(dest,dest);
520 if (mpf_fits_slong_p(ff->
t))
522 long l=mpf_get_si(ff->
t);
526 char *
p=strchr(out,
'.');
537 mpz_set_str(
res->z,out+1,10);
542 mpz_set_str(
res->z,out,10);
554 if (dst->is_field==
FALSE)
569 WarnS(
"conversion problem in CC -> ZZ mapping");
577 int size,
i,negative;
581 size = (*f)[0]._mp_size;
599 e=(*f)[0]._mp_exp-
size;
606 void* (*allocfunc) (size_t);
607 mp_get_memory_functions (&allocfunc,
NULL,
NULL);
610 al = dest->_mp_size =
size;
612 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
615 nn = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*bl);
616 memset(nn,0,
sizeof(mp_limb_t)*bl);
620 ndest->_mp_alloc = ndest->_mp_size = bl;
625 al = dest->_mp_size =
size+e;
627 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
628 memset(dd,0,
sizeof(mp_limb_t)*al);
630 for (
i=0;
i<e;
i++) dd[
i] = 0;
635 dest->_mp_alloc = al;
636 if (negative) mpz_neg(dest,dest);
720 int s=a->z[0]._mp_alloc;
729 int d=a->n[0]._mp_alloc;
754 long ul=mpz_get_si(
i->z);
755 if (mpz_cmp_si(
i->z,ul)!=0)
return 0;
761 mpz_tdiv_q(tmp,
i->z,
i->n);
766 if (mpz_cmp_si(tmp,ul)!=0) ul=0;
785 mpz_tdiv_q(tmp->z,
i->z,
i->n);
815 mpz_init_set_ui(n->z,1L);
816 mpz_init_set_si(n->n,(
long)
SR_TO_INT(a));
820 mpz_init_set_si(n->z,-1L);
821 mpz_init_set_si(n->n,(
long)-
SR_TO_INT(a));
831 mpz_init_set(n->n,a->z);
837 mpz_init_set(n->z,a->n);
843 if (mpz_cmp_ui(n->n,1L)==0)
856 mpz_init_set_si(n->z,-1L);
860 mpz_init_set_ui(n->z,1L);
913 mpz_divexact(u->z,a->z,
b->z);
956 if (rr<0) rr+=
ABS(bb);
989 mpz_mod(rr,a->z,
b->z);
992 mpz_sub(u->z,a->z,rr);
994 mpz_divexact(u->z,u->z,
b->z);
1034 if (c<0) c+=
ABS(bb);
1041 mpz_init_set_si(aa, ai);
1048 mpz_mod(u->z, aa,
b->z);
1066 mpz_mod(u->z, a->z,
b->z);
1088 return (mpz_divisible_ui_p(a->z,
SR_TO_INT(
b))!=0);
1091 return mpz_divisible_p(a->z,
b->z) != 0;
1113 long ch = r->cfInt(c, r);
1124 mpz_init_set_ui(dummy, ch);
1127 info.exp = (
unsigned long) 1;
1158 if (
j==1L)
return a;
1173 mpz_init_set_si(u->z,(
long)
i);
1174 mpz_init_set_si(u->n,(
long)
j);
1197 if (mpz_cmp(u->z,
b->z)==0)
1203 mpz_init_set(u->n,
b->z);
1212 mpz_init_set(u->n,a->n);
1232 mpz_init_set(u->n,
b->z);
1233 if (a->s<2) mpz_mul(u->n,u->n,a->n);
1234 if (
b->s<2) mpz_mul(u->z,u->z,
b->n);
1242 if (mpz_cmp_si(u->n,1L)==0)
1276 mpz_pow_ui((*u)->z,
x->z,(
unsigned long)
exp);
1279 if (mpz_cmp_si(
x->n,1L)==0)
1287 mpz_pow_ui((*u)->n,
x->n,(
unsigned long)
exp);
1384 unsigned long t=mpz_gcd_ui(
NULL,
b->z,(
long)aa);
1394 unsigned long t=mpz_gcd_ui(
NULL,a->z,(
long)bb);
1475 if (mpz_cmp(
x->z,
x->n)==0)
1498 if (mpz_cmp_si(
x->n,1L)==0)
1508 mpz_gcd(
gcd,
x->z,
x->n);
1510 if (mpz_cmp_si(
gcd,1L)!=0)
1512 mpz_divexact(
x->z,
x->z,
gcd);
1513 mpz_divexact(
x->n,
x->n,
gcd);
1514 if (mpz_cmp_si(
x->n,1L)==0)
1552 mpz_gcd(
gcd,a->z,
b->n);
1553 if (mpz_cmp_si(
gcd,1L)!=0)
1557 mpz_divexact(bt,
b->n,
gcd);
1561 mpz_mul(
result->z,bt,a->z);
1593 const unsigned long PP =
p;
1596 number z =
n_Init(
static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
1602 number n =
n_Init(
static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
1631 WarnS(
"Omitted denominator during coefficient mapping !");
1657 mpz_init_set(u->z,n->n);
1684 mpz_init_set(u->z,n->z);
1707 if (a->s!=0)
return FALSE;
1708 number n=
b;
b=a; a=n;
1722 bo=(mpz_cmp(bb,
b->z)==0);
1727 if (((a->s==1) && (
b->s==3))
1728 || ((
b->s==1) && (a->s==3)))
1736 mpz_init_set(aa,a->z);
1737 mpz_init_set(bb,
b->z);
1738 if (a->s<2) mpz_mul(bb,bb,a->n);
1739 if (
b->s<2) mpz_mul(aa,aa,
b->n);
1740 bo=(mpz_cmp(aa,bb)==0);
1759 mpz_init_set(
b->n,a->n);
1761 mpz_init_set(
b->z,a->z);
1780 memset(*a,0,
sizeof(**a));
1797#define GCD_NORM_COND(OLD,NEW) (mpz_size1(NEW->z)>mpz_size1(OLD->z))
1803 mpz_gcd(
gcd,
x->z,
x->n);
1805 if (mpz_cmp_si(
gcd,1L)!=0)
1807 mpz_divexact(
x->z,
x->z,
gcd);
1808 mpz_divexact(
x->n,
x->n,
gcd);
1809 if (mpz_cmp_si(
x->n,1L)==0)
1842 mpz_add(u->z,
b->z,
x);
1850 if (mpz_cmp(u->z,
b->n)==0)
1856 mpz_init_set(u->n,
b->n);
1888 mpz_mul(
x,
b->z,a->n);
1889 mpz_mul(u->z,a->z,
b->n);
1890 mpz_add(u->z,u->z,
x);
1900 mpz_mul(u->n,a->n,
b->n);
1901 if (mpz_cmp(u->z,u->n)==0)
1914 mpz_mul(u->z,
b->z,a->n);
1915 mpz_add(u->z,u->z,a->z);
1922 if (mpz_cmp(u->z,a->n)==0)
1928 mpz_init_set(u->n,a->n);
1943 mpz_mul(u->z,a->z,
b->n);
1944 mpz_add(u->z,u->z,
b->z);
1951 if (mpz_cmp(u->z,
b->n)==0)
1957 mpz_init_set(u->n,
b->n);
1964 mpz_add(u->z,a->z,
b->z);
1989 mpz_add(a->z,a->z,
x);
2023 mpz_add(u->z,
b->z,
x);
2026 mpz_init_set(u->n,
b->n);
2062 mpz_mul(
x,
b->z,a->n);
2063 mpz_mul(
y,a->z,
b->n);
2067 mpz_mul(a->n,a->n,
b->n);
2077 mpz_mul(
x,
b->z,a->n);
2078 mpz_add(a->z,a->z,
x);
2097 mpz_mul(
x,a->z,
b->n);
2098 mpz_add(a->z,
b->z,
x);
2100 mpz_init_set(a->n,
b->n);
2108 mpz_add(a->z,a->z,
b->z);
2137 mpz_sub(u->z,
x,
b->z);
2145 if (mpz_cmp(u->z,
b->n)==0)
2151 mpz_init_set(u->n,
b->n);
2184 mpz_sub(u->z,a->z,
x);
2192 if (mpz_cmp(u->z,a->n)==0)
2198 mpz_init_set(u->n,a->n);
2235 mpz_mul(
x,
b->z,a->n);
2236 mpz_mul(
y,a->z,
b->n);
2247 mpz_mul(u->n,a->n,
b->n);
2248 if (mpz_cmp(u->z,u->n)==0)
2263 mpz_mul(
x,
b->z,a->n);
2264 mpz_sub(u->z,a->z,
x);
2272 if (mpz_cmp(u->z,a->n)==0)
2278 mpz_init_set(u->n,a->n);
2295 mpz_mul(
x,a->z,
b->n);
2296 mpz_sub(u->z,
x,
b->z);
2304 if (mpz_cmp(u->z,
b->n)==0)
2310 mpz_init_set(u->n,
b->n);
2317 mpz_sub(u->z,a->z,
b->z);
2361 if (u->s==1) u->s=0;
2364 mpz_mul_ui(u->z,
b->z,(
unsigned long)
SR_TO_INT(a));
2376 mpz_mul_ui(u->z,
b->z,(
unsigned long)-
SR_TO_INT(a));
2382 if (mpz_cmp(u->z,
b->n)==0)
2388 mpz_init_set(u->n,
b->n);
2398 mpz_mul(u->z,a->z,
b->z);
2408 if (mpz_cmp(u->z,
b->n)==0)
2414 mpz_init_set(u->n,
b->n);
2422 if (mpz_cmp(u->z,a->n)==0)
2428 mpz_init_set(u->n,a->n);
2434 mpz_mul(u->n,a->n,
b->n);
2435 if (mpz_cmp(u->z,u->n)==0)
2484 if ((src->is_field==dst->is_field)
2485 || (src->is_field==
FALSE))
2536 mpz_init_set_si(z->z,
i);
2550 mpz_init_set_si(z->z,(
long)
i);
2551 mpz_init_set_si(z->n,(
long)
j);
2563 mpz_init_set(z->z,
i);
2564 mpz_init_set(z->n,
j);
2590#if defined(DO_LINLINE) || !defined(P_NUMBERS_H)
2609 #if MAX_NUM_SIZE == 60
2614 if ( ((((
long)ii)==
i) && ((ii << 3) >> 3) == ii )) n=
INT_TO_SR(ii);
2638 if (mpz_cmp_si(a->z,0L)==0)
2640 printf(
"gmp-0 in nlIsZero\n");
2706 if ( ((r << 1) >> 1) == r )
2707 return (number)(long)r;
2725 if ( ((r << 1) >> 1) == r )
2748 number u=((number) ((r>>1)+
SR_INT));
2772 if ( ((r << 1) >> 1) == r )
2774 return (number)(long)r;
2796 mpz_mul(aa->z,a->z,
b->z);
2801 mpz_init_set(a->n,
b->n);
2809 mpz_mul(a->n,a->n,
b->n);
2824 else mpz_init_set(
m, (mpz_ptr)n->z);
2849 mpz_init_set(aa, a->z);
2857 mpz_init_set(bb,
b->z);
2859 mpz_t erg; mpz_t bs; mpz_t bt;
2864 mpz_gcdext(erg, bs, bt, aa, bb);
2866 mpz_div(aa, aa, erg);
2909 rr = mpz_divmod_ui(qq, rrr, a->z, (
unsigned long)
ABS(
SR_TO_INT(
b)));
2923 mpz_divmod(qq, rr, a->z,
b->z);
2943 mpz_gcd(a->z,a->z,
b->z);
2960 mpz_mod(rr,a->z,
b->z);
2961 mpz_sub(a->z,a->z,rr);
2963 mpz_divexact(a->z,a->z,
b->z);
2970 mpz_t
A,
B,C,
D,
E,
N,P,tmp;
2972 else mpz_init_set(P,nP->z);
2973 const mp_bitcnt_t bits=2*(
mpz_size1(P)+1)*GMP_LIMB_BITS;
2976 else mpz_set(
N,nN->z);
2979 mpz_init2(
A,bits); mpz_set_ui(
A,0L);
2980 mpz_init2(
B,bits); mpz_set_ui(
B,1L);
2981 mpz_init2(C,bits); mpz_set_ui(C,0L);
2983 mpz_init2(
E,bits); mpz_set(
E,P);
2984 mpz_init2(tmp,bits);
2989 mpz_add(tmp,tmp,tmp);
2990 if (mpz_cmp(tmp,P)<0)
2999 if (mpz_cmp_ui(tmp,1)==0)
3006 memcpy(z->z,
N,
sizeof(mpz_t));
3007 memcpy(z->n,
B,
sizeof(mpz_t));
3022 mpz_divmod(tmp,
D,
E,
N);
3043 mpz_init((*s)->z); (*s)->s=3;
3045 mpz_init((*t)->z); (*t)->s=3;
3047 mpz_init(
g->z);
g->s=3;
3055 aa=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
3064 bb=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
3071 mpz_gcdext(
g->z,(*s)->z,(*t)->z,aa,bb);
3102 for(
i=rl-1;
i>=0;
i--)
3104 X[
i]=CF->convSingNFactoryN(
x[
i],
FALSE,CF);
3105 Q[
i]=CF->convSingNFactoryN(q[
i],
FALSE,CF);
3112 number n=CF->convFactoryNSingN(xnew,CF);
3115 number
p=CF->convFactoryNSingN(qnew,CF);
3118 else p2=CF->cfDiv(
p,CF->cfInit(2, CF),CF);
3119 if (CF->cfGreater(n,p2,CF))
3121 number n2=CF->cfSub(n,
p,CF);
3122 CF->cfDelete(&n,CF);
3125 CF->cfDelete(&p2,CF);
3126 CF->cfDelete(&
p,CF);
3128 CF->cfNormalize(n,CF);
3132number nlChineseRemainder(number *
x, number *q,
int rl,
const coeffs C)
3143 numberCollectionEnumerator.
Reset();
3145 if( !numberCollectionEnumerator.
MoveNext() )
3160 int normalcount = 0;
3163 number& n = numberCollectionEnumerator.
Current();
3175 }
while (numberCollectionEnumerator.
MoveNext() );
3182 numberCollectionEnumerator.
Reset();
3184 while (numberCollectionEnumerator.
MoveNext() )
3186 number& n = numberCollectionEnumerator.
Current();
3188 if( (--normalcount) <= 0)
3202 numberCollectionEnumerator.
Reset();
3204 while (numberCollectionEnumerator.
MoveNext() )
3206 number& nn = numberCollectionEnumerator.
Current();
3219 numberCollectionEnumerator.
Reset();
3221 while (numberCollectionEnumerator.
MoveNext() )
3223 number& n = numberCollectionEnumerator.
Current();
3234 numberCollectionEnumerator.
Reset();
3236 if( !numberCollectionEnumerator.
MoveNext() )
3259 number& cand1 = numberCollectionEnumerator.
Current();
3269 mpz_init_set(
cand->z, cand1->n);
3274 mpz_lcm(
cand->z,
cand->z, cand1->n);
3279 while (numberCollectionEnumerator.
MoveNext() );
3294 numberCollectionEnumerator.
Reset();
3295 while (numberCollectionEnumerator.
MoveNext() )
3297 number& n = numberCollectionEnumerator.
Current();
3309 numberCollectionEnumerator.
Reset();
3316 while (numberCollectionEnumerator.
MoveNext() )
3318 number &n = numberCollectionEnumerator.
Current();
3326 if (r->cfDiv==
nlDiv)
return (
char*)
"QQ";
3327 else return (
char*)
"ZZ";
3334 #if SIZEOF_LONG == 4
3341 fprintf(d->
f_write,
"4 %d ",nnn);
3346 mpz_init_set_si(tmp,nn);
3357 fprintf(d->
f_write,
"%d ",n->s+5);
3398 #if SIZEOF_LONG == 8
3427 #if SIZEOF_LONG == 8
3433 default:
Werror(
"error in reading number: invalid subtype %d",sub_type);
3497 r->cfSubringGcd =
nlGcd;
3520 r->cfInpNeg =
nlNeg;
3564 r->has_simple_Alloc=
FALSE;
3565 r->has_simple_Inverse=
FALSE;
3572number nlMod(number a, number
b)
3594 mpz_mod(r->z,al->z,bl->z);
3599 LONG ui=(int)mpz_get_si(&r->z);
3600 if ((((ui<<3)>>3)==ui)
3601 && (mpz_cmp_si(
x->z,(
long)ui)==0))
const CanonicalForm CFMap CFMap & N
const CanonicalForm const CanonicalForm const CanonicalForm const CanonicalForm & cand
void FACTORY_PUBLIC chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
void FACTORY_PUBLIC chineseRemainderCached(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew, CFArray &inv)
static const int SW_RATIONAL
set to 1 for computations over Q
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...
Templated enumerator interface for simple iteration over a generic collection of T's.
gmp_complex numbers based on
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
@ n_R
single prescision (6,6) real numbers
@ n_Q
rational (GMP) numbers
@ n_Zn
only used if HAVE_RINGS is defined
@ n_long_R
real floating point (GMP) numbers
@ n_long_C
complex floating point (GMP) numbers
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...
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
@ n_rep_gap_rat
(number), see longrat.h
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
@ n_rep_float
(float), see shortfl.h
@ n_rep_int
(int), see modulop.h
@ n_rep_gmp_float
(gmp_float), see
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
REvaluation E(1, terms.length(), IntRandom(25))
const Variable & v
< [in] a sqrfree bivariate poly
bool isZero(const CFArray &A)
checks if entries of A are zero
void WerrorS(const char *s)
static number nlMapP(number from, const coeffs src, const coeffs dst)
void nlWriteFd(number n, const ssiInfo *d, const coeffs)
LINLINE void nlInpMult(number &a, number b, const coeffs r)
LINLINE BOOLEAN nlEqual(number a, number b, const coeffs r)
LINLINE number nlAdd(number la, number li, const coeffs r)
number nlMapZ(number from, const coeffs, const coeffs dst)
long nlInt(number &n, const coeffs r)
static number nlLcm(number a, number b, const coeffs r)
static number nlMapLongR_BI(number from, const coeffs src, const coeffs dst)
number nlInit2(int i, int j, const coeffs r)
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
LINLINE number nl_Copy(number a, const coeffs r)
number nlInit2gmp(mpz_t i, mpz_t j, const coeffs r)
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
void _nlInpAdd_aNoImm_OR_bNoImm(number &a, number b)
LINLINE number nlSub(number la, number li, const coeffs r)
number nlIntMod(number a, number b, const coeffs r)
number _nlCopy_NoImm(number a)
number _nlSub_aNoImm_OR_bNoImm(number a, number b)
LINLINE number nlCopy(number a, const coeffs r)
LINLINE number nlNeg(number za, const coeffs r)
number nlXExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
void nlPower(number x, int exp, number *lu, const coeffs r)
number nlQuotRem(number a, number b, number *r, const coeffs R)
number nlFarey(number nN, number nP, const coeffs CF)
LINLINE BOOLEAN nlIsOne(number a, const coeffs r)
static number nlMapC(number from, const coeffs src, const coeffs dst)
number nlNormalizeHelper(number a, number b, const coeffs r)
LINLINE void nlDelete(number *a, const coeffs r)
BOOLEAN nlGreaterZero(number za, const coeffs r)
number _nlNeg_NoImm(number a)
number nlModP(number q, const coeffs, const coeffs Zp)
LINLINE void nlInpAdd(number &a, number b, const coeffs r)
number nlExactDiv(number a, number b, const coeffs r)
void mpz_mul_si(mpz_ptr r, mpz_srcptr s, long int si)
const char * nlRead(const char *s, number *a, const coeffs r)
void nlMPZ(mpz_t m, number &n, const coeffs r)
number nlInvers(number a, const coeffs r)
BOOLEAN nlIsUnit(number a, const coeffs)
void nlInpIntDiv(number &a, number b, const coeffs r)
static void nlNormalize_Gcd(number &x)
static number nlConvFactoryNSingN(const CanonicalForm f, const coeffs r)
number nlChineseRemainderSym(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
int nlDivComp(number a, number b, const coeffs r)
void _nlDelete_NoImm(number *a)
char * nlCoeffName(const coeffs r)
BOOLEAN nlInitChar(coeffs r, void *p)
number nlCopyMap(number a, const coeffs, const coeffs)
number nlExtGcd(number a, number b, number *s, number *t, const coeffs)
static number nlMapGMP(number from, const coeffs, const coeffs dst)
LINLINE number nlMult(number a, number b, const coeffs r)
static number nlInitMPZ(mpz_t m, const coeffs)
number nlIntDiv(number a, number b, const coeffs r)
static void nlClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
static number nlMapLongR(number from, const coeffs src, const coeffs dst)
LINLINE BOOLEAN nlIsZero(number za, const coeffs r)
number nlGetDenom(number &n, const coeffs r)
number nlGcd(number a, number b, const coeffs r)
number _nlMult_aImm_bImm_rNoImm(number a, number b)
number nlReadFd(const ssiInfo *d, const coeffs)
int nlSize(number a, const coeffs)
number nlMapMachineInt(number from, const coeffs, const coeffs)
nMapFunc nlSetMap(const coeffs src, const coeffs dst)
number nlBigInt(number &n)
static number nlShort3(number x)
#define GCD_NORM_COND(OLD, NEW)
BOOLEAN nlDBTest(number a, const char *f, const int l)
number nlDiv(number a, number b, const coeffs r)
BOOLEAN nlIsMOne(number a, const coeffs r)
static void nlClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
number _nlMult_aNoImm_OR_bNoImm(number a, number b)
LINLINE number nlInit(long i, const coeffs r)
number nlShort3_noinline(number x)
number nlGetNumerator(number &n, const coeffs r)
number _nlAdd_aNoImm_OR_bNoImm(number a, number b)
BOOLEAN nlCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
static CanonicalForm nlConvSingNFactoryN(number n, const BOOLEAN setChar, const coeffs)
static number nlMapR(number from, const coeffs src, const coeffs dst)
number nlGetUnit(number n, const coeffs cf)
coeffs nlQuot1(number c, const coeffs r)
BOOLEAN _nlEqual_aNoImm_OR_bNoImm(number a, number b)
number nlShort1(number x)
BOOLEAN nlGreater(number a, number b, const coeffs r)
static number nlMapR_BI(number from, const coeffs src, const coeffs dst)
void nlGMP(number &i, mpz_t n, const coeffs r)
void nlNormalize(number &x, const coeffs r)
BOOLEAN nlDivBy(number a, number b, const coeffs)
static int int_extgcd(int a, int b, int *u, int *x, int *v, int *y)
void nlWrite(number a, const coeffs r)
void nlInpGcd(number &a, number b, const coeffs r)
static number nlRandom(siRandProc p, number v2, number, const coeffs cf)
number nlMapQtoZ(number a, const coeffs src, const coeffs dst)
long npInt(number &n, const coeffs r)
char * floatToStr(const gmp_float &r, const unsigned int oprec)
gmp_float exp(const gmp_float &a)
The main handler for Singular numbers which are suitable for Singular polynomials.
char * nEatLong(char *s, mpz_ptr i)
extracts a long integer from s, returns the rest
const char *const nDivBy0
#define omFreeSize(addr, size)
#define omCheckIf(cond, test)
#define omCheckAddrSize(addr, size)
void Werror(const char *fmt,...)
void s_readmpz(s_buff F, mpz_t a)
void s_readmpz_base(s_buff F, mpz_ptr a, int base)
long s_readlong(s_buff F)
SI_FLOAT nrFloat(number n)
Converts a n_R number into a float. Needed by Maps.
CanonicalForm make_cf(const mpz_ptr n)
void gmp_denominator(const CanonicalForm &f, mpz_ptr result)
void gmp_numerator(const CanonicalForm &f, mpz_ptr result)