Template Struct block_matrix

Struct Documentation

template<typename T>
struct block_matrix

lock-diagonal matrix (of ints, double or Complex types)

Public Functions

inline block_matrix()

default constructor

inline block_matrix(size_t n)

constructor from a number of blocks

inline block_matrix(vector<size_t> dim)

constructor from a vector of dimensions

inline block_matrix(vector<int> dim)

constructor from a vector of dimensions

inline block_matrix(vector<matrix<T>> &_block)

constructor from a vector of matrices

inline block_matrix &operator=(const block_matrix<T> &A)

assignation operator overloading

inline void set_size()

computes the size

inline T operator()(const size_t &i, const size_t &j) const

element access (for rhs)

inline matrix<T> build_matrix()

construct a Matrix from a block_matrix

template<typename S>
inline block_matrix<T> &operator-=(const block_matrix<S> &A)

subtraction of another block matrix

template<typename S>
inline block_matrix<T> &operator+=(const block_matrix<S> &A)

addition of another block matrix

template<typename S>
inline void add(matrix<S> &Y, T z) const

adding to a matrix, times a constant: Y = Y + z*this

inline void add(T d)

adds a number times the identity matrix

inline void clear()

clears to zero (but keep allocated)

inline double diff_sq(const block_matrix<T> &A)

computes the square difference with another matrix A

inline void inverse()

replaces the matrix by its inverse

inline T trace()

returns the trace of the matrix

inline block_matrix<T> &operator+=(const double a)

addition of a number times the unit matrix

inline block_matrix<T> &operator+=(const Complex a)
inline block_matrix<T> &operator-=(const double a)
inline block_matrix<T> &operator-=(const Complex a)
template<typename S, typename U>
inline void mult_left(const matrix<S> &X, matrix<U> &Y) const

multiplies a block matrix with a dense matrix : Y = this * X

template<typename S, typename U>
inline void mult_right(const matrix<S> &X, matrix<U> &Y) const

multiplies a dense matrix with a block matrix : Y = X * this

template<typename S, typename U>
inline void simil(matrix<S> &A, const matrix<U> &B)

performs a similarity transformation : A = hermitian(this) * B * this

template<typename S, typename U>
inline void simil_conjugate(matrix<S> &A, const matrix<U> &B)

performs a similarity transformation : A = this * B * hermitian(this)

Public Members

size_t r

total number of rows

size_t c

total number of rows

vector<matrix<T>> block

blocks

vector<size_t> cumul_r

total number of rows before each block

vector<size_t> cumul_c

total number of columns before each block