Flint2-0.1.0.5: Haskell bindings for the flint library for number theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Number.Flint.Fmpq.Vec

Synopsis

Vectors over rational numbers

Memory management

_fmpq_vec_init :: CLong -> IO (Ptr CFmpq) Source #

_fmpq_vec_init n

Initialises a vector of fmpq values of length \(n\) and sets all values to 0. This is equivalent to generating a fmpz vector of length \(2n\) with _fmpz_vec_init and setting all denominators to 1.

_fmpq_vec_clear :: Ptr CFmpq -> CLong -> IO () Source #

_fmpq_vec_clear vec n

Frees an fmpq vector.

Randomisation

_fmpq_vec_randtest :: Ptr CFmpq -> Ptr CFRandState -> CLong -> CFBitCnt -> IO () Source #

_fmpq_vec_randtest f state len bits

Sets the entries of a vector of the given length to random rationals with numerator and denominator having up to the given number of bits per entry.

_fmpq_vec_randtest_uniq_sorted :: Ptr CFmpq -> Ptr CFRandState -> CLong -> CFBitCnt -> IO () Source #

_fmpq_vec_randtest_uniq_sorted vec state len bits

Sets the entries of a vector of the given length to random distinct rationals with numerator and denominator having up to the given number of bits per entry. The entries in the vector are sorted.

Sorting

_fmpq_vec_sort :: Ptr CFmpq -> CLong -> IO () Source #

_fmpq_vec_sort vec len

Sorts the entries of (vec, len).

Conversions

_fmpq_vec_set_fmpz_vec :: Ptr CFmpq -> Ptr CFmpz -> CLong -> IO () Source #

_fmpq_vec_set_fmpz_vec res vec len

Sets (res, len) to (vec, len).

_fmpq_vec_get_fmpz_vec_fmpz :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpq -> CLong -> IO () Source #

_fmpq_vec_get_fmpz_vec_fmpz num den a len

Find a common denominator den of the entries of a and set (num, len) to the corresponding numerators.

Dot product

_fmpq_vec_dot :: Ptr CFmpq -> Ptr CFmpq -> Ptr CFmpq -> CLong -> IO () Source #

_fmpq_vec_dot res vec1 vec2 len

Sets res to the dot product of the vectors (vec1, len) and (vec2, len).

Input and output

_fmpq_vec_fprint :: Ptr CFile -> Ptr CFmpq -> CLong -> IO CInt Source #

_fmpq_vec_fprint file vec len

Prints the vector of given length to the stream file. The format is the length followed by two spaces, then a space separated list of coefficients. If the length is zero, only \(0\) is printed.

In case of success, returns a positive value. In case of failure, returns a non-positive value.

_fmpq_vec_print :: Ptr CFmpq -> CLong -> IO CInt Source #

_fmpq_vec_print vec len

Prints the vector of given length to stdout.

For further details, see _fmpq_vec_fprint().