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

Go to the source code of this file.

Functions

void BPU_printPerm (const BPU_T_Perm_Vector *permutation)
 
int BPU_permRandomize (BPU_T_Perm_Vector *permutation)
 
void BPU_permSwap (BPU_T_Perm_Element *a, BPU_T_Perm_Element *b)
 BPU_swap. More...
 
int BPU_permGetInv (BPU_T_Perm_Vector *out, const BPU_T_Perm_Vector *in)
 
int BPU_permPermute (BPU_T_Perm_Vector *to_permute, const BPU_T_Perm_Vector *permutation)
 
int BPU_permIsValid (const BPU_T_Perm_Vector *p)
 BPU_permIsValid Check wheter is permutaion valid. More...
 

Function Documentation

int BPU_permGetInv ( BPU_T_Perm_Vector out,
const BPU_T_Perm_Vector in 
)

Get inverse permutation to permutation.

Parameters
outinverted permutation must be allocated
inpermutation
Returns
on succes 0, else error

Definition at line 64 of file perm.c.

int BPU_permIsValid ( const BPU_T_Perm_Vector p)

BPU_permIsValid Check wheter is permutaion valid.

Parameters
p
Returns
on succes 0, else error

Definition at line 104 of file perm.c.

int BPU_permPermute ( BPU_T_Perm_Vector to_permute,
const BPU_T_Perm_Vector permutation 
)

Compose permutations.

Parameters
to_permuterow vector to be permuted
permutation
Returns
0 success, -1 when size of vectors is not the same, -2 on memory allocation error

Definition at line 79 of file perm.c.

int BPU_permRandomize ( BPU_T_Perm_Vector permutation)

Generate random permutation.

Parameters
permutationpointer to structure BPU_T_Perm_Vector
sizesize of permutation vector
Returns
on succes 0, else error

Definition at line 43 of file perm.c.

void BPU_permSwap ( BPU_T_Perm_Element a,
BPU_T_Perm_Element b 
)

BPU_swap.

Parameters
a
b

Definition at line 57 of file perm.c.

void BPU_printPerm ( const BPU_T_Perm_Vector permutation)

Print permutation.

Parameters
permutationpermutation

Definition at line 32 of file perm.c.