Flint2-0.1.0.5: Haskell bindings for the flint library for number theory

Data.Number.Flint.Support.Mpf.Vec

Synopsis

# Memory management

_mpf_vec_init len

Returns a vector of the given length of initialised mpf's with at least the given precision.

_mpf_vec_clear vec len

Clears the given vector.

# Randomisation

_mpf_vec_randtest f state len bits

Sets the entries of a vector of the given length to random numbers in the interval $$[0, 1)$$ with bits significant bits in the mantissa or less if their precision is smaller.

# Assignment and basic manipulation

_mpf_vec_zero vec len

Zeros the vector (vec, len).

_mpf_vec_set :: Ptr CMpf -> Ptr CMpf -> CLong -> IO () Source #

_mpf_vec_set vec1 vec2 len2

Copies the vector vec2 of the given length into vec1. A check is made to ensure vec1 and vec2 are different.

# Conversion

_mpf_vec_set_fmpz_vec appv vec len

Export the array of len entries starting at the pointer vec to an array of mpfs appv.

# Comparison

_mpf_vec_equal vec1 vec2 len

Compares two vectors of the given length and returns $$1$$ if they are equal, otherwise returns $$0$$.

_mpf_vec_is_zero vec len

Returns $$1$$ if (vec, len) is zero, and $$0$$ otherwise.

_mpf_vec_approx_equal vec1 vec2 len bits

Compares two vectors of the given length and returns $$1$$ if the first bits bits of their entries are equal, otherwise returns $$0$$.

_mpf_vec_add :: Ptr CMpf -> Ptr CMpf -> Ptr CMpf -> CLong -> IO () Source #

Adds the given vectors of the given length together and stores the result in res.

_mpf_vec_sub :: Ptr CMpf -> Ptr CMpf -> Ptr CMpf -> CLong -> IO () Source #

_mpf_vec_sub res vec1 vec2 len2

Sets (res, len2) to (vec1, len2) minus (vec2, len2).

# Scalar multiplication

_mpf_vec_scalar_mul_mpf res vec len c

Multiplies the vector with given length by the scalar $$c$$ and sets res to the result.

_mpf_vec_scalar_mul_2exp res vec len exp

Multiplies the given vector of the given length by 2^exp.

# Dot product and norm

_mpf_vec_dot :: Ptr CMpf -> Ptr CMpf -> Ptr CMpf -> CLong -> IO () Source #

_mpf_vec_dot res vec1 vec2 len2

Sets res to the dot product of (vec1, len2) with (vec2, len2).

_mpf_vec_norm res vec len

Sets res to the square of the Euclidean norm of (vec, len).

_mpf_vec_dot2 res vec1 vec2 len2 prec

Sets res to the dot product of (vec1, len2) with (vec2, len2). The temporary variable used has its precision set to be at least prec bits. Returns 0 if a probable cancellation is detected, and otherwise returns a non-zero value.

_mpf_vec_norm2 res vec len prec

Sets res to the square of the Euclidean norm of (vec, len). The temporary variable used has its precision set to be at least prec bits.