Next: , Previous: , Up: Top   [Contents][Index]


21 The "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:

calib_mpq_set_z_z:

	void	calib_mpq_set_z_z (mpq_ptr		rop,
				   mpz_srcptr		op1,
				   mpz_srcptr		op2);

Set rop to op1 / op2.

calib_mpq_mul_si:

	void	calib_mpq_mul_si (mpq_ptr		rop,
				  mpq_srcptr		op1,
				  calib_si_t		op2);

Set rop to op1 * op2.

calib_mpq_mul_z:

	void	calib_mpq_mul_z (mpq_ptr		rop,
				 mpq_srcptr		op1,
				 mpz_srcptr		op2);

Set rop to op1 * op2.

calib_mpq_div_si:

	void	calib_mpq_div_si (mpq_ptr		rop,
				  mpq_srcptr		op1,
				  calib_si_t		op2);

Set rop to op1 / op2.

calib_mpq_div_z:

	void	calib_mpq_div_z (mpq_ptr		rop,
				 mpq_srcptr		op1,
				 mpz_srcptr		op2);

Set rop to op1 / op2.

calib_new_Z_vector:

	mpz_ptr	calib_new_Z_vector (size_t n);

Returns a dynamically-allocated and initialized (to zero) vector of n GMP integers.

calib_free_Z_vector:

	void	calib_free_Z_vector (mpz_ptr p, size_t n);

Clears and frees dynamically-allocated vector p of n GMP integers.

calib_init_Z_vector:

	void	calib_init_Z_vector (mpz_ptr p, size_t n);

Initialize the given vector p of n GMP integers.

calib_clear_Z_vector:

	void	calib_clear_Z_vector (mpz_ptr p, size_t n);

Clear the given vector p of n GMP integers.

calib_copy_Z_vector:

	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.

calib_print_Z_vector:

	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.

calib_new_Q_vector:

	mpq_ptr	calib_new_Q_vector (size_t n);

Returns a dynamically-allocated and initialized (to zero) vector of n GMP rationals.

calib_free_Q_vector:

	void	calib_free_Q_vector (mpq_ptr p, size_t n);

Clears and frees dynamically-allocated vector p of n GMP rationals.

calib_init_Q_vector:

	void	calib_init_Q_vector (mpq_ptr p, size_t n);

Initialize the given vector p of n GMP rationals.

calib_clear_Q_vector:

	void	calib_clear_Q_vector (mpp_ptr p, size_t n);

Clear the given vector p of n GMP rationals.

calib_copy_Q_vector:

	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.

calib_print_Q_vector:

	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.

calib_mpz_bit_size:

	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.)

calib_mpz_bit_size_vector:

	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.

calib_mpq_bit_size:

	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.)

calib_mpq_bit_size_vector:

	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.


Next: , Previous: , Up: Top   [Contents][Index]