126 DEBINCLEVEL( cerr,
"chineseRemainder( ... CFArray ... )" );
128 ASSERT(
x.min() == q.
min() &&
x.size() == q.
size(),
"incompatible arrays" );
130 int i,
j, n =
x.size(), start =
x.min();
132 DEBOUTLN( cerr,
"array size = " << n );
137 while (
i < start + n - 1 )
163 DEBDECLEVEL( cerr,
"chineseRemainder( ... CFArray ... )" );
166#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
218#elif defined(HAVE_NTL)
221 SqrRoot (
bound, NTLq/2);
225 for (
i =
f;
i.hasTerms();
i++ )
234 fmpq_reconstruct_fmpz(FLINTres,FLINTc,FLINTq);
237#elif defined(HAVE_NTL)
241 bool lessZero= (
sign (NTLc) == -1);
243 NTL::negate (NTLc, NTLc);
245 if (ReconstructRational (NTLnum, NTLden, NTLc, NTLq,
bound,
bound))
248 NTL::negate (NTLnum, NTLnum);
268 fmpq_clear(FLINTres);
296 for (
i = 0;
i < len;
i++)
prod *= n[
i];
298 for (
i = 0;
i < len;
i++)
CanonicalForm convertFmpq2CF(const fmpq_t q)
conversion of a FLINT rational to CanonicalForm
void convertCF2initFmpz(fmpz_t result, const CanonicalForm &f)
conversion of a factory integer to fmpz_t(init.)
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Conversion to and from NTL.
const CanonicalForm CFMap CFMap & N
#define ASSERT(expression, message)
CanonicalForm Farey(const CanonicalForm &f, const CanonicalForm &q)
Farey rational reconstruction.
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,...
static CanonicalForm chin_mul_inv(const CanonicalForm a, const CanonicalForm b, int ind, CFArray &inv)
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
void chineseRemainderCached(const CFArray &a, const CFArray &n, CanonicalForm &xnew, CanonicalForm &prod, CFArray &inv)
static const int SW_RATIONAL
set to 1 for computations over Q
Iterators for CanonicalForm's.
static CanonicalForm bound(const CFMatrix &M)
VAR void(* factoryError)(const char *s)
class to iterate through CanonicalForm's
factory's class for variables
functions to print debug output
#define DEBINCLEVEL(stream, msg)
#define DEBOUTLN(stream, objects)
#define DEBDECLEVEL(stream, msg)
const CanonicalForm int s
REvaluation E(1, terms.length(), IntRandom(25))
bool isZero(const CFArray &A)
checks if entries of A are zero