36 for (i = 0; i < (*m)->k; i++) {
37 free((*m)->elements[i]);
64 (*m)->element_bit_size =
sizeof(
BPU_T_GF2)*8;
73 if ( cols % (*m)->element_bit_size > 0) {
76 (*m)->elements_in_row = cols/(*m)->element_bit_size + modul;
81 if (!(*m)->elements) {
86 for (i = 0; i < (*m)->k; i++) {
89 if (!(*m)->elements[i]) {
133 BPU_printError(
"can not allocate memory for vector of len %d", len);
142 p->
index = (uint32_t*) malloc(weight*
sizeof(uint32_t));
160 v->
k = element_count * element_size;
165 v->
n = element_count * element_size;
214 BPU_printError(
"can not allocate memory for vector of len %d", len);
224 if (isVertical != 0 && isVertical != 1) {
233 v->
k = element_count * element_size;
238 v->
n = element_count * element_size;
int BPU_gf2VecMalloc(BPU_T_GF2_Vector **v, int len)
uint32_t weight
weight of polynomial
BPU_T_GF2_Sparse_Poly * matrices
all cyclic matrices of matrix
uint8_t isVertical
if 1, elements are in vertical orientation, if 0 horizontal orientation
uint32_t k
rows of whole matrix
void BPU_gf2VecFree(BPU_T_GF2_Vector **v)
Free dynamically or statically allocated vector.
uint16_t element_count
number of cyclic matrices
void BPU_gf2PolyFree(BPU_T_GF2_Poly *p, int is_dyn)
uint32_t element_size
size of cyclic matrix
uint8_t is_I_appended
if matrix has identity matrix on left
uint32_t * index
indexes of set coefficients. 0 is coefficient for x^0
void BPU_gf2QcMatrixFree(BPU_T_GF2_QC_Matrix *v, int is_dyn)
#define BPU_printError(fmt,...)
print error message with filename, line
uint32_t k
rows of whole matrix
uint32_t n
cols of whole matrix
uint32_t element_size
size of cyclic matrix
void BPU_gf2SparseQcMatrixFree(BPU_T_GF2_Sparse_Qc_Matrix *v, int is_dyn)
BPU_T_GF2 * elements
all element of matrix
void BPU_gf2SparseQcMatrixMalloc(BPU_T_GF2_Sparse_Qc_Matrix *v, int element_count, int element_size, int isVertical)
int BPU_gf2VecResize(BPU_T_GF2_Vector *v, int len)
BPU_gf2VecResize Resize vecor.
uint16_t element_count
number of cyclic matrices
uint16_t elements_in_row
number of elements in one row
int BPU_gf2MatMalloc(BPU_T_GF2_Matrix **m, int rows, int cols)
int BPU_gf2VecMallocElements(BPU_T_GF2_Vector *v, int len)
BPU_gf2VecMallocElements Malloc vector elements and set to zero.
int BPU_gf2PolyMalloc(BPU_T_GF2_Poly *p, int len)
void BPU_gf2SparsePolyMalloc(BPU_T_GF2_Sparse_Poly *p, int weight)
BPU_T_GF2_Poly * matrices
all cyclic matrices of matrix
void BPU_gf2SparsePolyFree(BPU_T_GF2_Sparse_Poly *p, int is_dyn)
int BPU_gf2QcMatrixMalloc(BPU_T_GF2_QC_Matrix *v, int element_count, int element_size, int isVertical, int is_I_appended)
void BPU_gf2MatFree(BPU_T_GF2_Matrix **m)
Free dynamically or statically allocated matrix.
uint8_t element_bit_size
element size, is sizeof(BPU_T_GF2) i.e. 64 bits
uint8_t isVertical
if 1, elements are in vertical orientation, if 0 horizontal orientation
uint32_t n
cols of whole matrix