1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
Copyright (C) 2017 Luca De Feo
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "fmpz.h"
#include "fmpz_poly.h"
#include "fmpz_mod_mat.h"
#include "fq.h"
void fq_get_fmpz_mod_mat(fmpz_mod_mat_t col,
const fq_t a,
const fq_ctx_t ctx)
{
slong i, n = fq_ctx_degree(ctx);
for (i = 0; i < a->length; i++)
fmpz_set(fmpz_mod_mat_entry(col, i, 0), a->coeffs + i);
for ( ; i < n; i++)
fmpz_zero(fmpz_mod_mat_entry(col, i, 0));
}
void fq_set_fmpz_mod_mat(fq_t a,
const fmpz_mod_mat_t col,
const fq_ctx_t ctx)
{
slong i, n = fq_ctx_degree(ctx);
fmpz_poly_fit_length(a, n);
a->length = n;
for (i = 0; i < n; i++)
fmpz_set(a->coeffs + i, fmpz_mod_mat_entry(col, i, 0));
_fmpz_poly_normalise(a);
}