"calib/gmpmisc.h"
Header.The "calib/gmpmisc.h"
header contains useful GMP extensions
that are unavailable in older versions of GMP.
To prevent name clashes with newer versions of GMP that provide
similar functions, we adopt CALIB-style names for these functions.
There are three broad classes of GMP functions provided by CALIB:
void calib_mpq_set_z_z (mpq_ptr rop, mpz_srcptr op1, mpz_srcptr op2);
Set rop
to op1 / op2
.
void calib_mpq_mul_si (mpq_ptr rop, mpq_srcptr op1, calib_si_t op2);
Set rop
to op1 * op2
.
void calib_mpq_mul_z (mpq_ptr rop, mpq_srcptr op1, mpz_srcptr op2);
Set rop
to op1 * op2
.
void calib_mpq_div_si (mpq_ptr rop, mpq_srcptr op1, calib_si_t op2);
Set rop
to op1 / op2
.
void calib_mpq_div_z (mpq_ptr rop, mpq_srcptr op1, mpz_srcptr op2);
Set rop
to op1 / op2
.
mpz_ptr calib_new_Z_vector (size_t n);
Returns a dynamically-allocated and initialized (to zero) vector of
n
GMP integers.
void calib_free_Z_vector (mpz_ptr p, size_t n);
Clears and frees dynamically-allocated vector p
of n
GMP
integers.
void calib_init_Z_vector (mpz_ptr p, size_t n);
Initialize the given vector p
of n
GMP integers.
void calib_clear_Z_vector (mpz_ptr p, size_t n);
Clear the given vector p
of n
GMP integers.
void calib_copy_Z_vector (mpz_ptr dst, mpz_srcptr src, size_t n);
Copy vector src
of n
GMP integers into vector
dst
.
These vectors must not overlap.
void calib_print_Z_vector (mpz_srcptr p, size_t n);
Print vector p
of n
GMP integers, separated by spaces
and terminated with a newline.
mpq_ptr calib_new_Q_vector (size_t n);
Returns a dynamically-allocated and initialized (to zero) vector of
n
GMP rationals.
void calib_free_Q_vector (mpq_ptr p, size_t n);
Clears and frees dynamically-allocated vector p
of n
GMP
rationals.
void calib_init_Q_vector (mpq_ptr p, size_t n);
Initialize the given vector p
of n
GMP rationals.
void calib_clear_Q_vector (mpp_ptr p, size_t n);
Clear the given vector p
of n
GMP rationals.
void calib_copy_Q_vector (mpq_ptr dst, mpq_srcptr src, size_t n);
Copy vector src
of n
GMP rationals into vector
dst
.
These vectors must not overlap.
void calib_print_Q_vector (mpq_srcptr p, size_t n);
Print vector p
of n
GMP rationals, separated by spaces
and terminated with a newline.
size_t calib_mpz_bit_size (mpz_srcptr z);
Return the bit size of GMP integer z
.
(The bit size is the number of significant bits of the absolute value.)
size_t calib_mpz_bit_size (mpz_srcptr op, size_t n);
Return the maximum bit size among all n
elements of vector
op
of GMP integers.
size_t calib_mpq_bit_size (mpq_srcptr q);
Return the bit size of GMP rational q
.
(The bit size is the number of significant bits in the absolute value
of the product of the numerator and denominator.)
size_t calib_mpq_bit_size (mpq_srcptr op, size_t n);
Return the maximum bit size among all n
elements of vector
op
of GMP rationals.