fmpz_mod_vec.h
#include <flint/fmpz_mod_vec.h>This module provides operations on vectors over whose entries are canonical residues in stored as plain fmpz arrays, with the modulus given by an fmpz_mod_ctx_t. Vectors are allocated, cleared, copied and compared with the fmpz_vec functions (_fmpz_vec_init, _fmpz_vec_clear, _fmpz_vec_set, _fmpz_vec_equal, ...). The functions are the building blocks of fmpz_mod_poly and fmpz_mod_mat.
All functions take a vector as a pointer and a length. Unless stated otherwise, inputs must be canonical and the output is canonical, and the output may alias an input of the same length (the loops are elementwise).
Conversion#
void _fmpz_mod_vec_set_fmpz_vec(fmpz * A, const fmpz * B, slong len, const fmpz_mod_ctx_t ctx)Sets the entries of to the entries of reduced modulo ; may contain any integers and may alias .
Morevoid _fmpz_mod_vec_get_fmpz_vec_smod(fmpz * res, const fmpz * vec, slong len, const fmpz_mod_ctx_t ctx)Given canonical residues , sets to the symmetric residues in . This is the same as _fmpz_vec_scalar_smod_fmpz but faster, since the input is known to be reduced: each entry costs one comparison and at most one subtraction.
Arithmetic#
void _fmpz_mod_vec_neg(fmpz * A, const fmpz * B, slong len, const fmpz_mod_ctx_t ctx)Sets to .
void _fmpz_mod_vec_add(fmpz * a, const fmpz * b, const fmpz * c, slong n, const fmpz_mod_ctx_t ctx)void _fmpz_mod_vec_sub(fmpz * a, const fmpz * b, const fmpz * c, slong n, const fmpz_mod_ctx_t ctx)Set to and , elementwise. Here is the length of the vectors, not the modulus.
void _fmpz_mod_vec_mul(fmpz * A, const fmpz * B, const fmpz * C, slong len, const fmpz_mod_ctx_t ctx)Sets to the elementwise product of and .
Scalar multiplication#
void _fmpz_mod_vec_scalar_mul_fmpz_mod(fmpz * A, const fmpz * B, slong len, const fmpz_t c, const fmpz_mod_ctx_t ctx)Sets to , for canonical . For this is a copy.
void _fmpz_mod_vec_scalar_addmul_fmpz_mod(fmpz * A, const fmpz * B, slong len, const fmpz_t c, const fmpz_mod_ctx_t ctx)Sets to , for canonical . Each entry is updated with one exact fmpz_addmul and one reduction.
void _fmpz_mod_vec_scalar_div_fmpz_mod(fmpz * A, const fmpz * B, slong len, const fmpz_t c, const fmpz_mod_ctx_t ctx)Sets to . Throws an exception (from fmpz_mod_inv) if is not invertible modulo .
Dot products#
void _fmpz_mod_vec_dot(fmpz_t d, const fmpz * A, const fmpz * B, slong len, const fmpz_mod_ctx_t ctx)void _fmpz_mod_vec_dot_rev(fmpz_t r, const fmpz * a, const fmpz * b, slong len, const fmpz_mod_ctx_t ctx)Set the output to , respectively , modulo .
MoreThe FLINT team, “fmpz_mod_vec.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz_mod_vec/index.html (generated 2026-11-02).
@misc{flint-doc-fmpz-mod-vec-index,
author = {{The FLINT team}},
title = {{fmpz\_mod\_vec.h (module overview)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpz_mod_vec/index.html},
note = {Generated 2026-11-02}
}