M4RIE  0.20111004
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Data Structures | Macros | Functions
mzed.h File Reference

Dense matrices over \(\mathbb{F}_{2^e}\) represented as packed matrices. More...

#include <m4ri/m4ri.h>
#include <m4rie/gf2e.h>
#include <m4rie/m4ri_functions.h>

Go to the source code of this file.

Data Structures

struct  mzed_t
 Dense matrices over \(\mathbb{F}_{2^e}\) represented as packed matrices. More...
 

Macros

#define mzed_sub   mzed_add
 \( C = A+B \). More...
 
#define _mzed_sub   _mzed_add
 \( C = A+B \). More...
 

Functions

mzed_tmzed_init (const gf2e *ff, const rci_t m, const rci_t n)
 Create a new matrix of dimension m x n over ff. More...
 
void mzed_free (mzed_t *A)
 Free a matrix created with mzed_init(). More...
 
static mzed_tmzed_concat (mzed_t *C, const mzed_t *A, const mzed_t *B)
 Concatenate B to A and write the result to C. More...
 
static mzed_tmzed_stack (mzed_t *C, const mzed_t *A, const mzed_t *B)
 Stack A on top of B and write the result to C. More...
 
static mzed_tmzed_submatrix (mzed_t *S, const mzed_t *M, const rci_t lowr, const rci_t lowc, const rci_t highr, const rci_t highc)
 Copy a submatrix. More...
 
static mzed_tmzed_init_window (const mzed_t *A, const rci_t lowr, const rci_t lowc, const rci_t highr, const rci_t highc)
 Create a window/view into the matrix A. More...
 
static void mzed_free_window (mzed_t *A)
 Free a matrix window created with mzed_init_window(). More...
 
mzed_tmzed_add (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = A+B \). More...
 
mzed_t_mzed_add (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = A+B \). More...
 
mzed_tmzed_mul (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = A \cdot B \). More...
 
mzed_tmzed_addmul (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = C + A \cdot B \). More...
 
mzed_t_mzed_mul (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = A \cdot B \). More...
 
mzed_t_mzed_addmul (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = C + A \cdot B \). More...
 
mzed_tmzed_addmul_naive (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = C + A \cdot B \) using naive cubic multiplication. More...
 
mzed_tmzed_mul_naive (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = A \cdot B \) using naive cubic multiplication. More...
 
mzed_t_mzed_mul_naive (mzed_t *C, const mzed_t *A, const mzed_t *B)
 \( C = C + A \cdot B \) using naive cubic multiplication. More...
 
mzed_tmzed_mul_scalar (mzed_t *C, const word a, const mzed_t *B)
 \( C = a \cdot B \). More...
 
mzed_t_mzed_mul_init (mzed_t *C, const mzed_t *A, const mzed_t *B, int clear)
 
void mzed_randomize (mzed_t *A)
 Fill matrix A with random elements. More...
 
mzed_tmzed_copy (mzed_t *B, const mzed_t *A)
 Copy matrix A to B. More...
 
void mzed_set_ui (mzed_t *A, word value)
 Return diagonal matrix with value on the diagonal. More...
 
static word mzed_read_elem (const mzed_t *A, const rci_t row, const rci_t col)
 Get the element at position (row,col) from the matrix A. More...
 
static void mzed_add_elem (mzed_t *A, const rci_t row, const rci_t col, const word elem)
 At the element elem to the element at position (row,col) in the matrix A. More...
 
static void mzed_write_elem (mzed_t *A, const rci_t row, const rci_t col, const word elem)
 Write the element elem to the position (row,col) in the matrix A. More...
 
static int mzed_cmp (mzed_t *A, mzed_t *B)
 Return -1,0,1 if if A < B, A == B or A > B respectively. More...
 
static int mzed_is_zero (const mzed_t *A)
 Zero test for matrix. More...
 
void mzed_add_multiple_of_row (mzed_t *A, rci_t ar, const mzed_t *B, rci_t br, word x, rci_t start_col)
 
static void mzed_add_row (mzed_t *A, rci_t ar, const mzed_t *B, rci_t br, rci_t start_col)
 
static void mzed_rescale_row (mzed_t *A, rci_t r, rci_t start_col, const word x)
 Rescale the row r in A by X starting c. More...
 
static void mzed_row_swap (mzed_t *M, const rci_t rowa, const rci_t rowb)
 Swap the two rows rowa and rowb. More...
 
static void mzed_copy_row (mzed_t *B, rci_t i, const mzed_t *A, rci_t j)
 copy row j from A to row i from B. More...
 
static void mzed_col_swap (mzed_t *M, const rci_t cola, const rci_t colb)
 Swap the two columns cola and colb. More...
 
static void mzed_col_swap_in_rows (mzed_t *A, const rci_t cola, const rci_t colb, const rci_t start_row, rci_t stop_row)
 Swap the two columns cola and colb but only between start_row and stop_row. More...
 
static void mzed_row_add (mzed_t *M, const rci_t sourcerow, const rci_t destrow)
 Add the rows sourcerow and destrow and stores the total in the row destrow. More...
 
static rci_t mzed_first_zero_row (mzed_t *A)
 Return the first row with all zero entries. More...
 
rci_t mzed_echelonize_naive (mzed_t *A, int full)
 Gaussian elimination. More...
 
void mzed_print (const mzed_t *M)
 Print a matrix to stdout. More...
 

Detailed Description

Dense matrices over \(\mathbb{F}_{2^e}\) represented as packed matrices.

This file implements the data type mzed_t. That is, matrices over \(\mathbb{F}_{2^e}\) in row major representation.

For example, let \( a = \sum a_i x_i / <f>\) and \(b = \sum b_i x_i / <f>\) be elements in \(\mathbb{F}_{2^6}\) with minimal polynomial \(f\). Then, the \( 1 \times 2\) matrix [b a] would be stored as

 [...| 0 0 b5 b4 b3 b2 b1 b0 | 0 0 a5 a4 a3 a2 a1 a0]

Internally M4RI matrices are used to store bits with allows to re-use existing M4RI methods (such as mzd_add) when implementing functions for mzed_t.

This data type is preferable when Newton-John tables ought be used or when the matrix is small ( \( m \times n \times e < L2\)).

Author
Martin Albrecht marti.nosp@m.nral.nosp@m.brech.nosp@m.t@go.nosp@m.oglem.nosp@m.ail..nosp@m.com

Function Documentation

mzed_t* _mzed_mul_init ( mzed_t C,
const mzed_t A,
const mzed_t B,
int  clear 
)

Check whether C, A and B match in sizes and fields for multiplication

Parameters
COutput matrix, if NULL a new matrix is created.
AInput matrix.
BInput matrix.
clearWrite zeros to C or not.
static int mzed_cmp ( mzed_t A,
mzed_t B 
)
inlinestatic

Return -1,0,1 if if A < B, A == B or A > B respectively.

Parameters
AMatrix.
BMatrix.
Note
This comparison is not well defined mathematically and relatively arbitrary since elements of \(\mathbb{F}_{2^e}\) don't have an ordering.
Examples:
tests/test_multiplication.c.
static int mzed_is_zero ( const mzed_t A)
inlinestatic

Zero test for matrix.

Parameters
AInput matrix.