matrix.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  matrix

Defines

#define BITS_PER_LONG   (8 * sizeof (unsigned long))
#define mat_coeff(A, i, j)   (((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] >> (j % BITS_PER_LONG)) & 1)
#define mat_set_coeff_to_one(A, i, j)   ((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] |= (1UL << ((j) % BITS_PER_LONG)))
#define mat_change_coeff(A, i, j)   ((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] ^= (1UL << ((j) % BITS_PER_LONG)))
#define mat_set_to_zero(R)   memset((R)->elem,0,(R)->alloc_size);

Typedefs

typedef struct matrixbinmat_t

Functions

binmat_t mat_ini (int rown, int coln)
binmat_t mat_ini_from_string (int rown, int coln, const unsigned char *s)
void mat_free (binmat_t A)
binmat_t mat_copy (binmat_t A)
binmat_t mat_rowxor (binmat_t A, int a, int b)
int * mat_rref (binmat_t A)
void mat_vec_mul (unsigned long *cR, unsigned char *x, binmat_t A)
binmat_t mat_mul (binmat_t A, binmat_t B)


Define Documentation

#define BITS_PER_LONG   (8 * sizeof (unsigned long))

Definition at line 24 of file matrix.h.

Referenced by mat_ini(), and mat_ini_from_string().

#define mat_change_coeff ( A,
i,
 )     ((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] ^= (1UL << ((j) % BITS_PER_LONG)))

Definition at line 37 of file matrix.h.

Referenced by key_genmat(), and mat_mul().

#define mat_coeff ( A,
i,
 )     (((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] >> (j % BITS_PER_LONG)) & 1)

Definition at line 34 of file matrix.h.

Referenced by key_genmat(), mat_mul(), and mat_rref().

#define mat_set_coeff_to_one ( A,
i,
 )     ((A)->elem[(i) * A->rwdcnt + (j) / BITS_PER_LONG] |= (1UL << ((j) % BITS_PER_LONG)))

Definition at line 36 of file matrix.h.

Referenced by key_genmat().

#define mat_set_to_zero (  )     memset((R)->elem,0,(R)->alloc_size);

Definition at line 38 of file matrix.h.

Referenced by key_genmat().


Typedef Documentation

typedef struct matrix* binmat_t


Function Documentation

binmat_t mat_copy ( binmat_t  A  ) 

Definition at line 66 of file mat.c.

References matrix::coln, matrix::elem, mat_ini(), matrix::rown, and matrix::rwdcnt.

Here is the call graph for this function:

void mat_free ( binmat_t  A  ) 

Definition at line 60 of file mat.c.

References matrix::elem.

Referenced by key_genmat(), and keypair().

binmat_t mat_ini ( int  rown,
int  coln 
)

Definition at line 33 of file mat.c.

References matrix::alloc_size, BITS_PER_LONG, matrix::coln, matrix::elem, matrix::rown, and matrix::rwdcnt.

Referenced by key_genmat(), mat_copy(), and mat_mul().

binmat_t mat_ini_from_string ( int  rown,
int  coln,
const unsigned char *  s 
)

binmat_t mat_mul ( binmat_t  A,
binmat_t  B 
)

Definition at line 165 of file mat.c.

References matrix::alloc_size, matrix::coln, matrix::elem, mat_change_coeff, mat_coeff, mat_ini(), and matrix::rown.

Here is the call graph for this function:

binmat_t mat_rowxor ( binmat_t  A,
int  a,
int  b 
)

Definition at line 78 of file mat.c.

References matrix::elem, and matrix::rwdcnt.

Referenced by mat_rref().

int* mat_rref ( binmat_t  A  ) 

Definition at line 91 of file mat.c.

References matrix::coln, mat_coeff, mat_rowxor(), and matrix::rown.

Referenced by key_genmat().

Here is the call graph for this function:

void mat_vec_mul ( unsigned long *  cR,
unsigned char *  x,
binmat_t  A 
)

Definition at line 148 of file mat.c.

References matrix::elem, matrix::rown, and matrix::rwdcnt.


This work was partially suported by Europian Network of Excellence, ECRYPT; ECRYPT