Loading...
Searching...
No Matches
rintegers2.cc
Go to the documentation of this file.
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: numbers (integers)
*/
#if SI_INTEGER_VARIANT == 2
#include "coeffs/si_gmp.h"
/*
* Multiply two numbers
*/
static number nrzMult (number a, number b, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_mul(erg, (mpz_ptr) a, (mpz_ptr) b);
return (number) erg;
}
static void nrzInpMult (number &a, number b, const coeffs)
{
mpz_mul((mpz_ptr) a, (mpz_ptr) a, (mpz_ptr) b);
}
/*
* Give the smallest non unit k, such that a * x = k = b * y has a solution
*/
static number nrzLcm (number a,number b,const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_lcm(erg, (mpz_ptr) a, (mpz_ptr) b);
return (number) erg;
}
/*
* Give the largest non unit k, such that a = x * k, b = y * k has
* a solution.
*/
static number nrzGcd (number a,number b,const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_gcd(erg, (mpz_ptr) a, (mpz_ptr) b);
return (number) erg;
}
/*
* Give the largest non unit k, such that a = x * k, b = y * k has
* a solution and r, s, s.t. k = s*a + t*b
*/
static number nrzExtGcd (number a, number b, number *s, number *t, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_ptr bs = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_ptr bt = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_init(bs);
mpz_init(bt);
mpz_gcdext(erg, bs, bt, (mpz_ptr) a, (mpz_ptr) b);
*s = (number) bs;
*t = (number) bt;
return (number) erg;
}
static number nrzXExtGcd (number a, number b, number *s, number *t, number *u, number *v, const coeffs )
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_ptr bs = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_ptr bt = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_init(bs);
mpz_init(bt);
mpz_gcdext(erg, bs, bt, (mpz_ptr)a, (mpz_ptr)b);
mpz_ptr bu = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_ptr bv = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set(bu, (mpz_ptr) b);
mpz_init_set(bv, (mpz_ptr) a);
assume(mpz_cmp_si(erg, 0));
mpz_div(bu, bu, erg);
mpz_div(bv, bv, erg);
mpz_mul_si(bu, bu, -1);
*u = (number) bu;
*v = (number) bv;
*s = (number) bs;
*t = (number) bt;
return (number) erg;
}
static void nrzPower (number a, int i, number * result, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_pow_ui(erg, (mpz_ptr) a, i);
*result = (number) erg;
}
/*
* create a number from int
*/
number nrzInit (long i, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set_si(erg, i);
return (number) erg;
}
void nrzDelete(number *a, const coeffs)
{
if (*a != NULL)
{
mpz_clear((mpz_ptr) *a);
omFreeBin((ADDRESS) *a, gmp_nrz_bin);
*a = NULL;
}
}
static number nrzCopy(number a, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set(erg, (mpz_ptr) a);
return (number) erg;
}
#if 0
number nrzCopyMap(number a, const coeffs /*src*/, const coeffs dst)
{
return nrzCopy(a,dst);
}
#endif
int nrzSize(number a, const coeffs)
{
return mpz_size1((mpz_ptr)a);
}
/*
* convert a number to int
*/
static long nrzInt(number &n, const coeffs)
{
return mpz_get_si( (mpz_ptr)n);
}
static number nrzAdd (number a, number b, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_add(erg, (mpz_ptr) a, (mpz_ptr) b);
return (number) erg;
}
static void nrzInpAdd (number &a, number b, const coeffs)
{
mpz_add((mpz_ptr) a, (mpz_ptr) a, (mpz_ptr) b);
}
static number nrzSub (number a, number b, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_sub(erg, (mpz_ptr) a, (mpz_ptr) b);
return (number) erg;
}
static number nrzGetUnit (number, const coeffs r)
{
return nrzInit(1, r);
}
static BOOLEAN nrzIsUnit (number a, const coeffs)
{
return 0 == mpz_cmpabs_ui((mpz_ptr) a, 1);
}
static BOOLEAN nrzIsZero (number a, const coeffs)
{
return 0 == mpz_sgn1((mpz_ptr)a);
}
static BOOLEAN nrzIsOne (number a, const coeffs)
{
return (0 == mpz_cmp_ui((mpz_ptr) a, 1));
}
static BOOLEAN nrzIsMOne (number a, const coeffs)
{
return (0 == mpz_cmp_si((mpz_ptr) a, -1));
}
static BOOLEAN nrzEqual (number a,number b, const coeffs)
{
return 0 == mpz_cmp((mpz_ptr) a, (mpz_ptr) b);
}
static BOOLEAN nrzGreater (number a,number b, const coeffs)
{
return 0 < mpz_cmp((mpz_ptr) a, (mpz_ptr) b);
}
static BOOLEAN nrzGreaterZero (number k, const coeffs)
{
return 0 < mpz_sgn1((mpz_ptr) k);
}
static BOOLEAN nrzDivBy (number a,number b, const coeffs)
{
return mpz_divisible_p((mpz_ptr) a, (mpz_ptr) b) != 0;
}
static int nrzDivComp(number a, number b, const coeffs r)
{
if (nrzDivBy(a, b, r))
{
if (nrzDivBy(b, a, r)) return 2;
return -1;
}
if (nrzDivBy(b, a, r)) return 1;
return 0;
}
static number nrzDiv (number a,number b, const coeffs r)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
if (nrzIsZero(b,r))
{
WerrorS(nDivBy0);
}
else
{
mpz_ptr r = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(r);
mpz_tdiv_qr(erg, r, (mpz_ptr) a, (mpz_ptr) b);
mpz_clear(r);
omFreeBin(r, gmp_nrz_bin);
}
return (number) erg;
}
static number nrzExactDiv (number a,number b, const coeffs r)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
if (nrzIsZero(b,r))
{
WerrorS(nDivBy0);
}
else
{
mpz_tdiv_q(erg, (mpz_ptr) a, (mpz_ptr) b);
}
return (number) erg;
}
static number nrzEucNorm (number a, const coeffs )
{
mpz_ptr abs = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(abs);
mpz_abs(abs, (mpz_ptr)a);
return (number) abs;
}
static number nrzSmallestQuotRem (number a, number b, number * r, const coeffs )
{
mpz_ptr qq = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(qq);
mpz_ptr rr = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(rr);
int gsign = mpz_sgn((mpz_ptr) b);
mpz_t gg, ghalf;
mpz_init(gg);
mpz_init(ghalf);
mpz_abs(gg, (mpz_ptr) b);
mpz_fdiv_qr(qq, rr, (mpz_ptr) a, gg);
mpz_tdiv_q_2exp(ghalf, gg, 1);
if (mpz_cmp(rr, ghalf) > 0) // r > ghalf
{
mpz_sub(rr, rr, gg);
mpz_add_ui(qq, qq, 1);
}
if (gsign < 0) mpz_neg(qq, qq);
mpz_clear(gg);
mpz_clear(ghalf);
if (r==NULL)
{
mpz_clear(rr);
omFreeBin(rr,gmp_nrz_bin);
}
else
{
*r=(number)rr;
}
return (number) qq;
}
/*
static number nrzQuotRem (number a, number b, number * r, const coeffs )
{
mpz_ptr qq = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(qq);
mpz_ptr rr = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(rr);
mpz_tdiv_qr(qq, rr, (mpz_ptr) a, (mpz_ptr) b);
if (r==NULL)
{
mpz_clear(rr);
omFreeBin(rr,gmp_nrz_bin);
}
else
{
*r=(number)rr;
}
return (number) qq;
}
*/
static number nrzIntMod (number a,number b, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
mpz_ptr r = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(r);
mpz_tdiv_qr(erg, r, (mpz_ptr) a, (mpz_ptr) b);
mpz_clear(erg);
omFreeBin(erg, gmp_nrz_bin);
return (number) r;
}
static number nrzInvers (number c, const coeffs r)
{
if (!nrzIsUnit((number) c, r))
{
WerrorS("Non invertible element.");
return nrzInit(0,r);
}
return nrzCopy(c,r);
}
static number nrzNeg (number c, const coeffs)
{
// nNeg inplace !!!
mpz_mul_si((mpz_ptr) c, (mpz_ptr) c, -1);
return c;
}
static number nrzMapMachineInt(number from, const coeffs /*src*/, const coeffs /*dst*/)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set_ui(erg, (unsigned long) from);
return (number) erg;
}
static number nrzMapZp(number from, const coeffs /*src*/, const coeffs /*dst*/)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set_si(erg, (long) from);
return (number) erg;
}
static number nrzMapQ(number from, const coeffs src, const coeffs /*dst*/)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
nlMPZ(erg, from, src);
return (number) erg;
}
static number nrzMaplongR(number from, const coeffs src, const coeffs dst)
{
gmp_float *ff=(gmp_float*)from;
if (mpf_fits_slong_p(ff->t))
{
long l=mpf_get_si(ff->t);
return nrzInit(l,dst);
}
char *out=floatToStr(*(gmp_float*)from, src->float_len);
char *p=strchr(out,'.');
*p='\0';
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
if (out[0]=='-')
{
mpz_set_str(erg,out+1,10);
mpz_mul_si(erg, erg, -1);
}
else
{
mpz_set_str(erg,out,10);
}
omFree( (void *)out );
return (number) erg;
}
static nMapFunc nrzSetMap(const coeffs src, const coeffs /*dst*/)
{
/* dst = currRing */
/* dst = nrn */
if ((src->rep==n_rep_gmp)
&& (nCoeff_is_Z(src) || nCoeff_is_Zn(src) || nCoeff_is_Ring_PtoM(src)))
{
return ndCopyMap; //nrzCopyMap;
}
if ((src->rep==n_rep_gap_gmp) /*&& nCoeff_is_Z(src)*/)
{
return ndCopyMap; //nrzCopyMap;
}
if (nCoeff_is_Ring_2toM(src))
{
return nrzMapMachineInt;
}
if (nCoeff_is_Zp(src))
{
return nrzMapZp;
}
if (getCoeffType(src)==n_Q /*nCoeff_is_Q(src) or coeffs_BIGINT*/)
{
return nrzMapQ;
}
if (nCoeff_is_long_R(src))
{
return nrzMaplongR;
}
return NULL; // default
}
/*
* set the exponent (allocate and init tables) (TODO)
*/
void nrzSetExp(int, coeffs)
{
}
void nrzInitExp(int, coeffs)
{
}
#ifdef LDEBUG
static BOOLEAN nrzDBTest (number, const char *, const int, const coeffs)
{
return TRUE;//TODO
}
#endif
void nrzWrite (number a, const coeffs)
{
char *s,*z;
if (a==NULL)
{
StringAppendS("o");
}
else
{
int l=mpz_sizeinbase((mpz_ptr) a, 10) + 2;
s=(char*)omAlloc(l);
z=mpz_get_str(s,10,(mpz_ptr) a);
StringAppendS(z);
omFreeSize((ADDRESS)s,l);
}
}
/*2
* extracts a long integer from s, returns the rest (COPY FROM longrat0.cc)
*/
static const char * nlEatLongC(char *s, mpz_ptr i)
{
const char * start=s;
if (*s<'0' || *s>'9')
{
mpz_set_ui(i,1);
return s;
}
while (*s >= '0' && *s <= '9') s++;
if (*s=='\0')
{
mpz_set_str(i,start,10);
}
else
{
char c=*s;
*s='\0';
mpz_set_str(i,start,10);
*s=c;
}
return s;
}
static CanonicalForm nrzConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs /*r*/)
{
if (setChar) setCharacteristic( 0 );
CanonicalForm term;
mpz_t num;
mpz_init_set(num, *((mpz_t*)n));
term = make_cf(num);
return term;
}
static number nrzConvFactoryNSingN(const CanonicalForm n, const coeffs r)
{
if (n.isImm())
return nrzInit(n.intval(),r);
else
{
mpz_ptr m = (mpz_ptr) omAllocBin(gmp_nrz_bin);
gmp_numerator(n,m);
if (!n.den().isOne())
{
WarnS("denominator is not 1 in factory");
}
return (number) m;
}
}
static const char * nrzRead (const char *s, number *a, const coeffs)
{
mpz_ptr z = (mpz_ptr) omAllocBin(gmp_nrz_bin);
{
mpz_init(z);
s = nlEatLongC((char *) s, z);
}
*a = (number) z;
return s;
}
static coeffs nrzQuot1(number c, const coeffs r)
{
long ch = r->cfInt(c, r);
mpz_t dummy;
mpz_init_set_ui(dummy, ch);
ZnmInfo info;
info.base = dummy;
info.exp = (unsigned long) 1;
coeffs rr = nInitChar(n_Zn, (void*)&info);
mpz_clear(dummy);
return(rr);
}
static number nrzInitMPZ(mpz_t m, const coeffs)
{
mpz_ptr z = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init_set(z, m);
return (number)z;
}
static void nrzMPZ(mpz_t res, number &a, const coeffs)
{
mpz_init_set(res, (mpz_ptr) a);
}
static number nrzFarey(number r, number N, const coeffs R)
{
number a0 = nrzCopy(N, R);
number b0 = nrzInit(0, R);
number a1 = nrzCopy(r, R);
number b1 = nrzInit(1, R);
number two = nrzInit(2, R);
#if 0
PrintS("Farey start with ");
n_Print(r, R);
PrintS(" mod ");
n_Print(N, R);
PrintLn();
#endif
while (1)
{
number as = nrzMult(a1, a1, R);
n_InpMult(as, two, R);
if (nrzGreater(N, as, R))
{
nrzDelete(&as, R);
break;
}
nrzDelete(&as, R);
number q = nrzDiv(a0, a1, R);
number t = nrzMult(a1, q, R),
s = nrzSub(a0, t, R);
nrzDelete(&a0, R);
a0 = a1;
a1 = s;
nrzDelete(&t, R);
t = nrzMult(b1, q, R);
s = nrzSub(b0, t, R);
nrzDelete(&b0, R);
b0 = b1;
b1 = s;
nrzDelete(&t, R);
nrzDelete(&q, R);
}
number as = nrzMult(b1, b1, R);
n_InpMult(as, two, R);
nrzDelete(&two, R);
if (nrzGreater(as, N, R))
{
nrzDelete(&a0, R);
nrzDelete(&a1, R);
nrzDelete(&b0, R);
nrzDelete(&b1, R);
nrzDelete(&as, R);
return NULL;
}
nrzDelete(&as, R);
nrzDelete(&a0, R);
nrzDelete(&b0, R);
number a, b, ab;
coeffs Q = nInitChar(n_Q, 0);
nMapFunc f = n_SetMap(R, Q);
a = f(a1, R, Q);
b = f(b1, R, Q);
ab = n_Div(a, b, Q);
n_Delete(&a, Q);
n_Delete(&b, Q);
nKillChar(Q);
nrzDelete(&a1, R);
nrzDelete(&b1, R);
return ab;
}
void nrzWriteFd(number n, const ssiInfo* d, const coeffs)
{
mpz_out_str (d->f_write,SSI_BASE, (mpz_ptr)n);
fputc(' ',d->f_write);
}
void nrzWriteFd_S(number n, const coeffs)
{
int l=mpz_sizeinbase((mpz_ptr)n,SSI_BASE);
char *str=(char*)omAlloc(l+2);
mpz_get_str (str,SSI_BASE, (mpz_ptr)n);
StringAppend("%s ",str);
omFreeSize(str,l+2);
}
number nrzReadFd(const ssiInfo *d, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
s_readmpz_base(d->f_read,erg,SSI_BASE);
return (number)erg;
}
number nrzReadFd_S(char**s, const coeffs)
{
mpz_ptr erg = (mpz_ptr) omAllocBin(gmp_nrz_bin);
mpz_init(erg);
s_readmpz_base_S(s,erg,SSI_BASE);
return (number)erg;
}
BOOLEAN nrzInitChar(coeffs r, void *)
{
assume( getCoeffType(r) == n_Z );
r->is_field=FALSE;
r->is_domain=TRUE;
r->rep=n_rep_gmp;
//r->nCoeffIsEqual = ndCoeffIsEqual;
r->cfCoeffName = nrzCoeffName;
//r->cfKillChar = ndKillChar;
r->cfMult = nrzMult;
r->cfInpMult = nrzInpMult;
r->cfSub = nrzSub;
r->cfAdd = nrzAdd;
r->cfInpAdd = nrzInpAdd;
r->cfDiv = nrzDiv;
r->cfIntMod= nrzIntMod;
r->cfExactDiv= nrzExactDiv;
r->cfInit = nrzInit;
r->cfInitMPZ = nrzInitMPZ;
r->cfMPZ = nrzMPZ;
r->cfSize = nrzSize;
r->cfInt = nrzInt;
r->cfDivComp = nrzDivComp;
r->cfIsUnit = nrzIsUnit;
r->cfGetUnit = nrzGetUnit;
r->cfExtGcd = nrzExtGcd;
r->cfXExtGcd = nrzXExtGcd;
r->cfDivBy = nrzDivBy;
r->cfEucNorm = nrzEucNorm;
r->cfQuotRem = nrzSmallestQuotRem;
r->cfInpNeg = nrzNeg;
r->cfInvers= nrzInvers;
r->cfCopy = nrzCopy;
r->cfWriteLong = nrzWrite;
r->cfRead = nrzRead;
r->cfGreater = nrzGreater;
r->cfEqual = nrzEqual;
r->cfIsZero = nrzIsZero;
r->cfIsOne = nrzIsOne;
r->cfIsMOne = nrzIsMOne;
r->cfGreaterZero = nrzGreaterZero;
r->cfPower = nrzPower;
r->cfGcd = nrzGcd;
r->cfLcm = nrzLcm;
r->cfDelete= nrzDelete;
r->cfSetMap = nrzSetMap;
r->cfQuot1 = nrzQuot1;
r->convSingNFactoryN=nrzConvSingNFactoryN;
r->convFactoryNSingN=nrzConvFactoryNSingN;
r->cfChineseRemainder=nlChineseRemainderSym;
r->cfFarey=nrzFarey;
r->cfWriteFd=nrzWriteFd;
r->cfWriteFd_S=nrzWriteFd_S;
r->cfReadFd=nrzReadFd;
r->cfReadFd_S=nrzReadFd_S;
// debug stuff
#ifdef LDEBUG
r->cfDBTest=nrzDBTest;
#endif
r->ch = 0;
r->has_simple_Alloc=FALSE;
r->has_simple_Inverse=FALSE;
return FALSE;
}
#endif
abs
Rational abs(const Rational &a)
Definition GMPrat.cc:436
SSI_BASE
#define SSI_BASE
Definition auxiliary.h:136
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
setCharacteristic
void FACTORY_PUBLIC setCharacteristic(int c)
Definition cf_char.cc:28
num
CanonicalForm num(const CanonicalForm &f)
Definition canonicalform.h:337
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
f
FILE * f
Definition checklibs.c:9
CanonicalForm
factory's main class
Definition canonicalform.h:86
CanonicalForm::den
CanonicalForm den() const
den() returns the denominator of CO if CO is a rational number, 1 (from the current domain!...
Definition canonicalform.cc:628
CanonicalForm::isOne
CF_NO_INLINE bool isOne() const
CanonicalForm::intval
long intval() const
conversion functions
Definition canonicalform.cc:200
CanonicalForm::isImm
bool isImm() const
Definition canonicalform.h:110
gmp_float
Definition mpr_complex.h:32
gmp_float::t
mpf_t t
Definition mpr_complex.h:153
term
Definition int_poly.h:33
nCoeff_is_Z
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:811
ndCopyMap
number ndCopyMap(number a, const coeffs src, const coeffs dst)
Definition numbers.cc:293
nCoeff_is_long_R
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition coeffs.h:886
nCoeff_is_Ring_PtoM
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
Definition coeffs.h:729
n_Q
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
n_Zn
@ n_Zn
only used if HAVE_RINGS is defined
Definition coeffs.h:44
n_Z
@ n_Z
only used if HAVE_RINGS is defined
Definition coeffs.h:43
n_Print
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition numbers.cc:662
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
n_Div
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:618
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
nCoeff_is_Zn
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
Definition coeffs.h:821
nCoeff_is_Zp
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition coeffs.h:795
nCoeff_is_Ring_2toM
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
Definition coeffs.h:726
n_InpMult
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:644
n_rep_gap_gmp
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition coeffs.h:119
n_rep_gmp
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
Definition coeffs.h:122
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
nKillChar
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:563
WarnS
#define WarnS
Definition emacs.cc:78
StringAppend
#define StringAppend
Definition emacs.cc:79
result
return result
Definition facAbsBiFact.cc:76
s
const CanonicalForm int s
Definition facAbsFact.cc:51
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
make_cf
CanonicalForm FACTORY_PUBLIC make_cf(const mpz_ptr n)
Definition singext.cc:66
gmp_numerator
void FACTORY_PUBLIC gmp_numerator(const CanonicalForm &f, mpz_ptr result)
Definition singext.cc:20
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
info
#define info
Definition libparse.cc:1256
mpz_mul_si
void mpz_mul_si(mpz_ptr r, mpz_srcptr s, long int si)
Definition longrat.cc:177
nlMPZ
void nlMPZ(mpz_t m, number &n, const coeffs r)
get numerator as mpz_t
Definition longrat.cc:2790
nlChineseRemainderSym
number nlChineseRemainderSym(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
Definition longrat.cc:3075
assume
#define assume(x)
Definition mod2.h:389
floatToStr
char * floatToStr(const gmp_float &r, const unsigned int oprec)
Definition mpr_complex.cc:567
LibThread::str
char * str(leftv arg)
Definition shared.cc:699
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
nDivBy0
const char *const nDivBy0
Definition numbers.h:90
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omAllocBin
#define omAllocBin(bin)
Definition omAllocDecl.h:205
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
omFreeBin
#define omFreeBin(addr, bin)
Definition omAllocDecl.h:259
NULL
#define NULL
Definition omList.c:12
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
nrzCoeffName
static char * nrzCoeffName(const coeffs)
Definition rintegers.cc:25
gmp_nrz_bin
VAR omBin gmp_nrz_bin
Definition rintegers.cc:23
nrzReadFd
number nrzReadFd(const ssiInfo *d, const coeffs)
nrzWrite
void nrzWrite(number a, const coeffs r)
nrzWriteFd_S
void nrzWriteFd_S(number n, const coeffs)
nrzDelete
void nrzDelete(number *a, const coeffs)
nrzSize
int nrzSize(number a, const coeffs)
nrzReadFd_S
number nrzReadFd_S(char **s, const coeffs)
nrzInitChar
BOOLEAN nrzInitChar(coeffs r, void *parameter)
nrzInit
number nrzInit(long i, const coeffs r)
nrzWriteFd
void nrzWriteFd(number n, const ssiInfo *d, const coeffs)
ZnmInfo
Definition rmodulon.h:17
s_readmpz_base
void s_readmpz_base(s_buff F, mpz_ptr a, int base)
Definition s_buff.cc:264
s_readmpz_base_S
void s_readmpz_base_S(char **s, mpz_ptr a, int base)
Definition s_buff.cc:310
ssiInfo::f_read
s_buff f_read
Definition s_buff.h:22
ssiInfo::f_write
FILE * f_write
Definition s_buff.h:23
ssiInfo
Definition s_buff.h:21
si_gmp.h
mpz_size1
#define mpz_size1(A)
Definition si_gmp.h:17
mpz_sgn1
#define mpz_sgn1(A)
Definition si_gmp.h:18
R
#define R
Definition sirandom.c:27
Q
#define Q
Definition sirandom.c:26