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)
228 mpz_init_set_ui(z->z,(
unsigned long) from);
239 Print(
"!!longrat: NULL in %s:%d\n",
f,
l);
243 if ((((
long)a)&3L)==3L)
245 Print(
" !!longrat:ptr(3) in %s:%d\n",
f,
l);
248 if ((((
long)a)&3L)==1L)
250 if (((((
LONG)(
long)a)<<1)>>1)!=((
LONG)(
long)a))
252 Print(
" !!longrat:arith:%lx in %s:%d\n",(
long)a,
f,
l);
262 if (a->debug!=123456)
264 Print(
"!!longrat:debug:%d in %s:%d\n",a->debug,
f,
l);
268 if ((a->s<0)||(a->s>4))
270 Print(
"!!longrat:s=%d in %s:%d\n",a->s,
f,
l);
278 if (a->z[0]._mp_alloc==0)
279 Print(
"!!longrat:z->alloc=0 in %s:%d\n",
f,
l);
283 if ((a->n[0]._mp_d[0]==0)&&(a->n[0]._mp_alloc<=1))
285 Print(
"!!longrat: n==0 in %s:%d\n",
f,
l);
293 if (a->z[0]._mp_alloc==0)
294 Print(
"!!longrat:n->alloc=0 in %s:%d\n",
f,
l);
295 if ((
mpz_size1(a->n) ==1) && (mpz_cmp_si(a->n,1L)==0))
297 Print(
"!!longrat:integer as rational in %s:%d\n",
f,
l);
298 mpz_clear(a->n); a->s=3;
303 Print(
"!!longrat:div. by negative in %s:%d\n",
f,
l);
317 if ((((ui<<3)>>3)==ui)
318 && (mpz_cmp_si(a->z,(
long)ui)==0))
320 Print(
"!!longrat:im int %d in %s:%d\n",ui,
f,
l);
342 long lz=mpz_get_si(n->z);
343 if (mpz_cmp_si(n->z,lz)==0)
term=lz;
346 mpz_init_set( dummy,n->z );
355 mpz_init_set(
num, n->z );
356 mpz_init_set(
den, n->n );
378 if (
f.den().isOne() )
406 mpz_init_set_ui(h1,1);
407 while((FLT_RADIX*
f) < DBL_MAX &&
i<DBL_MANT_DIG)
410 mpz_mul_ui(h1,h1,FLT_RADIX);
415 memcpy(&(re->n),&h1,
sizeof(h1));
417 if(f_sign==-1) re=
nlNeg(re,dst);
440 int size,
i,negative;
444 size = (*f)[0]._mp_size;
462 e=(*f)[0]._mp_exp-
size;
469 void* (*allocfunc) (size_t);
470 mp_get_memory_functions (&allocfunc,
NULL,
NULL);
473 al = dest->_mp_size =
size;
475 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
478 nn = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*bl);
479 memset(nn,0,
sizeof(mp_limb_t)*bl);
483 ndest->_mp_alloc = ndest->_mp_size = bl;
488 al = dest->_mp_size =
size+e;
490 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
491 memset(dd,0,
sizeof(mp_limb_t)*al);
493 for (
i=0;
i<e;
i++) dd[
i] = 0;
498 dest->_mp_alloc = al;
499 if (negative) mpz_neg(dest,dest);
517 if (mpf_fits_slong_p(ff->
t))
519 long l=mpf_get_si(ff->
t);
523 char *
p=strchr(out,
'.');
534 mpz_set_str(
res->z,out+1,10);
539 mpz_set_str(
res->z,out,10);
551 if (dst->is_field==
FALSE)
566 WarnS(
"conversion problem in CC -> ZZ mapping");
574 int size,
i,negative;
578 size = (*f)[0]._mp_size;
596 e=(*f)[0]._mp_exp-
size;
603 void* (*allocfunc) (size_t);
604 mp_get_memory_functions (&allocfunc,
NULL,
NULL);
607 al = dest->_mp_size =
size;
609 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
612 nn = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*bl);
613 memset(nn,0,
sizeof(mp_limb_t)*bl);
617 ndest->_mp_alloc = ndest->_mp_size = bl;
622 al = dest->_mp_size =
size+e;
624 dd = (mp_ptr)allocfunc(
sizeof(mp_limb_t)*al);
625 memset(dd,0,
sizeof(mp_limb_t)*al);
627 for (
i=0;
i<e;
i++) dd[
i] = 0;
632 dest->_mp_alloc = al;
633 if (negative) mpz_neg(dest,dest);
717 int s=a->z[0]._mp_alloc;
726 int d=a->n[0]._mp_alloc;
751 long ul=mpz_get_si(
i->z);
752 if (mpz_cmp_si(
i->z,ul)!=0)
return 0;
758 mpz_tdiv_q(tmp,
i->z,
i->n);
763 if (mpz_cmp_si(tmp,ul)!=0) ul=0;
782 mpz_tdiv_q(tmp->z,
i->z,
i->n);
812 mpz_init_set_ui(n->z,1L);
813 mpz_init_set_si(n->n,(
long)
SR_TO_INT(a));
817 mpz_init_set_si(n->z,-1L);
818 mpz_init_set_si(n->n,(
long)-
SR_TO_INT(a));
828 mpz_init_set(n->n,a->z);
834 mpz_init_set(n->z,a->n);
840 if (mpz_cmp_ui(n->n,1L)==0)
853 mpz_init_set_si(n->z,-1L);
857 mpz_init_set_ui(n->z,1L);
910 mpz_divexact(u->z,a->z,
b->z);
953 if (rr<0) rr+=
ABS(bb);
986 mpz_mod(rr,a->z,
b->z);
989 mpz_sub(u->z,a->z,rr);
991 mpz_divexact(u->z,u->z,
b->z);
1031 if (c<0) c+=
ABS(bb);
1038 mpz_init_set_si(aa, ai);
1045 mpz_mod(u->z, aa,
b->z);
1063 mpz_mod(u->z, a->z,
b->z);
1085 return (mpz_divisible_ui_p(a->z,
SR_TO_INT(
b))!=0);
1088 return mpz_divisible_p(a->z,
b->z) != 0;
1110 long ch = r->cfInt(c, r);
1120 mpz_init_set_ui(dummy, ch);
1123 info.exp = (
unsigned long) 1;
1153 if (
j==1L)
return a;
1168 mpz_init_set_si(u->z,(
long)
i);
1169 mpz_init_set_si(u->n,(
long)
j);
1192 if (mpz_cmp(u->z,
b->z)==0)
1198 mpz_init_set(u->n,
b->z);
1207 mpz_init_set(u->n,a->n);
1227 mpz_init_set(u->n,
b->z);
1228 if (a->s<2) mpz_mul(u->n,u->n,a->n);
1229 if (
b->s<2) mpz_mul(u->z,u->z,
b->n);
1237 if (mpz_cmp_si(u->n,1L)==0)
1271 mpz_pow_ui((*u)->z,
x->z,(
unsigned long)
exp);
1274 if (mpz_cmp_si(
x->n,1L)==0)
1282 mpz_pow_ui((*u)->n,
x->n,(
unsigned long)
exp);
1379 unsigned long t=mpz_gcd_ui(
NULL,
b->z,(
long)aa);
1389 unsigned long t=mpz_gcd_ui(
NULL,a->z,(
long)bb);
1470 if (mpz_cmp(
x->z,
x->n)==0)
1493 if (mpz_cmp_si(
x->n,1L)==0)
1503 mpz_gcd(
gcd,
x->z,
x->n);
1505 if (mpz_cmp_si(
gcd,1L)!=0)
1507 mpz_divexact(
x->z,
x->z,
gcd);
1508 mpz_divexact(
x->n,
x->n,
gcd);
1509 if (mpz_cmp_si(
x->n,1L)==0)
1547 mpz_gcd(
gcd,a->z,
b->n);
1548 if (mpz_cmp_si(
gcd,1L)!=0)
1552 mpz_divexact(bt,
b->n,
gcd);
1556 mpz_mul(
result->z,bt,a->z);
1588 const unsigned long PP =
p;
1591 number z =
n_Init(
static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
1597 number n =
n_Init(
static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
1630 mpz_init_set(u->z,n->n);
1657 mpz_init_set(u->z,n->z);
1680 if (a->s!=0)
return FALSE;
1681 number n=
b;
b=a; a=n;
1695 bo=(mpz_cmp(bb,
b->z)==0);
1700 if (((a->s==1) && (
b->s==3))
1701 || ((
b->s==1) && (a->s==3)))
1709 mpz_init_set(aa,a->z);
1710 mpz_init_set(bb,
b->z);
1711 if (a->s<2) mpz_mul(bb,bb,a->n);
1712 if (
b->s<2) mpz_mul(aa,aa,
b->n);
1713 bo=(mpz_cmp(aa,bb)==0);
1732 mpz_init_set(
b->n,a->n);
1734 mpz_init_set(
b->z,a->z);
1753 memset(*a,0,
sizeof(**a));
1770#define GCD_NORM_COND(OLD,NEW) (mpz_size1(NEW->z)>mpz_size1(OLD->z))
1776 mpz_gcd(
gcd,
x->z,
x->n);
1778 if (mpz_cmp_si(
gcd,1L)!=0)
1780 mpz_divexact(
x->z,
x->z,
gcd);
1781 mpz_divexact(
x->n,
x->n,
gcd);
1782 if (mpz_cmp_si(
x->n,1L)==0)
1815 mpz_add(u->z,
b->z,
x);
1823 if (mpz_cmp(u->z,
b->n)==0)
1829 mpz_init_set(u->n,
b->n);
1861 mpz_mul(
x,
b->z,a->n);
1862 mpz_mul(u->z,a->z,
b->n);
1863 mpz_add(u->z,u->z,
x);
1873 mpz_mul(u->n,a->n,
b->n);
1874 if (mpz_cmp(u->z,u->n)==0)
1887 mpz_mul(u->z,
b->z,a->n);
1888 mpz_add(u->z,u->z,a->z);
1895 if (mpz_cmp(u->z,a->n)==0)
1901 mpz_init_set(u->n,a->n);
1916 mpz_mul(u->z,a->z,
b->n);
1917 mpz_add(u->z,u->z,
b->z);
1924 if (mpz_cmp(u->z,
b->n)==0)
1930 mpz_init_set(u->n,
b->n);
1937 mpz_add(u->z,a->z,
b->z);
1962 mpz_add(a->z,a->z,
x);
1996 mpz_add(u->z,
b->z,
x);
1999 mpz_init_set(u->n,
b->n);
2035 mpz_mul(
x,
b->z,a->n);
2036 mpz_mul(
y,a->z,
b->n);
2040 mpz_mul(a->n,a->n,
b->n);
2050 mpz_mul(
x,
b->z,a->n);
2051 mpz_add(a->z,a->z,
x);
2070 mpz_mul(
x,a->z,
b->n);
2071 mpz_add(a->z,
b->z,
x);
2073 mpz_init_set(a->n,
b->n);
2081 mpz_add(a->z,a->z,
b->z);
2110 mpz_sub(u->z,
x,
b->z);
2118 if (mpz_cmp(u->z,
b->n)==0)
2124 mpz_init_set(u->n,
b->n);
2157 mpz_sub(u->z,a->z,
x);
2165 if (mpz_cmp(u->z,a->n)==0)
2171 mpz_init_set(u->n,a->n);
2208 mpz_mul(
x,
b->z,a->n);
2209 mpz_mul(
y,a->z,
b->n);
2220 mpz_mul(u->n,a->n,
b->n);
2221 if (mpz_cmp(u->z,u->n)==0)
2236 mpz_mul(
x,
b->z,a->n);
2237 mpz_sub(u->z,a->z,
x);
2245 if (mpz_cmp(u->z,a->n)==0)
2251 mpz_init_set(u->n,a->n);
2268 mpz_mul(
x,a->z,
b->n);
2269 mpz_sub(u->z,
x,
b->z);
2277 if (mpz_cmp(u->z,
b->n)==0)
2283 mpz_init_set(u->n,
b->n);
2290 mpz_sub(u->z,a->z,
b->z);
2334 if (u->s==1) u->s=0;
2337 mpz_mul_ui(u->z,
b->z,(
unsigned long)
SR_TO_INT(a));
2349 mpz_mul_ui(u->z,
b->z,(
unsigned long)-
SR_TO_INT(a));
2355 if (mpz_cmp(u->z,
b->n)==0)
2361 mpz_init_set(u->n,
b->n);
2371 mpz_mul(u->z,a->z,
b->z);
2381 if (mpz_cmp(u->z,
b->n)==0)
2387 mpz_init_set(u->n,
b->n);
2395 if (mpz_cmp(u->z,a->n)==0)
2401 mpz_init_set(u->n,a->n);
2407 mpz_mul(u->n,a->n,
b->n);
2408 if (mpz_cmp(u->z,u->n)==0)
2457 if ((src->is_field==dst->is_field)
2458 || (src->is_field==
FALSE))
2507 mpz_init_set_si(z->z,
i);
2521 mpz_init_set_si(z->z,(
long)
i);
2522 mpz_init_set_si(z->n,(
long)
j);
2534 mpz_init_set(z->z,
i);
2535 mpz_init_set(z->n,
j);
2561#if defined(DO_LINLINE) || !defined(P_NUMBERS_H)
2580 #if MAX_NUM_SIZE == 60
2585 if ( ((((
long)ii)==
i) && ((ii << 3) >> 3) == ii )) n=
INT_TO_SR(ii);
2609 if (mpz_cmp_si(a->z,0L)==0)
2611 printf(
"gmp-0 in nlIsZero\n");
2677 if ( ((r << 1) >> 1) == r )
2678 return (number)(long)r;
2696 if ( ((r << 1) >> 1) == r )
2719 number u=((number) ((r>>1)+
SR_INT));
2743 if ( ((r << 1) >> 1) == r )
2745 return (number)(long)r;
2767 mpz_mul(aa->z,a->z,
b->z);
2772 mpz_init_set(a->n,
b->n);
2780 mpz_mul(a->n,a->n,
b->n);
2795 else mpz_init_set(
m, (mpz_ptr)n->z);
2803 else if (n->s==3) mpz_init_set_si(
m,1);
2804 else mpz_init_set(
m, (mpz_ptr)n->n);
2829 mpz_init_set(aa, a->z);
2837 mpz_init_set(bb,
b->z);
2839 mpz_t erg; mpz_t bs; mpz_t bt;
2844 mpz_gcdext(erg, bs, bt, aa, bb);
2846 mpz_div(aa, aa, erg);
2889 rr = mpz_divmod_ui(qq, rrr, a->z, (
unsigned long)
ABS(
SR_TO_INT(
b)));
2903 mpz_divmod(qq, rr, a->z,
b->z);
2923 mpz_gcd(a->z,a->z,
b->z);
2940 mpz_mod(rr,a->z,
b->z);
2941 mpz_sub(a->z,a->z,rr);
2943 mpz_divexact(a->z,a->z,
b->z);
2950 mpz_t
A,
B,C,
D,
E,
N,P,tmp;
2952 else mpz_init_set(P,nP->z);
2953 const mp_bitcnt_t bits=2*(
mpz_size1(P)+1)*GMP_LIMB_BITS;
2956 else mpz_set(
N,nN->z);
2959 mpz_init2(
A,bits); mpz_set_ui(
A,0L);
2960 mpz_init2(
B,bits); mpz_set_ui(
B,1L);
2961 mpz_init2(C,bits); mpz_set_ui(C,0L);
2963 mpz_init2(
E,bits); mpz_set(
E,P);
2964 mpz_init2(tmp,bits);
2969 mpz_add(tmp,tmp,tmp);
2970 if (mpz_cmp(tmp,P)<0)
2979 if (mpz_cmp_ui(tmp,1)==0)
2986 memcpy(z->z,
N,
sizeof(mpz_t));
2987 memcpy(z->n,
B,
sizeof(mpz_t));
3002 mpz_divmod(tmp,
D,
E,
N);
3023 mpz_init((*s)->z); (*s)->s=3;
3025 mpz_init((*t)->z); (*t)->s=3;
3027 mpz_init(
g->z);
g->s=3;
3035 aa=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
3044 bb=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
3051 mpz_gcdext(
g->z,(*s)->z,(*t)->z,aa,bb);
3082 for(
i=rl-1;
i>=0;
i--)
3084 X[
i]=CF->convSingNFactoryN(
x[
i],
FALSE,CF);
3085 Q[
i]=CF->convSingNFactoryN(q[
i],
FALSE,CF);
3092 number n=CF->convFactoryNSingN(xnew,CF);
3095 number
p=CF->convFactoryNSingN(qnew,CF);
3098 else p2=CF->cfDiv(
p,CF->cfInit(2, CF),CF);
3099 if (CF->cfGreater(n,p2,CF))
3101 number n2=CF->cfSub(n,
p,CF);
3102 CF->cfDelete(&n,CF);
3105 CF->cfDelete(&p2,CF);
3106 CF->cfDelete(&
p,CF);
3108 CF->cfNormalize(n,CF);
3112number nlChineseRemainder(number *
x, number *q,
int rl,
const coeffs C)
3123 numberCollectionEnumerator.
Reset();
3125 if( !numberCollectionEnumerator.
MoveNext() )
3140 int normalcount = 0;
3143 number& n = numberCollectionEnumerator.
Current();
3155 }
while (numberCollectionEnumerator.
MoveNext() );
3162 numberCollectionEnumerator.
Reset();
3164 while (numberCollectionEnumerator.
MoveNext() )
3166 number& n = numberCollectionEnumerator.
Current();
3168 if( (--normalcount) <= 0)
3182 numberCollectionEnumerator.
Reset();
3184 while (numberCollectionEnumerator.
MoveNext() )
3186 number& nn = numberCollectionEnumerator.
Current();
3199 numberCollectionEnumerator.
Reset();
3201 while (numberCollectionEnumerator.
MoveNext() )
3203 number& n = numberCollectionEnumerator.
Current();
3214 numberCollectionEnumerator.
Reset();
3216 if( !numberCollectionEnumerator.
MoveNext() )
3239 number& cand1 = numberCollectionEnumerator.
Current();
3249 mpz_init_set(
cand->z, cand1->n);
3254 mpz_lcm(
cand->z,
cand->z, cand1->n);
3259 while (numberCollectionEnumerator.
MoveNext() );
3274 numberCollectionEnumerator.
Reset();
3275 while (numberCollectionEnumerator.
MoveNext() )
3277 number& n = numberCollectionEnumerator.
Current();
3289 numberCollectionEnumerator.
Reset();
3296 while (numberCollectionEnumerator.
MoveNext() )
3298 number &n = numberCollectionEnumerator.
Current();
3306 if (r->cfDiv==
nlDiv)
return (
char*)
"QQ";
3307 else return (
char*)
"ZZ";
3314 #if SIZEOF_LONG == 4
3321 fprintf(d->
f_write,
"4 %d ",nnn);
3326 mpz_init_set_si(tmp,nn);
3337 fprintf(d->
f_write,
"%d ",n->s+5);
3360 #if SIZEOF_LONG == 4
3373 mpz_init_set_si(tmp,nn);
3384 int l2=mpz_sizeinbase(n->n,
SSI_BASE);
3427 #if SIZEOF_LONG == 8
3452 #if SIZEOF_LONG == 8
3458 default:
Werror(
"error in reading number: invalid subtype %d",sub_type);
3486 #if SIZEOF_LONG == 8
3511 #if SIZEOF_LONG == 8
3517 default:
Werror(
"error in reading number: invalid subtype %d",sub_type);
3581 r->cfSubringGcd =
nlGcd;
3604 r->cfInpNeg =
nlNeg;
3650 r->has_simple_Alloc=
FALSE;
3651 r->has_simple_Inverse=
FALSE;
3658number nlMod(number a, number
b)
3680 mpz_mod(r->z,al->z,bl->z);
3685 LONG ui=(int)mpz_get_si(&r->z);
3686 if ((((ui<<3)>>3)==ui)
3687 && (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...
gmp_complex numbers based on
Coefficient rings, fields and other domains suitable for Singular polynomials.
IEnumerator< number > ICoeffsEnumerator
Abstract interface for an enumerator of number coefficients for an object, e.g. a polynomial.
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
factory.h' is the user interface to Factory.
CanonicalForm FACTORY_PUBLIC make_cf(const mpz_ptr n)
void FACTORY_PUBLIC gmp_numerator(const CanonicalForm &f, mpz_ptr result)
void FACTORY_PUBLIC gmp_denominator(const CanonicalForm &f, mpz_ptr result)
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)
get numerator as mpz_t
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)
void nlMPZ2(mpz_t m, number &n, const coeffs r)
get demoninator as mpz_t
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)
number nlReadFd_S(char **s, const coeffs)
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 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)
static void nlWriteFd_S(number n, const coeffs)
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 StringAppendS(const char *st)
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)
void s_readmpz_base_S(char **s, mpz_ptr a, int base)
long s_readlong(s_buff F)
int s_readint_S(char **s)
void s_readmpz_S(char **s, mpz_t a)
long s_readlong_S(char **s)
SI_FLOAT nrFloat(number n)
Converts a n_R number into a float. Needed by Maps.