24 mpz_init_set(
prod,
m[0]);
32 mpz_invert(u,
m[
j],
m[
i]);
33 mpz_mul(C[
i], C[
i], u);
34 mpz_mod(C[
i], C[
i],
m[
i]);
42static void CRT(mpz_t
x, mpz_ptr *
v, mpz_ptr* C, mpz_ptr *
m,
int t)
104 mpz_t nn; mpz_init(nn);
106 if (mpz_cmp(nn,prod2)>0) mpz_sub(nn,nn,
prod);
124 int cnt=0;
int rw=0;
int cl=0;
131 if (xx[
j]->
nrows >rw) rw=xx[
j]->nrows;
136 WerrorS(
"format mismatch in CRT");
149 qq[
j]=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
151 C[
j]=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
153 poly *
p=(poly *)
omAlloc(rl*
sizeof(poly));
158 mpz_init_set(prod2,
prod);
159 mpz_tdiv_ui(prod2,2);
160 for(
i=cnt-1;
i>=0;
i--)
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
poly p_ChineseRemainder(poly *xx, mpz_ptr *x, mpz_ptr *q, int rl, mpz_ptr *C, mpz_t prod2, mpz_t prod, const ring R)
static void CRT(mpz_t x, mpz_ptr *v, mpz_ptr *C, mpz_ptr *m, int t)
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
static void prepareCRT(mpz_ptr C[], mpz_ptr *m, mpz_t prod, int t)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define omFreeSize(addr, size)
static number p_SetCoeff(poly p, number n, ring r)
static poly pReverse(poly p)
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
static int p_LmCmp(poly p, poly q, const ring r)
static void p_Delete(poly *p, const ring r)
static poly p_LmFreeAndNext(poly p, ring)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix