FLINT3.7.0-dev
Module · 22 functions

fq_nmod_vec.h

#include <flint/fq_nmod_vec.h>

This module provides low-level functions on vectors over a finite field \mathbb{F}_q in the representation of fq_nmod.h (a prime p < 2^{\mathtt{FLINT\_BITS}}, elements stored as nmod_poly): plain C arrays of fq_nmod_struct with their length. It is generated from the same template as fq_vec.h and has the same functions, with fq_nmod in place of fq; each function links to the fq_vec version, which has the details.

_fq_nmod_vec_dot (a wrapper of _gr_vec_dot) accumulates the products of the representatives modulo p and reduces modulo the defining polynomial once.

Memory management#

Returns a newly allocated vector of len elements, all initialised to zero.

More

Clears the len elements of vec and frees the array.

More

Assignment and basic manipulation#

Copies (f, len) into (v, len).

More
void _fq_nmod_vec_swap(fq_nmod_struct * vec1, fq_nmod_struct * vec2, slong len2, const fq_nmod_ctx_t ctx)

Swaps the elements of (vec1, len2) and (vec2, len2) efficiently.

More

Sets the len elements of v to zero.

More
void _fq_nmod_vec_neg(fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fq_nmod_ctx_t ctx)

Sets (vec1, len2) to -\mathit{vec2}.

More

Comparison#

int _fq_nmod_vec_equal(const fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len, const fq_nmod_ctx_t ctx)

Returns whether the two vectors of length len are equal.

More
int _fq_nmod_vec_is_zero(const fq_nmod_struct * vec, slong len, const fq_nmod_ctx_t ctx)

Returns whether all len elements of vec are zero.

More

Arithmetic#

void _fq_nmod_vec_add(fq_nmod_struct * res, const fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fq_nmod_ctx_t ctx)
void _fq_nmod_vec_sub(fq_nmod_struct * res, const fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fq_nmod_ctx_t ctx)

Set (res, len2) to \mathit{vec1} + \mathit{vec2}, respectively \mathit{vec1} - \mathit{vec2}, elementwise.

More
void _fq_nmod_vec_scalar_mul_fq_nmod(fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fq_nmod_t x, const fq_nmod_ctx_t ctx)

Sets (vec1, len2) to x \cdot \mathit{vec2}.

More
void _fq_nmod_vec_scalar_mul_fmpz(fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fmpz_t x, const fq_nmod_ctx_t ctx)
void _fq_nmod_vec_scalar_mul_ui(fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const ulong x, const fq_nmod_ctx_t ctx)
void _fq_nmod_vec_scalar_mul_si(fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const slong x, const fq_nmod_ctx_t ctx)

Set (vec1, len2) to \mathit{vec2} times the image of the integer x in \mathbb{F}_p.

More

Add x \cdot \mathit{vec2} to, respectively subtract it from, (vec1, len2).

More
void _fq_nmod_vec_dot(fq_nmod_t res, const fq_nmod_struct * vec1, const fq_nmod_struct * vec2, slong len2, const fq_nmod_ctx_t ctx)

Sets res to the dot product \sum_{i < \mathit{len2}} \mathit{vec1}_i \mathit{vec2}_i, which is zero for \mathit{len2} \le 0.

More

Random vectors#

Sets the len elements of f to random elements for testing (with probability 1/2 most of them are zero).

More

Input and output#

int _fq_nmod_vec_fprint(FILE * file, const fq_nmod_struct * vec, slong len, const fq_nmod_ctx_t ctx)
int _fq_nmod_vec_print(const fq_nmod_struct * vec, slong len, const fq_nmod_ctx_t ctx)

Print the vector to file, respectively stdout: the length, then for a nonempty vector two spaces and the elements in the format of fq_nmod_fprint separated by single spaces. Return a positive value on success and a non-positive value on failure.

More

Macros#

FQ_NMOD_VEC_NORM(vec, i, ctx)

Decreases the slong variable i while i is positive and the element vec[i - 1] is zero, so that (vec, i) becomes a normalised polynomial.

FQ_NMOD_VEC_SWAP(vec1, len1, vec2, len2)

Swaps the pointers vec1 and vec2 and the lengths len1 and len2.

Cite this page

The FLINT team, “fq_nmod_vec.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fq_nmod_vec/index.html (generated 2026-10-20).