11 #include <factory/factory.h>
22 #if defined(DO_LINLINE) && defined(P_NUMBERS_H) && !defined(LDEBUG)
23 #define LINLINE static FORCE_INLINE
89 #define nlTest(a, r) nlDBTest(a,__FILE__,__LINE__, r)
92 #define nlTest(a, r) do {} while (0)
99 #define MAX_NUM_SIZE 60
100 #define POW_2_28 (1L<<60)
101 #define POW_2_28_32 (1L<<28)
104 #define MAX_NUM_SIZE 28
105 #define POW_2_28 (1L<<28)
106 #define POW_2_28_32 (1L<<28)
113 if (mpz_cmp_ui(x->z,(
long)0)==0)
121 LONG ui=mpz_get_si(x->z);
122 if ((((ui<<3)>>3)==ui)
123 && (mpz_cmp_si(x->z,(
long)ui)==0))
146 #ifndef BYTES_PER_MP_LIMB
147 #define BYTES_PER_MP_LIMB sizeof(mp_limb_t)
157 #define mpz_isNeg(A) ((A)->_mp_size<0)
158 #define mpz_limb_size(A) ((A)->_mp_size)
159 #define mpz_limb_d(A) ((A)->_mp_d)
160 #define MPZ_DIV(A,B,C) mpz_tdiv_q((A),(B),(C))
161 #define MPZ_EXACTDIV(A,B,C) mpz_divexact((A),(B),(C))
178 #if (__GNU_MP_VERSION*10+__GNU_MP_VERSION_MINOR < 31)
214 mpz_init_set(z->z,(mpz_ptr) from);
239 mpz_init_set_ui(z->z,(
unsigned long) from);
252 Print(
"!!longrat: NULL in %s:%d\n",f,l);
256 if ((((
long)a)&3L)==3L)
258 Print(
" !!longrat:ptr(3) in %s:%d\n",f,l);
261 if ((((
long)a)&3L)==1L)
263 if (((((
LONG)(
long)a)<<1)>>1)!=((
LONG)(
long)a))
265 Print(
" !!longrat:arith:%lx in %s:%d\n",(
long)a, f,l);
275 if (a->debug!=123456)
277 Print(
"!!longrat:debug:%d in %s:%d\n",a->debug,f,l);
281 if ((a->s<0)||(a->s>4))
283 Print(
"!!longrat:s=%d in %s:%d\n",a->s,f,l);
291 if (a->z[0]._mp_alloc==0)
292 Print(
"!!longrat:z->alloc=0 in %s:%d\n",f,l);
296 if ((a->n[0]._mp_d[0]==0)&&(a->n[0]._mp_alloc<=1))
298 Print(
"!!longrat: n==0 in %s:%d\n",f,l);
306 if (a->z[0]._mp_alloc==0)
307 Print(
"!!longrat:n->alloc=0 in %s:%d\n",f,l);
308 if ((
mpz_size1(a->n) ==1) && (mpz_cmp_si(a->n,(
long)1)==0))
310 Print(
"!!longrat:integer as rational in %s:%d\n",f,l);
311 mpz_clear(a->n); a->s=3;
316 Print(
"!!longrat:div. by negative in %s:%d\n",f,l);
330 if ((((ui<<3)>>3)==ui)
331 && (mpz_cmp_si(a->z,(
long)ui)==0))
333 Print(
"!!longrat:im int %d in %s:%d\n",ui,f,l);
355 long lz=mpz_get_si(n->z);
356 if (mpz_cmp_si(n->z,lz)==0) term=lz;
359 mpz_init_set( dummy,n->z );
368 mpz_init_set( num, n->z );
369 mpz_init_set( den, n->n );
370 term =
make_cf( num, den, ( n->s != 1 ));
417 mpz_init_set_ui(h1,1);
418 while((FLT_RADIX*f) < DBL_MAX && i<DBL_MANT_DIG)
421 mpz_mul_ui(h1,h1,FLT_RADIX);
426 memcpy(&(re->n),&h1,
sizeof(h1));
428 if(f_sign==-1) re=
nlNeg(re,dst);
445 size = (*f)[0]._mp_size;
463 e=(*f)[0]._mp_exp-
size;
472 al = dest->_mp_size =
size;
474 dd = (mp_ptr)
omAlloc(
sizeof(mp_limb_t)*al);
475 for (i=0;i<
size;i++) dd[i] = qp[i];
477 nn = (mp_ptr)
omAlloc(
sizeof(mp_limb_t)*bl);
479 for (i=bl-2;i>=0;i--) nn[i] = 0;
482 ndest->_mp_alloc = ndest->_mp_size = bl;
487 al = dest->_mp_size = size+e;
489 dd = (mp_ptr)
omAlloc(
sizeof(mp_limb_t)*al);
490 for (i=0;i<
size;i++) dd[i+e] = qp[i];
491 for (i=0;i<e;i++) dd[i] = 0;
496 dest->_mp_alloc = al;
497 if (negative) dest->_mp_size = -dest->_mp_size;
581 int s=a->z[0]._mp_alloc;
590 int d=a->n[0]._mp_alloc;
615 long ul=mpz_get_si(i->z);
616 if (mpz_cmp_si(i->z,ul)!=0)
return 0;
627 if (mpz_cmp_si(tmp,ul)!=0) ul=0;
676 mpz_init_set_si(n->z,(
long)1);
677 mpz_init_set_si(n->n,(
long)
SR_TO_INT(a));
681 mpz_init_set_si(n->z,(
long)-1);
682 mpz_init_set_si(n->n,(
long)-
SR_TO_INT(a));
693 mpz_init_set(n->n,a->z);
698 mpz_init_set(n->z,a->n);
704 if (mpz_cmp_si(n->n,(
long)1)==0)
716 mpz_init_set_si(n->z,(
long)-1);
720 mpz_init_set_si(n->z,(
long)1);
830 mpz_init_set(u->z,a->z);
877 mpz_mod(u->z,aa,b->z);
895 mpz_mod(u->z,a->z,b->z);
917 return (mpz_divisible_ui_p(a->z,
SR_TO_INT(b))!=0);
920 return mpz_divisible_p(a->z, b->z) != 0;
927 if (
nlDivBy(b, a, r))
return 2;
930 if (
nlDivBy(b, a, r))
return 1;
944 long ch = r->cfInt(c, r);
946 dummy = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
947 mpz_init_set_ui(dummy, ch);
950 info.
exp = (
unsigned long) 1;
993 mpz_init_set_si(u->z,(
long)i);
994 mpz_init_set_si(u->n,(
long)j);
1017 if (mpz_cmp(u->z,b->z)==0)
1023 mpz_init_set(u->n,b->z);
1026 else if (
SR_HDL(b) & SR_INT)
1032 mpz_init_set(u->n,a->n);
1052 mpz_init_set(u->n,b->z);
1053 if (a->s<2) mpz_mul(u->n,u->n,a->n);
1054 if (b->s<2) mpz_mul(u->z,u->z,b->n);
1062 if (mpz_cmp_si(u->n,(
long)1)==0)
1096 mpz_pow_ui((*u)->z,x->z,(
unsigned long)exp);
1099 if (mpz_cmp_si(x->n,(
long)1)==0)
1107 mpz_pow_ui((*u)->n,x->n,(
unsigned long)exp);
1119 if (exp<0)
Print(
"nlPower: neg. exp. %d\n",exp);
1183 if((i==0L)||(j==0L))
1201 if (((!(
SR_HDL(a) & SR_INT))&&(a->s<2))
1206 unsigned long t=mpz_gcd_ui(
NULL,b->z,(
long)aa);
1216 unsigned long t=mpz_gcd_ui(
NULL,a->z,(
long)bb);
1225 mpz_init(result->z);
1226 mpz_gcd(result->z,a->z,b->z);
1229 result->debug=123456;
1246 if (mpz_cmp_ui(x->z,(
long)0)==0)
1253 if (mpz_cmp(x->z,x->n)==0)
1276 if (mpz_cmp_si(x->n,(
long)1)==0)
1286 mpz_gcd(gcd,x->z,x->n);
1288 if (mpz_cmp_si(gcd,(
long)1)!=0)
1292 if (mpz_cmp_si(x->n,(
long)1)==0)
1321 result->debug=123456;
1326 mpz_init(result->z);
1330 mpz_gcd(gcd,a->z,b->n);
1331 if (mpz_cmp_si(gcd,(
long)1)!=0)
1334 mpz_init_set(bt,b->n);
1339 mpz_mul(result->z,bt,a->z);
1346 mpz_mul(result->z,b->n,a->z);
1371 const unsigned long PP =
p;
1374 number
z =
n_Init( static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
1380 number
n =
n_Init( static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
1409 WarnS(
"Omitted denominator during coefficient mapping !");
1411 mpz_set((mpz_ptr) n, i->z);
1426 if (!(
SR_HDL(n) & SR_INT))
1435 mpz_init_set(u->z,n->n);
1455 if (!(
SR_HDL(n) & SR_INT))
1462 mpz_init_set(u->z,n->z);
1485 if (a->s!=0)
return FALSE;
1486 number
n=
b; b=
a; a=
n;
1493 if (((
long)a > 0L) && (
mpz_isNeg(b->z)))
1495 if (((
long)a < 0L) && (!
mpz_isNeg(b->z)))
1498 mpz_init_set(bb,b->n);
1500 bo=(mpz_cmp(bb,b->z)==0);
1505 if (((a->s==1) && (b->s==3))
1506 || ((b->s==1) && (a->s==3)))
1514 mpz_init_set(aa,a->z);
1515 mpz_init_set(bb,b->z);
1516 if (a->s<2) mpz_mul(bb,bb,a->n);
1517 if (b->s<2) mpz_mul(aa,aa,b->n);
1518 bo=(mpz_cmp(aa,bb)==0);
1537 mpz_init_set(b->n,a->n);
1539 mpz_init_set(b->z,a->z);
1599 mpz_add(u->z,b->z,x);
1601 if (mpz_cmp_ui(u->z,(
long)0)==0)
1607 if (mpz_cmp(u->z,b->n)==0)
1613 mpz_init_set(u->n,b->n);
1623 if (mpz_cmp_ui(u->z,(
long)0)==0)
1650 mpz_mul(x,b->z,a->n);
1651 mpz_mul(u->z,a->z,b->n);
1652 mpz_add(u->z,u->z,x);
1655 if (mpz_cmp_ui(u->z,(
long)0)==0)
1662 mpz_mul(u->n,a->n,b->n);
1663 if (mpz_cmp(u->z,u->n)==0)
1675 mpz_mul(u->z,b->z,a->n);
1676 mpz_add(u->z,u->z,a->z);
1677 if (mpz_cmp_ui(u->z,(
long)0)==0)
1683 if (mpz_cmp(u->z,a->n)==0)
1689 mpz_init_set(u->n,a->n);
1703 mpz_mul(u->z,a->z,b->n);
1704 mpz_add(u->z,u->z,b->z);
1705 if (mpz_cmp_ui(u->z,(
long)0)==0)
1711 if (mpz_cmp(u->z,b->n)==0)
1717 mpz_init_set(u->n,b->n);
1723 mpz_add(u->z,a->z,b->z);
1724 if (mpz_cmp_ui(u->z,(
long)0)==0)
1754 mpz_add(a->z,a->z,x);
1773 else if (
SR_HDL(a) & SR_INT)
1789 mpz_add(u->z,b->z,x);
1792 mpz_init_set(u->n,b->n);
1827 mpz_mul(x,b->z,a->n);
1828 mpz_mul(y,a->z,b->n);
1832 mpz_mul(a->n,a->n,b->n);
1840 mpz_mul(x,b->z,a->n);
1841 mpz_add(a->z,a->z,x);
1859 mpz_mul(x,a->z,b->n);
1860 mpz_add(a->z,b->z,x);
1862 mpz_init_set(a->n,b->n);
1869 mpz_add(a->z,a->z,b->z);
1898 mpz_sub(u->z,x,b->z);
1900 if (mpz_cmp_ui(u->z,(
long)0)==0)
1906 if (mpz_cmp(u->z,b->n)==0)
1912 mpz_init_set(u->n,b->n);
1928 if (mpz_cmp_ui(u->z,(
long)0)==0)
1940 else if (
SR_HDL(b) & SR_INT)
1950 mpz_sub(u->z,a->z,x);
1952 if (mpz_cmp_ui(u->z,(
long)0)==0)
1958 if (mpz_cmp(u->z,a->n)==0)
1964 mpz_init_set(u->n,a->n);
1978 if (mpz_cmp_ui(u->z,(
long)0)==0)
2006 mpz_mul(x,b->z,a->n);
2007 mpz_mul(y,a->z,b->n);
2011 if (mpz_cmp_ui(u->z,(
long)0)==0)
2018 mpz_mul(u->n,a->n,b->n);
2019 if (mpz_cmp(u->z,u->n)==0)
2033 mpz_mul(x,b->z,a->n);
2034 mpz_sub(u->z,a->z,x);
2036 if (mpz_cmp_ui(u->z,(
long)0)==0)
2042 if (mpz_cmp(u->z,a->n)==0)
2048 mpz_init_set(u->n,a->n);
2064 mpz_mul(x,a->z,b->n);
2065 mpz_sub(u->z,x,b->z);
2067 if (mpz_cmp_ui(u->z,(
long)0)==0)
2073 if (mpz_cmp(u->z,b->n)==0)
2079 mpz_init_set(u->n,b->n);
2085 mpz_sub(u->z,a->z,b->z);
2086 if (mpz_cmp_ui(u->z,(
long)0)==0)
2135 if (u->s==1) u->s=0;
2138 mpz_mul_ui(u->z,b->z,(
unsigned long)
SR_TO_INT(a));
2150 mpz_mul_ui(u->z,b->z,(
unsigned long)-
SR_TO_INT(a));
2156 if (mpz_cmp(u->z,b->n)==0)
2162 mpz_init_set(u->n,b->n);
2171 mpz_mul(u->z,a->z,b->z);
2181 if (mpz_cmp(u->z,b->n)==0)
2187 mpz_init_set(u->n,b->n);
2194 if (mpz_cmp(u->z,a->n)==0)
2200 mpz_init_set(u->n,a->n);
2205 mpz_mul(u->n,a->n,b->n);
2206 if (mpz_cmp(u->z,u->n)==0)
2274 mpz_init_set_si(z->z,i);
2288 mpz_init_set_si(z->z,(
long)i);
2289 mpz_init_set_si(z->n,(
long)j);
2301 mpz_init_set(z->z,i);
2302 mpz_init_set(z->n,j);
2328 #if defined(DO_LINLINE) || !defined(P_NUMBERS_H)
2347 #if MAX_NUM_SIZE == 60
2348 if (((i << 3) >> 3) == i) n=
INT_TO_SR(i);
2352 if ( (((
long)ii==i) && ((ii << 3) >> 3) == ii )) n=
INT_TO_SR(ii);
2376 if (mpz_cmp_si(a->z,(
long)0)==0)
2378 printf(
"gmp-0 in nlIsZero\n");
2444 if ( ((r << 1) >> 1) == r )
2445 return (number)(long)r;
2463 if ( ((r << 1) >> 1) == r )
2486 number u=((number) ((r>>1)+
SR_INT));
2487 if (((((LONG)
SR_HDL(u))<<1)>>1)==
SR_HDL(u))
return (u);
2510 if ( ((r << 1) >> 1) == r )
2512 return (number)(long)r;
2534 mpz_mul(aa->z,a->z,b->z);
2539 mpz_init_set(a->n,b->n);
2547 mpz_mul(a->n,a->n,b->n);
2553 #endif // DO_LINLINE
2562 else mpz_init_set(m, (mpz_ptr)n->z);
2569 mpz_init_set(z->z, m);
2570 mpz_init_set_ui(z->n, 1);
2586 mpz_gcd(a->z,a->z,b->z);
2605 mpz_add(a->z,a->z,b->z);
2609 mpz_sub(a->z,a->z,b->z);
2611 mpz_add_ui(a->z,a->z,1);
2617 mpz_sub(a->z,a->z,b->z);
2621 mpz_add(a->z,a->z,b->z);
2623 mpz_sub_ui(a->z,a->z,1);
2632 mpz_t tmp; mpz_init(tmp);
2635 else mpz_init_set(N,nN->z);
2637 else mpz_init_set(P,nP->z);
2640 mpz_init_set_si(A,(
long)0);
2641 mpz_init_set_ui(B,(
unsigned long)1);
2642 mpz_init_set_si(C,(
long)0);
2646 while(mpz_cmp_si(N,(
long)0)!=0)
2649 mpz_add(tmp,tmp,tmp);
2650 if (mpz_cmp(tmp,P)<0)
2659 if (mpz_cmp_ui(tmp,1)==0)
2666 mpz_init_set(z->z,N);
2667 mpz_init_set(z->n,B);
2680 mpz_divmod(tmp,D,E,N);
2703 mpz_init((*s)->z); (*s)->s=3;
2705 mpz_init((*t)->z); (*t)->s=3;
2707 mpz_init(g->z); g->s=3;
2714 mpz_init_set(aa,a->z);
2722 mpz_init_set(bb,b->z);
2724 mpz_gcdext(g->z,(*s)->z,(*t)->z,aa,bb);
2736 PrintS(
"// characteristic : 0\n");
2738 PrintS(
"// coeff. ring is : Integers\n");
2748 for(i=rl-1;i>=0;i--)
2750 X[
i]=CF->convSingNFactoryN(x[i],
FALSE,CF);
2751 Q[
i]=CF->convSingNFactoryN(q[i],
FALSE,CF);
2755 number
n=CF->convFactoryNSingN(xnew,CF);
2758 number
p=CF->convFactoryNSingN(qnew,CF);
2762 number n2=
nlSub(n,p,CF);
2781 numberCollectionEnumerator.
Reset();
2783 if( !numberCollectionEnumerator.
MoveNext() )
2798 int normalcount = 0;
2801 number&
n = numberCollectionEnumerator.
Current();
2813 }
while (numberCollectionEnumerator.
MoveNext() );
2820 numberCollectionEnumerator.
Reset();
2822 while (numberCollectionEnumerator.
MoveNext() )
2824 number&
n = numberCollectionEnumerator.
Current();
2826 if( (--normalcount) <= 0)
2840 numberCollectionEnumerator.
Reset();
2842 while (numberCollectionEnumerator.
MoveNext() )
2844 number& nn = numberCollectionEnumerator.
Current();
2854 cand =
nlNeg(cand,cf);
2857 numberCollectionEnumerator.
Reset();
2859 while (numberCollectionEnumerator.
MoveNext() )
2861 number&
n = numberCollectionEnumerator.
Current();
2872 numberCollectionEnumerator.
Reset();
2874 if( !numberCollectionEnumerator.
MoveNext() )
2897 number& cand1 = numberCollectionEnumerator.
Current();
2902 if ((!(
SR_HDL(cand1)&SR_INT))
2907 mpz_init_set(cand->z, cand1->n);
2912 mpz_lcm(cand->z, cand->z, cand1->n);
2917 while (numberCollectionEnumerator.
MoveNext() );
2932 numberCollectionEnumerator.
Reset();
2933 while (numberCollectionEnumerator.
MoveNext() )
2935 number&
n = numberCollectionEnumerator.
Current();
2947 numberCollectionEnumerator.
Reset();
2950 cand =
nlNeg(cand, cf);
2954 while (numberCollectionEnumerator.
MoveNext() )
2956 number &
n = numberCollectionEnumerator.
Current();
2964 if (r->cfDiv==
nlDiv)
return (
char*)
"QQ";
2965 else return (
char*)
"ZZ";
2981 #if SIZEOF_LONG == 4
2988 fprintf(f,
"4 %d ",nnn);
2993 mpz_init_set_si(tmp,nn);
3004 fprintf(f,
"%d ",n->s+5);
3045 #if SIZEOF_LONG == 8
3074 #if SIZEOF_LONG == 8
3080 default:
Werror(
"error in reading number: invalid subtype %d",sub_type);
3101 number n2=
nlDiv(n1,g,r);
3113 number c=
nlDiv(a,b,cf);
3144 r->cfSubringGcd =
nlGcd;
3166 r->cfInpNeg =
nlNeg;
3212 r->has_simple_Alloc=
FALSE;
3213 r->has_simple_Inverse=
FALSE;
3220 number nlMod(number
a, number
b)
3242 mpz_mod(r->z,al->z,bl->z);
3247 LONG ui=(
int)mpz_get_si(&r->z);
3248 if ((((ui<<3)>>3)==ui)
3249 && (mpz_cmp_si(
x->z,(
long)ui)==0))
3259 #endif // not P_NUMBERS_H
3260 #endif // LONGRAT_CC
void gmp_numerator(const CanonicalForm &f, mpz_ptr result)
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
number nlGetUnit(number n, const coeffs r)
LINLINE number nlSub(number la, number li, const coeffs r)
static void nlClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
#define MPZ_EXACTDIV(A, B, C)
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
void mpz_mul_si(mpz_ptr r, mpz_srcptr s, long int si)
#define omCheckAddrSize(addr, size)
BOOLEAN nlCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
only used if HAVE_RINGS is defined: ?
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
char * nlCoeffName(const coeffs r)
long npInt(number &n, const coeffs r)
static number nlConvFactoryNSingN(const CanonicalForm f, const coeffs r)
BOOLEAN nlGreaterZero(number za, const coeffs r)
static void nlMPZ(mpz_t m, number &n, const coeffs r)
number _nlMult_aNoImm_OR_bNoImm(number a, number b)
number nlShort1(number x)
number nlNormalizeHelper(number a, number b, const coeffs r)
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
LINLINE void nlInpAdd(number &a, number b, const coeffs r)
number nlGetDenom(number &n, const coeffs r)
int nlSize(number a, const coeffs)
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_R(const coeffs r)
#define omCheckIf(cond, test)
LINLINE number nlAdd(number la, number li, const coeffs r)
void nlInpGcd(number &a, number b, const coeffs r)
BOOLEAN nlIsMOne(number a, const coeffs r)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
(), see rinteger.h, new impl.
void nlCoeffWrite(const coeffs r, BOOLEAN details)
number nlIntDiv(number a, number b, const coeffs r)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
number nlGcd(number a, number b, const coeffs r)
coeffs nlQuot1(number c, const coeffs r)
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 ...
const char * nlRead(const char *s, number *a, const coeffs r)
void WerrorS(const char *s)
void s_readmpz_base(s_buff F, mpz_ptr a, int base)
void nlGMP(number &i, number n, const coeffs r)
number nlIntMod(number a, number b, 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 ...
BOOLEAN nlInitChar(coeffs r, void *p)
BOOLEAN nlGreater(number a, number b, const coeffs r)
LINLINE number nl_Copy(number a, const coeffs r)
void nlWrite(number &a, const coeffs r)
static number nlInitMPZ(mpz_t m, const coeffs)
real floating point (GMP) numbers
number nlMapZ(number from, const coeffs src, const coeffs dst)
CanonicalForm make_cf(const mpz_ptr n)
LINLINE BOOLEAN nlIsOne(number a, const coeffs r)
virtual void Reset()=0
Sets the enumerator to its initial position: -1, which is before the first element in the collection...
single prescision (6,6) real numbers
static number nlLcm(number a, number b, const coeffs r)
static number nlMapP(number from, const coeffs src, const coeffs dst)
LINLINE number nlNeg(number za, const coeffs r)
float nrFloat(number n)
Converts a n_R number into a float. Needed by Maps.
Coefficient rings, fields and other domains suitable for Singular polynomials.
void s_readmpz(s_buff F, mpz_t a)
const CanonicalForm CFMap CFMap & N
number nlChineseRemainderSym(number *x, number *q, int rl, BOOLEAN sym, const coeffs CF)
number nlDiv(number a, number b, const coeffs r)
LINLINE number nlMult(number a, number b, const coeffs r)
number nlInvers(number a, const coeffs r)
number _nlCopy_NoImm(number a)
void _nlInpAdd_aNoImm_OR_bNoImm(number &a, number b)
The main handler for Singular numbers which are suitable for Singular polynomials.
Templated enumerator interface for simple iteration over a generic collection of T's.
int nlDivComp(number a, number b, const coeffs r)
LINLINE void nlInpMult(number &a, number b, const coeffs r)
static void nlWriteFd(number n, FILE *f, const coeffs)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
void _nlDelete_NoImm(number *a)
number nlModP(number q, const coeffs Q, const coeffs Zp)
virtual reference Current()=0
Gets the current element in the collection (read and write).
static number nlMapLongR(number from, const coeffs src, const coeffs dst)
number nlCopyMap(number a, const coeffs src, const coeffs dst)
static const int SW_RATIONAL
set to 1 for computations over Q
const char *const nDivBy0
LINLINE BOOLEAN nlEqual(number a, number b, const coeffs r)
void nlPower(number x, int exp, number *lu, const coeffs r)
void PrintS(const char *s)
static number nlReadFd(s_buff f, const coeffs)
void nlInpIntDiv(number &a, number b, const coeffs r)
number nlExtGcd(number a, number b, number *s, number *t, const coeffs)
LINLINE BOOLEAN nlIsZero(number za, const coeffs r)
(mpz_ptr), see rmodulon,h
BOOLEAN _nlEqual_aNoImm_OR_bNoImm(number a, number b)
number nlShort3_noinline(number x)
static void nlClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
static CanonicalForm nlConvSingNFactoryN(number n, const BOOLEAN setChar, const coeffs)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
number nlChineseRemainder(number *x, number *q, int rl, const coeffs C)
number nlBigInt(number &n)
void nlNormalize(number &x, const coeffs r)
void 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...
number _nlNeg_NoImm(number a)
static number nlShort3(number x)
static number nlRandom(siRandProc p, number v2, number, const coeffs cf)
void gmp_denominator(const CanonicalForm &f, mpz_ptr result)
REvaluation E(1, terms.length(), IntRandom(25))
LINLINE void nlDelete(number *a, const coeffs r)
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...
BOOLEAN nlDivBy(number a, number b, const coeffs)
virtual bool MoveNext()=0
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
BOOLEAN nlIsUnit(number a, const coeffs)
long nlInt(number &n, const coeffs r)
number _nlMult_aImm_bImm_rNoImm(number a, number b)
nMapFunc nlSetMap(const coeffs src, const coeffs dst)
number _nlAdd_aNoImm_OR_bNoImm(number a, number b)
long s_readlong(s_buff F)
number nlExactDiv(number a, number b, const coeffs r)
number _nlSub_aNoImm_OR_bNoImm(number a, number b)
number nlMapGMP(number from, const coeffs src, const coeffs dst)
BOOLEAN nlDBTest(number a, const char *f, const int l)
LINLINE number nlInit(long i, const coeffs r)
static char * nlCoeffString(const coeffs r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
number nlMapMachineInt(number from, const coeffs, const coeffs)
static number nlMapR(number from, const coeffs src, const coeffs dst)
number nlGetNumerator(number &n, const coeffs r)
LINLINE number nlCopy(number a, const coeffs r)
void Werror(const char *fmt,...)
const CanonicalForm const CanonicalForm const CanonicalForm const CanonicalForm & cand
number nlFarey(number nN, number nP, const coeffs CF)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL