BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gf2types.c File Reference
#include "gf2types.h"
#include <bitpunch/debugio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

void BPU_gf2MatFree (BPU_T_GF2_Matrix **m)
 Free dynamically or statically allocated matrix. More...
 
void BPU_gf2VecFree (BPU_T_GF2_Vector **v)
 Free dynamically or statically allocated vector. More...
 
int BPU_gf2MatMalloc (BPU_T_GF2_Matrix **m, int rows, int cols)
 
int BPU_gf2VecMalloc (BPU_T_GF2_Vector **v, int len)
 
int BPU_gf2VecResize (BPU_T_GF2_Vector *v, int len)
 BPU_gf2VecResize Resize vecor. More...
 
int BPU_gf2VecMallocElements (BPU_T_GF2_Vector *v, int len)
 BPU_gf2VecMallocElements Malloc vector elements and set to zero. More...
 
void BPU_gf2SparsePolyMalloc (BPU_T_GF2_Sparse_Poly *p, int weight)
 
void BPU_gf2SparsePolyFree (BPU_T_GF2_Sparse_Poly *p, int is_dyn)
 
void BPU_gf2SparseQcMatrixMalloc (BPU_T_GF2_Sparse_Qc_Matrix *v, int element_count, int element_size, int isVertical)
 
void BPU_gf2SparseQcMatrixFree (BPU_T_GF2_Sparse_Qc_Matrix *v, int is_dyn)
 
void BPU_gf2PolyFree (BPU_T_GF2_Poly *p, int is_dyn)
 
int BPU_gf2PolyMalloc (BPU_T_GF2_Poly *p, int len)
 
int BPU_gf2QcMatrixMalloc (BPU_T_GF2_QC_Matrix *v, int element_count, int element_size, int isVertical, int is_I_appended)
 
void BPU_gf2QcMatrixFree (BPU_T_GF2_QC_Matrix *v, int is_dyn)
 

Function Documentation

void BPU_gf2MatFree ( BPU_T_GF2_Matrix **  m)

Free dynamically or statically allocated matrix.

Free dynamically or statically allocated matrix GF2.

Parameters
[out]*maddress of matrix object

Definition at line 29 of file gf2types.c.

int BPU_gf2MatMalloc ( BPU_T_GF2_Matrix **  m,
int  rows,
int  cols 
)

Allocate memory for matrix GF2. It also nulls new matrix. After work you have to free memory using call BPU_freeMatGF2

Parameters
rowsrows
colscols
Returns
on succes 0, else error

Definition at line 54 of file gf2types.c.

void BPU_gf2PolyFree ( BPU_T_GF2_Poly p,
int  is_dyn 
)

Free dynamically or statically allocated polynomial over GF2.

Parameters
ppolynomial to free
is_dynboolean param, if 0 do not free object self, else free also object

Definition at line 187 of file gf2types.c.

int BPU_gf2PolyMalloc ( BPU_T_GF2_Poly p,
int  len 
)

Allocate memory for polynomial over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2PolyFree.

Parameters
ppolynomial to allocate
lenlength of polynomial (length - 1 = degree of polynomial)
Returns
on succes 0, else error

Definition at line 195 of file gf2types.c.

void BPU_gf2QcMatrixFree ( BPU_T_GF2_QC_Matrix v,
int  is_dyn 
)

Free dynamically or statically allocated quasi-cyclic matrix over GF2.

Parameters
vquasi-cyclic matrix
is_dynboolean param, if 0 do not free object self, else free also object

Definition at line 251 of file gf2types.c.

int BPU_gf2QcMatrixMalloc ( BPU_T_GF2_QC_Matrix v,
int  element_count,
int  element_size,
int  isVertical,
int  is_I_appended 
)

Allocate memory for quasi-cyclic matrix over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2QcMatrixFree.

Parameters
vquasi-cyclic matrix
element_countcount of cyclic elements
element_sizesize of one cyclic element
isVerticalboolean, if 1, elements are in vertical orientation, if 0 horizontal orientation
is_I_appendedboolean, if 1, identity matrix is appended to the left, if 0, no identity matrix
Returns
0 - succes, else error

Definition at line 220 of file gf2types.c.

void BPU_gf2SparsePolyFree ( BPU_T_GF2_Sparse_Poly p,
int  is_dyn 
)

Free dynamically or statically allocated sparse polynomial over GF2.

Parameters
psparse polynomial to free
is_dynboolean param, if 0 do not free object self, else free also object

Definition at line 147 of file gf2types.c.

void BPU_gf2SparsePolyMalloc ( BPU_T_GF2_Sparse_Poly p,
int  weight 
)

Allocate memory for sparse polynomial over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2SparsePolyFree.

Parameters
psparse polynomial to allocate
weightweight of sparse polynomial

Definition at line 140 of file gf2types.c.

void BPU_gf2SparseQcMatrixFree ( BPU_T_GF2_Sparse_Qc_Matrix v,
int  is_dyn 
)

Free dynamically or statically allocated sparse quasi-cyclic matrix over GF2.

Parameters
vsparse quasi-cyclic matrix
is_dynboolean param, if 0 do not free object self, else free also object

Definition at line 174 of file gf2types.c.

void BPU_gf2SparseQcMatrixMalloc ( BPU_T_GF2_Sparse_Qc_Matrix v,
int  element_count,
int  element_size,
int  isVertical 
)

Allocate memory for sparse quasi-cyclic matrix over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2SparseQcMatrixFree.

Parameters
vsparse quasi-cyclic matrix
element_countcount of cyclic elements
element_sizesize of one cyclic element
isVerticalboolean, if 1, elements are in vertical orientation, if 0 horizontal orientation

Definition at line 154 of file gf2types.c.

void BPU_gf2VecFree ( BPU_T_GF2_Vector **  v)

Free dynamically or statically allocated vector.

Free dynamically or statically allocated vector GF2.

Parameters
[out]*maddress of vector object

Definition at line 45 of file gf2types.c.

int BPU_gf2VecMalloc ( BPU_T_GF2_Vector **  v,
int  len 
)

Allocate memory for vector GF2. It also null vector. After work you have to free memory using call BPU_freeVecGF2.

Parameters
lenlen of vector
Returns
on succes 0, else error

Definition at line 97 of file gf2types.c.

int BPU_gf2VecMallocElements ( BPU_T_GF2_Vector v,
int  len 
)

BPU_gf2VecMallocElements Malloc vector elements and set to zero.

Parameters
v
len
Returns

Definition at line 114 of file gf2types.c.

int BPU_gf2VecResize ( BPU_T_GF2_Vector v,
int  len 
)

BPU_gf2VecResize Resize vecor.

Parameters
v
len
Returns

Definition at line 107 of file gf2types.c.