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

Go to the source code of this file.

Functions

void BPU_printBinaryMsb (uint32_t in, int len)
 Print number as binary string in big endian so msb is first printed. More...
 
void BPU_printBinaryMsbLn (uint32_t in, int len)
 Print number as binary string in big endian so msb is first printed. More...
 
void BPU_printBinaryMsb32 (uint32_t in)
 Print number as binary string in big endian so msb is first printed. More...
 
void BPU_printBinaryMsb32Ln (uint32_t in)
 Print number as binary string in big endian so msb is first printed. More...
 
void BPU_printBinaryLsb (uint32_t in, int len)
 Print number as binary string in little endian so lsb is first printed. More...
 
void BPU_printBinaryLsbLn (uint32_t in, int len)
 Print number as binary string in little endian so lsb is first printed. More...
 
void BPU_printBinaryLsb32 (uint32_t in)
 Print number as binary string in little endian so lsb is first printed. More...
 
void BPU_printBinary32LsbLn (uint32_t in)
 Print number as binary string in little endian so lsb is first printed. More...
 
void BPU_printGf2Mat (const BPU_T_GF2_Matrix *m)
 
void BPU_printGf2Vec (const BPU_T_GF2_Vector *v)
 
void BPU_printGf2VecMsb (const BPU_T_GF2_Vector *v)
 BPU_printGf2VecMsb Most significant bit is printed first. More...
 
void BPU_printGf2VecOnes (const BPU_T_GF2_Vector *vec)
 BPU_printGf2VecOnes Print only ones. More...
 
void BPU_printGf2SparsePoly (const BPU_T_GF2_Sparse_Poly *v)
 
void BPU_printGf2PolyForMatrix (const BPU_T_GF2_Poly *v)
 
void BPU_printGf2Poly (const BPU_T_GF2_Poly *v)
 
void BPU_printGf2QcMatrix (const BPU_T_GF2_QC_Matrix *v)
 
void BPU_printGf2SparseQcMatrix (const BPU_T_GF2_Sparse_Qc_Matrix *v)
 
int BPU_gf2VecRand (BPU_T_GF2_Vector *out, int w)
 
int BPU_gf2MatCopy (BPU_T_GF2_Matrix *out, const BPU_T_GF2_Matrix *in)
 BPU_gf2MatCopyCreate copy of input matrix. More...
 
int BPU_gf2VecPermute (BPU_T_GF2_Vector *vec, const BPU_T_Perm_Vector *permutation)
 
BPU_T_GF2 BPU_gf2MatGetMaskedBit (const BPU_T_GF2_Matrix *m, uint32_t row, uint32_t bit)
 
BPU_T_GF2 BPU_gf2VecGetMaskedBit (const BPU_T_GF2_Vector *vec, uint32_t bit)
 
int BPU_gf2MatTransp (BPU_T_GF2_Matrix *out, const BPU_T_GF2_Matrix *in)
 
void BPU_gf2Swap (BPU_T_GF2 *a, BPU_T_GF2 *b)
 
void BPU_gf2MatSwapRows (BPU_T_GF2_Matrix *mat, int i, int j)
 
int BPU_gf2MatFindRow (const BPU_T_GF2_Matrix *mat, int i, int start_index)
 
int BPU_gf2MatFindCol (const BPU_T_GF2_Matrix *mat, int i, int start_index)
 
int BPU_gf2MatMakeSystematic (BPU_T_GF2_Matrix *inout)
 It brings Matrix GF2 into the systematic form -> with I on the left side. More...
 
int BPU_gf2VecConcat (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *vec1, const BPU_T_GF2_Vector *vec2)
 Concats two vectors without allocation ouput. More...
 
int BPU_gf2VecCrop (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const int start, const int length)
 
int BPU_gf2MatGetRowAsGf2Vec (BPU_T_GF2_Vector *out, const BPU_T_GF2_Matrix *in, int row)
 
void BPU_gf2VecCopy (BPU_T_GF2_Vector *dest, const BPU_T_GF2_Vector *src)
 Copy VectorGF2. More...
 
int BPU_gf2VecCmp (const BPU_T_GF2_Vector *v1, const BPU_T_GF2_Vector *v2)
 BPU_gf2VecCmp Compare two vectors. More...
 
int BPU_gf2VecXor (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in)
 Xor two Vectors GF2 and store result in first vector. More...
 
int BPU_gf2VecMulMat (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *v, const BPU_T_GF2_Matrix *b)
 
void BPU_gf2MatXorRows (BPU_T_GF2_Matrix *mat, int i, int j)
 
int BPU_gf2MatPermute (BPU_T_GF2_Matrix *inout, BPU_T_Perm_Vector *permutation)
 
int BPU_gf2MatCrop (BPU_T_GF2_Matrix *m, uint16_t width)
 Crop matrix GF2 from left. More...
 
uint8_t BPU_getParity (BPU_T_GF2 dword)
 BPU_getParity Get parity of word. More...
 
void BPU_gf2PolyCopy (BPU_T_GF2_Poly *out, const BPU_T_GF2_Poly *in)
 
int BPU_gf2QcMatrixToSparse (BPU_T_GF2_Sparse_Qc_Matrix *out, const BPU_T_GF2_QC_Matrix *in, const int wi[])
 
int BPU_gf2PolyInitRand (BPU_T_GF2_Poly *out, int l, int w, int set_deg)
 
void BPU_gf2SparsePolyCopy (BPU_T_GF2_Sparse_Poly *out, const BPU_T_GF2_Sparse_Poly *in)
 
void BPU_gf2SparseQcMatrixTransp (BPU_T_GF2_Sparse_Qc_Matrix *out, const BPU_T_GF2_Sparse_Qc_Matrix *in)
 
void BPU_gf2PolyShiftLeft (BPU_T_GF2_Poly *a, int shift_count)
 
int BPU_gf2PolyGetHighestBitPos (BPU_T_GF2_Poly *a)
 
void BPU_gf2PolySetDeg (BPU_T_GF2_Poly *a, int deg)
 
void BPU_gf2PolyMulX (BPU_T_GF2_Poly *a)
 
void BPU_gf2PolyShiftRightOne (BPU_T_GF2_Poly *a)
 
void BPU_gf2PolyAdd (BPU_T_GF2_Poly *out, const BPU_T_GF2_Poly *in, int crop)
 
void BPU_gf2SparsePolyAdd (BPU_T_GF2_Poly *out, const BPU_T_GF2_Sparse_Poly *in)
 
int BPU_gf2SparsePolyAndHW (const BPU_T_GF2_Poly *a, const BPU_T_GF2_Sparse_Poly *b)
 
void BPU_gf2SparseQcMatrixGetRow (BPU_T_GF2_Sparse_Poly *p, const BPU_T_GF2_Sparse_Qc_Matrix *m, int row_num)
 
void BPU_gf2PolyMulMod (const BPU_T_GF2_Poly *a, const BPU_T_GF2_Poly *b, BPU_T_GF2_Poly *c, const BPU_T_GF2_Poly *m, int crop)
 
void BPU_gf2PolyDiv (BPU_T_GF2_Poly *q, BPU_T_GF2_Poly *r, const BPU_T_GF2_Poly *a, const BPU_T_GF2_Poly *b)
 
void BPU_gf2PolyExtEuclidA (BPU_T_GF2_Poly *d, BPU_T_GF2_Poly *s, BPU_T_GF2_Poly *t, const BPU_T_GF2_Poly *a, const BPU_T_GF2_Poly *b, const BPU_T_GF2_Poly *m)
 
int BPU_gf2PolyInv (BPU_T_GF2_Poly *out, const BPU_T_GF2_Poly *a, const BPU_T_GF2_Poly *m)
 
void BPU_gf2PolyTransp (BPU_T_GF2_Poly *out, const BPU_T_GF2_Poly *in)
 
void BPU_gf2QcMatrixTransp (BPU_T_GF2_QC_Matrix *out, const BPU_T_GF2_QC_Matrix *in)
 
int BPU_gf2PolyIsZero (const BPU_T_GF2_Poly *a)
 

Function Documentation

uint8_t BPU_getParity ( BPU_T_GF2  dword)

BPU_getParity Get parity of word.

Parameters
dword
Returns

Definition at line 576 of file gf2.c.

int BPU_gf2MatCopy ( BPU_T_GF2_Matrix out,
const BPU_T_GF2_Matrix in 
)

BPU_gf2MatCopyCreate copy of input matrix.

Parameters
out
in
Returns

Definition at line 271 of file gf2.c.

int BPU_gf2MatCrop ( BPU_T_GF2_Matrix m,
uint16_t  width 
)

Crop matrix GF2 from left.

Crop matrix GF2 from left.

Parameters
ininput matrix GF2
outcroped output matrix GF2
widthwidth of cropped matrix
Returns
on succes 0, on higher or equal width as actual width of in matrix -1, on allocation of new matrix error -2

Definition at line 552 of file gf2.c.

int BPU_gf2MatFindCol ( const BPU_T_GF2_Matrix mat,
int  i,
int  start_index 
)

Finds column in Matrix GF2 where 1 is at i-th position (from top). Looking for column starts at start_index.

Parameters
matMatrix GF2
iint
start_indexint
Returns
number of row on success, else -1

Definition at line 366 of file gf2.c.

int BPU_gf2MatFindRow ( const BPU_T_GF2_Matrix mat,
int  i,
int  start_index 
)

Finds row in Matrix GF2 where 1 is at i-th position (from left). Looking for row starts at start_index.

Parameters
matMatrix GF2
iint
start_indexint
Returns
number of row on success, else -1

Definition at line 356 of file gf2.c.

BPU_T_GF2 BPU_gf2MatGetMaskedBit ( const BPU_T_GF2_Matrix m,
uint32_t  row,
uint32_t  bit 
)

Get masked bit from exact row of Matrix GF2

Parameters
mmatrix GF2
rowrow
bitbit
Returns
masked bit

Definition at line 305 of file gf2.c.

int BPU_gf2MatGetRowAsGf2Vec ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Matrix in,
int  row 
)

Get matrix GF2 row as vector gf2. You can set alloc param, to allocate it dynamically inside function, or use allocated vector yet. When set alloc, after work call BPU_freeVecGF2

Parameters
outvector
inmatrix
rowrow index
allocif set to 0, jsut copy row to allocated vector yet, or also allocate output vector
Returns
0 - success, else error

Definition at line 444 of file gf2.c.

int BPU_gf2MatMakeSystematic ( BPU_T_GF2_Matrix inout)

It brings Matrix GF2 into the systematic form -> with I on the left side.

It brings Matrix GF2 into the systematic form -> with I on the left side. After work, return value should be freed, it is allocated dynamically.

Parameters
inoutMatrix GF2
Returns
on success pointer to BPU_T_Perm_Vector

Definition at line 376 of file gf2.c.

int BPU_gf2MatPermute ( BPU_T_GF2_Matrix m,
BPU_T_Perm_Vector permutation 
)

Permute matrix GF2 with permutation.

Parameters
mmatrix GF2
permutationpermutation vector
Returns
on succes 0, on size error -1, on allocation error -2

Definition at line 526 of file gf2.c.

void BPU_gf2MatSwapRows ( BPU_T_GF2_Matrix mat,
int  i,
int  j 
)

It swaps i-th and j-th rows of Matrix GF2.

Parameters
matMatrix GF2
inti
intj
Returns
permutation needed for equivalent codes

Definition at line 347 of file gf2.c.

int BPU_gf2MatTransp ( BPU_T_GF2_Matrix out,
const BPU_T_GF2_Matrix in 
)

Transpose GF2 Matrix.

Parameters
outtransposed GF2 matrix
inmatrix to transpose
Returns
on success 0, else error

Definition at line 323 of file gf2.c.

void BPU_gf2MatXorRows ( BPU_T_GF2_Matrix mat,
int  i,
int  j 
)

XOR operation on rows of Matrix GF2. row[i] = row[i] ^ row[j]

Parameters
matMatrix GF2
inti
intj
Returns

Definition at line 518 of file gf2.c.

void BPU_gf2PolyAdd ( BPU_T_GF2_Poly out,
const BPU_T_GF2_Poly in,
int  crop 
)

Polynomial add. out = out + in If is set crop to 1, it will set new polynomial degree. Else it will have degree of maximum degree of out and in poly.

Parameters
outinput / output polynomial
inintput polynomial
cropboolean, if set actual degree of output

Definition at line 806 of file gf2.c.

void BPU_gf2PolyCopy ( BPU_T_GF2_Poly out,
const BPU_T_GF2_Poly in 
)

Copy polynomial. After work you have to free memory using call BPU_gf2PolyFree.

Parameters
outoutput polynomial
ininput polynomial

Definition at line 586 of file gf2.c.

void BPU_gf2PolyDiv ( BPU_T_GF2_Poly q,
BPU_T_GF2_Poly r,
const BPU_T_GF2_Poly a,
const BPU_T_GF2_Poly b 
)

Polynomial division. q = a / b r = a % b

Parameters
qquotient
rreminder
adividend
bdivisor

Definition at line 912 of file gf2.c.

void BPU_gf2PolyExtEuclidA ( BPU_T_GF2_Poly d,
BPU_T_GF2_Poly s,
BPU_T_GF2_Poly t,
const BPU_T_GF2_Poly a,
const BPU_T_GF2_Poly b,
const BPU_T_GF2_Poly m 
)

Extended Euclidean algorithm (XGCD). a*s + b*t = d

Parameters
dgcd(a,b)
sBézout coefficient s
tBézout coefficient t
apoly a
bpoly b
mmodulo

Definition at line 951 of file gf2.c.

int BPU_gf2PolyGetHighestBitPos ( BPU_T_GF2_Poly a)

Returns highest set coefficient in polynomial.

Parameters
apoly
Returns
Index of highest set coefficient in polynomial.

Definition at line 733 of file gf2.c.

int BPU_gf2PolyInitRand ( BPU_T_GF2_Poly out,
int  l,
int  w,
int  set_deg 
)

Initialize random polynomial. After work you have to free memory using call BPU_gf2PolyFree.

Parameters
outoutput polynomial
llength of polynomial (length - 1 = degree of polynomial)
wweight of polynomial
set_degboolean param, if 1, it will crop polynomial to the actual degree and reallocate it
Returns
0 - succes, else error

Definition at line 626 of file gf2.c.

int BPU_gf2PolyInv ( BPU_T_GF2_Poly out,
const BPU_T_GF2_Poly a,
const BPU_T_GF2_Poly mod 
)

Calc inversion polynomial. out = a^-1 mod m

Parameters
outinversion to a
apolynomial
mmodulo
Returns
1 if found, else not found

Definition at line 1042 of file gf2.c.

int BPU_gf2PolyIsZero ( const BPU_T_GF2_Poly a)

Is poly zero?

Parameters
apoly
Returns
if 1, poly is zero, else 0

Definition at line 1087 of file gf2.c.

void BPU_gf2PolyMulMod ( const BPU_T_GF2_Poly a,
const BPU_T_GF2_Poly b,
BPU_T_GF2_Poly c,
const BPU_T_GF2_Poly m,
int  crop 
)

Polynomial multiplication modulo. c = a * b mod m If is set crop to 1, it will set new polynomial degree. Else it will have degree of degree(modulo) - 1.

Parameters
afactor
bfactor
cproduct
mmodulo
cropboolean, if set actual degree of output

Definition at line 876 of file gf2.c.

void BPU_gf2PolyMulX ( BPU_T_GF2_Poly a)

Multiplicate polynomial by x.

Parameters
ainput / output polynomial

Definition at line 772 of file gf2.c.

void BPU_gf2PolySetDeg ( BPU_T_GF2_Poly a,
int  deg 
)

Find highest coefficient in polynomial and set degree. Reallocating new size.

Parameters
apoly
degif -1, set degree = max poly degree, else set given degree

Definition at line 747 of file gf2.c.

void BPU_gf2PolyShiftLeft ( BPU_T_GF2_Poly a,
int  shift_count 
)

Shift polynomial left by given positions.

Parameters
apolynomial to be shifted
shift_countcount of shiftes to do

Definition at line 681 of file gf2.c.

void BPU_gf2PolyShiftRightOne ( BPU_T_GF2_Poly a)

Shift polynomial right by one.

Parameters
apolynomial to be shifted

Definition at line 792 of file gf2.c.

void BPU_gf2PolyTransp ( BPU_T_GF2_Poly out,
const BPU_T_GF2_Poly in 
)

Transpose polynomial.

Parameters
outtransposed output polynomial
ininput polynomial

Definition at line 1061 of file gf2.c.

int BPU_gf2QcMatrixToSparse ( BPU_T_GF2_Sparse_Qc_Matrix out,
const BPU_T_GF2_QC_Matrix in,
const int  wi[] 
)

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

Parameters
outoutput sparse quasi-cyclic matrix
inputquasi-cyclic matrix
wiweights of cyclic elements in input matrix
Returns

Definition at line 599 of file gf2.c.

void BPU_gf2QcMatrixTransp ( BPU_T_GF2_QC_Matrix out,
const BPU_T_GF2_QC_Matrix in 
)

Transpose quasi-cyclic matrix.

Parameters
outoutput transposed matrix
ininput matrix

Definition at line 1076 of file gf2.c.

void BPU_gf2SparsePolyAdd ( BPU_T_GF2_Poly out,
const BPU_T_GF2_Sparse_Poly in 
)

Polynomial add sparse polynomial. out = out + in

Parameters
outinput / output polynomial
inintput sparse polynomial

Definition at line 830 of file gf2.c.

int BPU_gf2SparsePolyAndHW ( const BPU_T_GF2_Poly a,
const BPU_T_GF2_Sparse_Poly b 
)

Polynomial and sparse polynomial, returns hamming weight of result. hw(and(a,b))

Parameters
apolynomial
bsparse polynomial
Returns
hamming weight of result of and operation

Definition at line 839 of file gf2.c.

void BPU_gf2SparsePolyCopy ( BPU_T_GF2_Sparse_Poly out,
const BPU_T_GF2_Sparse_Poly in 
)

Copy sparse polynomial. After work you have to free memory using call BPU_gf2SparsePolyFree.

Parameters
outoutput sparse polynomial
ininput sparse polynomial

Definition at line 642 of file gf2.c.

void BPU_gf2SparseQcMatrixGetRow ( BPU_T_GF2_Sparse_Poly p,
const BPU_T_GF2_Sparse_Qc_Matrix m,
int  row_num 
)

Get row from sparse quasi-cyclic matrix.

Parameters
msparse QC matrix
poutput row
row_numindex of row to get

Definition at line 852 of file gf2.c.

void BPU_gf2SparseQcMatrixTransp ( BPU_T_GF2_Sparse_Qc_Matrix out,
const BPU_T_GF2_Sparse_Qc_Matrix in 
)

Transpose sparse quasi-cyclic matrix.

Parameters
outoutput transposed matrix
ininput matrix

Definition at line 652 of file gf2.c.

void BPU_gf2Swap ( BPU_T_GF2 a,
BPU_T_GF2 b 
)

Swaps GF2 elements.

Parameters
apointer to GF2 element
bpointer to GF2 element
Returns

Definition at line 340 of file gf2.c.

int BPU_gf2VecCmp ( const BPU_T_GF2_Vector v1,
const BPU_T_GF2_Vector v2 
)

BPU_gf2VecCmp Compare two vectors.

Parameters
v1
v2
Returns
0 - same, -1 - len differs, > 0 (index + 1) of first difference

Definition at line 467 of file gf2.c.

int BPU_gf2VecConcat ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Vector vec1,
const BPU_T_GF2_Vector vec2 
)

Concats two vectors without allocation ouput.

Concats two vectors without allocation ouput.

Parameters
vec1first vector
vec2second vector
outoutput vector - concat of vec1 and vec2, it allocates vector inside function, should be freed after use BPU_freeVecGF2()
Returns
0 - succes, else error

Definition at line 399 of file gf2.c.

void BPU_gf2VecCopy ( BPU_T_GF2_Vector dest,
const BPU_T_GF2_Vector src 
)

Copy VectorGF2.

Copy VectorGF2.

Parameters
dest[out]pointer to VectorGF2
src[in]pointer to VectorGF2

Definition at line 454 of file gf2.c.

int BPU_gf2VecCrop ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Vector in,
const int  start,
const int  length 
)

Crop the vector

Parameters
outoutput vector
ininput vector
startstarting position in vector
lengthcount of bits of cropped vector
Returns
0 - succes, else error

Definition at line 424 of file gf2.c.

BPU_T_GF2 BPU_gf2VecGetMaskedBit ( const BPU_T_GF2_Vector vec,
uint32_t  bit 
)

Get masked bit from Vector GF2

Parameters
vecvector GF2
bitbit
Returns
masked bit

Definition at line 314 of file gf2.c.

int BPU_gf2VecMulMat ( BPU_T_GF2_Vector x,
const BPU_T_GF2_Vector v,
const BPU_T_GF2_Matrix b 
)

Vector and matrix multiplication over GF2. x = v * b, vector is in 'line' format like [010111010001]. It selects i-th row from matrix b and xor it together, when vector v has at i-th column 1. After work you have to free memory using call BPU_freeMat

Parameters
[out]xvector GF2, it is matrix k = 1, n = length of vec, new vector (matrix)
[in]vvector GF2, it is matrix k = 1, n = length of vec
[in]bmatrix GF2
Returns
on succes 0, on size error -1, on allocation error -2

Definition at line 495 of file gf2.c.

int BPU_gf2VecPermute ( BPU_T_GF2_Vector vec,
const BPU_T_Perm_Vector permutation 
)

Permute vector GF2 with permutation.

Parameters
vecvector GF2
permutationpermutation vector
Returns
on succes 0, on size error -1, on allocation error -2

Definition at line 289 of file gf2.c.

int BPU_gf2VecRand ( BPU_T_GF2_Vector out,
int  w 
)

Create a binary vector of required length and weight. After work call BPU_freeVecGF2

Parameters
outGF2 vector representation (L)
wweight of vector, if 0 weight is random
Returns
0 - succes, else error

Definition at line 240 of file gf2.c.

int BPU_gf2VecXor ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Vector in 
)

Xor two Vectors GF2 and store result in first vector.

Xor two Vectors GF2 and store result in first vector.

Parameters
out[out]vector, where will be stored result
in[in]vector
Returns
0 - successm else error

Definition at line 481 of file gf2.c.

void BPU_printBinary32LsbLn ( uint32_t  in)

Print number as binary string in little endian so lsb is first printed.

Print number as binary string in little endian so lsb is first printed. Print also new line at the end. Example: number 21 -> 1010 1000 It will be padded 64 bits.

Parameters
ininput of max 64 bits

Definition at line 69 of file gf2.c.

void BPU_printBinaryLsb ( uint32_t  in,
int  len 
)

Print number as binary string in little endian so lsb is first printed.

Print number as binary string in little endian so lsb is first printed. Do not print new line at the end. Example: number 21 -> 1010 1000

Parameters
ininput of max 64 bits
lenprint len

Definition at line 52 of file gf2.c.

void BPU_printBinaryLsb32 ( uint32_t  in)

Print number as binary string in little endian so lsb is first printed.

Print number as binary string in little endian so lsb is first printed. Do not print new line at the end. Example: number 21 -> 1010 1000 It will be padded to 64 bits.

Parameters
ininput of max 64 bits

Definition at line 65 of file gf2.c.

void BPU_printBinaryLsbLn ( uint32_t  in,
int  len 
)

Print number as binary string in little endian so lsb is first printed.

Print number as binary string in little endian so lsb is first printed. Print also new line at the end. Example: number 21 -> 1010 1000

Parameters
ininput of max 64 bits
lenprint len

Definition at line 60 of file gf2.c.

void BPU_printBinaryMsb ( uint32_t  in,
int  len 
)

Print number as binary string in big endian so msb is first printed.

Print number as binary string in big endian so msb is first printed. Do not print new line at the end. Example: number 21 -> 0001 0101

Parameters
ininput of max 64 bits
lenprint len

Definition at line 31 of file gf2.c.

void BPU_printBinaryMsb32 ( uint32_t  in)

Print number as binary string in big endian so msb is first printed.

Print number as binary string in big endian so msb is first printed. Do not print new line at the end. Example: number 21 -> 0001 0101 It will be padded to 64 bits.

Parameters
ininput of max 64 bits

Definition at line 44 of file gf2.c.

void BPU_printBinaryMsb32Ln ( uint32_t  in)

Print number as binary string in big endian so msb is first printed.

Print number as binary string in big endian so msb is first printed. Print also new line at the end. Example: number 21 -> 0001 0101 It will be padded 64 bits.

Parameters
ininput of max 64 bits

Definition at line 48 of file gf2.c.

void BPU_printBinaryMsbLn ( uint32_t  in,
int  len 
)

Print number as binary string in big endian so msb is first printed.

Print number as binary string in big endian so msb is first printed. Print also new line at the end. Example: number 21 -> 0001 0101

Parameters
ininput of max 64 bits
lenprint len

Definition at line 39 of file gf2.c.

void BPU_printGf2Mat ( const BPU_T_GF2_Matrix m)

Print matrix GF2 with new lines.

Parameters
mmatrix

Definition at line 73 of file gf2.c.

void BPU_printGf2Poly ( const BPU_T_GF2_Poly v)

Print polynomial.

Parameters
vpolynomial to print

Definition at line 184 of file gf2.c.

void BPU_printGf2PolyForMatrix ( const BPU_T_GF2_Poly v)

Print polynomial over GF2 for matrix. Without header and new line.

Parameters
vpolynomial to print

Definition at line 165 of file gf2.c.

void BPU_printGf2QcMatrix ( const BPU_T_GF2_QC_Matrix v)

Print quasi-cyclic matrix.

Parameters
vquasi-cyclic matrix to print

Definition at line 205 of file gf2.c.

void BPU_printGf2SparsePoly ( const BPU_T_GF2_Sparse_Poly v)

Print sparse polynomial.

Parameters
vsparse polynomial to print

Definition at line 155 of file gf2.c.

void BPU_printGf2SparseQcMatrix ( const BPU_T_GF2_Sparse_Qc_Matrix v)

Print sparse quasi-cyclic matrix.

Parameters
vsparse quasi-cyclic matrix to print

Definition at line 225 of file gf2.c.

void BPU_printGf2Vec ( const BPU_T_GF2_Vector v)

Print vector GF2 with new line.

Parameters
vvector

Definition at line 100 of file gf2.c.

void BPU_printGf2VecMsb ( const BPU_T_GF2_Vector v)

BPU_printGf2VecMsb Most significant bit is printed first.

Parameters
v

Definition at line 122 of file gf2.c.

void BPU_printGf2VecOnes ( const BPU_T_GF2_Vector vec)

BPU_printGf2VecOnes Print only ones.

Parameters
vec

Definition at line 144 of file gf2.c.