#include <matrix.h>

Public Member Functions

 Matrix ()
 
 Matrix (int rows, int cols)
 
void clear ()
 
bool empty () const
 
void resize (int rows, int cols)
 
void set_rows (int rows)
 
void set_cols (int cols)
 
template<class U >
void fill (U value)
 
void swap (Matrix< T > &m)
 
int get_rows () const
 
int get_cols () const
 
T & operator() (int i, int j)
 
const T & operator() (int i, int j) const
 
MatrixRow< T > operator[] (int i)
 
const MatrixRow< T > operator[] (int i) const
 
void swap_rows (int r1, int r2)
 
void rotate_left (int first, int last)
 
void rotate_right (int first, int last)
 
void rotate (int first, int middle, int last)
 
void rotate_gram_left (int first, int last, int n_valid_rows)
 
void rotate_gram_right (int first, int last, int n_valid_rows)
 
void transpose ()
 
get_max ()
 
long get_max_exp ()
 
void print (ostream &os, int nrows=-1, int ncols=-1) const
 
void read (istream &is)
 
ostream & print_comma (ostream &os) const
 

Static Public Member Functions

static int set_print_mode (int new_print_mode)
 

Protected Attributes

int r
 
int c
 
vector< NumVect< T > > matrix
 

Static Protected Attributes

static int print_mode = MAT_PRINT_COMPACT
 

Detailed Description

template<class T>
class Matrix< T >

Matrix is a two-dimensional container. Read and write operations on single elements are in constant time. The amortized complexity of resizing the matrix is proportional to the number of added/removed elements. All indices are 0-based.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

template<class T >
Matrix< T >::Matrix ( )
inline

Creates an empty matrix (0 x 0).

◆ Matrix() [2/2]

template<class T >
Matrix< T >::Matrix ( int  rows,
int  cols 
)
inline

Creates a matrix of dimensions rows x cols. All elements are initialized with the default constructor of T.

Member Function Documentation

◆ clear()

template<class T >
void Matrix< T >::clear ( )
inline

Sets number of rows and the number of columns to 0.

◆ empty()

template<class T >
bool Matrix< T >::empty ( ) const
inline

Returns true if the matrix has 0 rows, false otherwise.

◆ fill()

template<class T >
template<class U >
void Matrix< T >::fill ( value)

Fills this matrix with a given value.

◆ get_cols()

template<class T >
int Matrix< T >::get_cols ( ) const
inline

Returns the number of columns

◆ get_max()

template<class T >
T Matrix< T >::get_max

◆ get_max_exp()

template<class T >
long Matrix< T >::get_max_exp

◆ get_rows()

template<class T >
int Matrix< T >::get_rows ( ) const
inline

Returns the number of rows

◆ operator()() [1/2]

template<class T >
T & Matrix< T >::operator() ( int  i,
int  j 
)
inline

Returns a reference to the element (i, j).

◆ operator()() [2/2]

template<class T >
const T & Matrix< T >::operator() ( int  i,
int  j 
) const
inline

Returns a constant reference to the element (i, j) on constant objects.

◆ operator[]() [1/2]

template<class T >
MatrixRow< T > Matrix< T >::operator[] ( int  i)
inline

Returns a MatrixRow object pointing to the i-th row of this matrix.

◆ operator[]() [2/2]

template<class T >
const MatrixRow< T > Matrix< T >::operator[] ( int  i) const
inline

Returns a MatrixRow object pointing to the i-th row of this matrix on constant objects.

◆ print()

template<class T >
void Matrix< T >::print ( ostream &  os,
int  nrows = -1,
int  ncols = -1 
) const

Prints this matrix. No end-of-line is printed after the last line.

Parameters
osoutput stream
nrowsmaximum number of rows to display (optional)
ncolsmaximum number of columns to display (optional)

◆ print_comma()

template<class T >
ostream & Matrix< T >::print_comma ( ostream &  os) const

Print the matrix, sage format style

◆ read()

template<class T >
void Matrix< T >::read ( istream &  is)

Reads this matrix from a stream.

◆ resize()

template<class T >
FPLLL_BEGIN_NAMESPACE void Matrix< T >::resize ( int  rows,
int  cols 
)

Sets the dimensions of this matrix, preserving as much as possible of the content. The value of new elements is undefined.

◆ rotate()

template<class T >
void Matrix< T >::rotate ( int  first,
int  middle,
int  last 
)
inline

Rows permutation. (m[first],...,m[middle-1],m[middle],m[last]) becomes (m[middle],...,m[last],m[first],...,m[middle-1])

◆ rotate_gram_left()

template<class T >
void Matrix< T >::rotate_gram_left ( int  first,
int  last,
int  n_valid_rows 
)

Transformation needed to update the lower triangular Gram matrix when rotate_left(first, last) is done on the basis of the lattice.

◆ rotate_gram_right()

template<class T >
void Matrix< T >::rotate_gram_right ( int  first,
int  last,
int  n_valid_rows 
)

Transformation needed to update the lower triangular Gram matrix when rotate_right(first, last) is done on the basis of the lattice.

◆ rotate_left()

template<class T >
void Matrix< T >::rotate_left ( int  first,
int  last 
)
inline

Rows permutation. (m[first],...,m[last]) becomes (m[first+1],...,m[last],m[first])

◆ rotate_right()

template<class T >
void Matrix< T >::rotate_right ( int  first,
int  last 
)
inline

Rows permutation. (m[first],...,m[last]) becomes (m[last],m[first],...,m[last-1])

◆ set_cols()

template<class T >
void Matrix< T >::set_cols ( int  cols)
inline

Sets the number of columns. Content is not erased except for deleted columns. The value of new elements is undefined.

◆ set_print_mode()

template<class T >
static int Matrix< T >::set_print_mode ( int  new_print_mode)
inlinestatic

Change the output format style of Matrix

◆ set_rows()

template<class T >
void Matrix< T >::set_rows ( int  rows)
inline

Sets the number of rows. Content is not erased except for deleted rows. The value of new elements is undefined.

◆ swap()

template<class T >
void Matrix< T >::swap ( Matrix< T > &  m)
inline

Efficiently swaps two matrices.

◆ swap_rows()

template<class T >
void Matrix< T >::swap_rows ( int  r1,
int  r2 
)
inline

Rows swap.

◆ transpose()

template<class T >
void Matrix< T >::transpose

Transpose.

Field Documentation

◆ c

template<class T >
int Matrix< T >::c
protected

◆ matrix

template<class T >
vector<NumVect<T> > Matrix< T >::matrix
protected

◆ print_mode

template<class T >
int Matrix< T >::print_mode = MAT_PRINT_COMPACT
staticprotected

◆ r

template<class T >
int Matrix< T >::r
protected

The documentation for this class was generated from the following files: