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

Data.Number.Flint.Fq.NMod.Vec

Description

 
Synopsis

Vectors over finite fields (word-size characteristic)

Memory management

_fq_nmod_vec_init :: CLong -> Ptr CFqNModCtx -> IO (Ptr CFqNMod) Source #

_fq_nmod_vec_init len ctx

Returns an initialised vector of fq_nmod's of given length.

_fq_nmod_vec_clear :: Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_clear vec len ctx

Clears the entries of (vec, len) and frees the space allocated for vec.

Randomisation

_fq_nmod_vec_randtest :: Ptr CFqNMod -> Ptr CFRandState -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_randtest f state len ctx

Sets the entries of a vector of the given length to elements of the finite field.

Input and output

_fq_nmod_vec_fprint :: Ptr CFile -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO CInt Source #

_fq_nmod_vec_fprint file vec len ctx

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.

_fq_nmod_vec_print :: Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO CInt Source #

_fq_nmod_vec_print vec len ctx

Prints the vector of given length to stdout.

For further details, see _fq_nmod_vec_fprint().

Assignment and basic manipulation

_fq_nmod_vec_set :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_set vec1 vec2 len2 ctx

Makes a copy of (vec2, len2) into vec1.

_fq_nmod_vec_swap :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_swap vec1 vec2 len2 ctx

Swaps the elements in (vec1, len2) and (vec2, len2).

_fq_nmod_vec_zero :: Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_zero vec len ctx

Zeros the entries of (vec, len).

_fq_nmod_vec_neg :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_neg vec1 vec2 len2 ctx

Negates (vec2, len2) and places it into vec1.

Comparison

_fq_nmod_vec_equal :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO CInt Source #

_fq_nmod_vec_equal vec1 vec2 len ctx

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

_fq_nmod_vec_is_zero :: Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO CInt Source #

_fq_nmod_vec_is_zero vec len ctx

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

Addition and subtraction

_fq_nmod_vec_add :: Ptr CFqNMod -> Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_add res vec1 vec2 len2 ctx

Sets (res, len2) to the sum of (vec1, len2) and (vec2, len2).

_fq_nmod_vec_sub :: Ptr CFqNMod -> Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_sub res vec1 vec2 len2 ctx

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

Scalar multiplication and division

_fq_nmod_vec_scalar_addmul_fq_nmod :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNMod -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_scalar_addmul_fq_nmod vec1 vec2 len2 c ctx

Adds (vec2, len2) times \(c\) to (vec1, len2), where \(c\) is a fq_nmod_t.

_fq_nmod_vec_scalar_submul_fq_nmod :: Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNMod -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_scalar_submul_fq_nmod vec1 vec2 len2 c ctx

Subtracts (vec2, len2) times \(c\) from (vec1, len2), where \(c\) is a fq_nmod_t.

Dot products

_fq_nmod_vec_dot :: Ptr CFqNMod -> Ptr CFqNMod -> Ptr CFqNMod -> CLong -> Ptr CFqNModCtx -> IO () Source #

_fq_nmod_vec_dot res vec1 vec2 len2 ctx

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