M4RIE
20250128
Toggle main menu visibility
Loading...
Searching...
No Matches
blm.h
Go to the documentation of this file.
1
10
11
#ifndef M4RIE_BLM_H
12
#define M4RIE_BLM_H
13
14
/******************************************************************************
15
*
16
* M4RIE: Linear Algebra over GF(2^e)
17
*
18
* Copyright (C) 2013 Martin Albrecht <martinralbrecht@googlemail.com>
19
*
20
* Distributed under the terms of the GNU General Public License (GEL)
21
* version 2 or higher.
22
*
23
* This code is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
* General Public License for more details.
27
*
28
* The full text of the GPL is available at:
29
*
30
* http://www.gnu.org/licenses/
31
******************************************************************************/
32
33
#include <m4ri/m4ri.h>
34
#include "m4rie/gf2e.h"
35
39
40
#define M4RIE_CRT_LEN (M4RIE_MAX_DEGREE + 1)
41
50
51
typedef
struct
{
52
mzd_t *
H
;
53
djb_t *
h
;
54
55
mzd_t *
F
;
56
djb_t *
f
;
57
58
mzd_t *
G
;
59
djb_t *
g
;
60
}
blm_t
;
61
65
66
extern
const
int
costs[17];
67
71
72
static
inline
int
blm_cost_crt
(
const
int
p[
M4RIE_CRT_LEN
]) {
73
int
cost = costs[p[0]];
74
for
(
deg_t
d=1; d<
M4RIE_CRT_LEN
; d++)
75
cost += costs[d] * p[d];
76
return
cost;
77
}
78
85
86
int
*
crt_init
(
const
deg_t
f_len,
const
deg_t
g_len);
87
96
97
blm_t
*
blm_init_crt
(
const
gf2e
*ff,
const
deg_t
f_ncols,
const
deg_t
g_ncols,
const
int
*p,
int
djb);
98
105
106
blm_t
*
_blm_finish_polymult
(
const
gf2e
*ff,
blm_t
*f);
107
111
112
void
blm_free
(
blm_t
*f);
113
119
120
blm_t
*
_blm_djb_compile
(
blm_t
*f);
121
130
131
void
_mzd_ptr_apply_blm_mzd
(mzd_t **X,
const
mzd_t **A,
const
mzd_t **B,
const
blm_t
*f);
132
141
142
void
_mzd_ptr_apply_blm_djb
(mzd_t **X,
const
mzd_t **A,
const
mzd_t **B,
const
blm_t
*f);
143
152
153
static
inline
void
_mzd_ptr_apply_blm
(mzd_t **X,
const
mzd_t **A,
const
mzd_t **B,
const
blm_t
*f) {
154
if
(f->
f
!=NULL)
155
_mzd_ptr_apply_blm_djb
(X, A, B, f);
156
else
157
_mzd_ptr_apply_blm_mzd
(X, A, B, f);
158
}
159
160
161
#endif
//M4RIE_BLM_H
blm_cost_crt
static int blm_cost_crt(const int p[M4RIE_CRT_LEN])
Definition
blm.h:72
_blm_djb_compile
blm_t * _blm_djb_compile(blm_t *f)
Compile DJB map for f.
Definition
blm.c:43
crt_init
int * crt_init(const deg_t f_len, const deg_t g_len)
Definition
blm.c:105
_mzd_ptr_apply_blm_djb
void _mzd_ptr_apply_blm_djb(mzd_t **X, const mzd_t **A, const mzd_t **B, const blm_t *f)
Apply f (stored as a DJB map) on A and B, writing to X.
Definition
blm.c:65
blm_init_crt
blm_t * blm_init_crt(const gf2e *ff, const deg_t f_ncols, const deg_t g_ncols, const int *p, int djb)
Definition
blm.c:840
_blm_finish_polymult
blm_t * _blm_finish_polymult(const gf2e *ff, blm_t *f)
Definition
blm.c:734
M4RIE_CRT_LEN
#define M4RIE_CRT_LEN
We consider at most polynomials of degree M4RIE_MAX_DEGREE in CRT.
Definition
blm.h:40
_mzd_ptr_apply_blm
static void _mzd_ptr_apply_blm(mzd_t **X, const mzd_t **A, const mzd_t **B, const blm_t *f)
Apply f on A and B, writing to X.
Definition
blm.h:153
_mzd_ptr_apply_blm_mzd
void _mzd_ptr_apply_blm_mzd(mzd_t **X, const mzd_t **A, const mzd_t **B, const blm_t *f)
Apply f (stored as a matrix) on A and B, writing to X.
Definition
blm.c:6
blm_free
void blm_free(blm_t *f)
Definition
blm.c:964
gf2e
struct gf2e_struct gf2e
Definition
gf2e.h:56
deg_t
int deg_t
Definition
gf2x.h:37
blm_t
Bilinear Maps on Matrices over GF(2).
Definition
blm.h:51
blm_t::g
djb_t * g
Definition
blm.h:59
blm_t::h
djb_t * h
Definition
blm.h:53
blm_t::H
mzd_t * H
Definition
blm.h:52
blm_t::G
mzd_t * G
Definition
blm.h:58
blm_t::f
djb_t * f
Definition
blm.h:56
blm_t::F
mzd_t * F
Definition
blm.h:55
Generated on
for M4RIE by
1.17.0