FLINT3.7.0-dev
Module · 22 functions

fq_zech_vec.h

#include <flint/fq_zech_vec.h>

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

_fq_zech_vec_dot is the plain loop of the template: it multiplies and adds the elements one by one with the Zech tables, and res must not be an element of the input vectors. The generic _gr_vec_dot of the fq_zech ring has a faster dedicated implementation working with discrete logarithms.

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_zech_vec_swap(fq_zech_struct * vec1, fq_zech_struct * vec2, slong len2, const fq_zech_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_zech_vec_neg(fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fq_zech_ctx_t ctx)

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

More

Comparison#

int _fq_zech_vec_equal(const fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len, const fq_zech_ctx_t ctx)

Returns whether the two vectors of length len are equal.

More
int _fq_zech_vec_is_zero(const fq_zech_struct * vec, slong len, const fq_zech_ctx_t ctx)

Returns whether all len elements of vec are zero.

More

Arithmetic#

void _fq_zech_vec_add(fq_zech_struct * res, const fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fq_zech_ctx_t ctx)
void _fq_zech_vec_sub(fq_zech_struct * res, const fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fq_zech_ctx_t ctx)

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

More
void _fq_zech_vec_scalar_mul_fq_zech(fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fq_zech_t x, const fq_zech_ctx_t ctx)

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

More
void _fq_zech_vec_scalar_mul_fmpz(fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fmpz_t x, const fq_zech_ctx_t ctx)
void _fq_zech_vec_scalar_mul_ui(fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const ulong x, const fq_zech_ctx_t ctx)
void _fq_zech_vec_scalar_mul_si(fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const slong x, const fq_zech_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_zech_vec_dot(fq_zech_t res, const fq_zech_struct * vec1, const fq_zech_struct * vec2, slong len2, const fq_zech_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_zech_vec_fprint(FILE * file, const fq_zech_struct * vec, slong len, const fq_zech_ctx_t ctx)
int _fq_zech_vec_print(const fq_zech_struct * vec, slong len, const fq_zech_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_zech_fprint separated by single spaces. Return a positive value on success and a non-positive value on failure.

More

Macros#

FQ_ZECH_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_ZECH_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_zech_vec.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fq_zech_vec/index.html (generated 2026-10-20).