Template Struct matrix¶
Defined in File matrix.hpp
Struct Documentation¶
-
template<typename T>
struct matrix¶ A general matrix class (of ints, double and Complex types).
Public Functions
-
inline matrix()¶
default constructor (private)
-
inline matrix(size_t _r)¶
constructor with a given size (square matrix)
-
inline matrix(size_t _r, size_t _c)¶
constructor with a given size (non square)
-
inline matrix(const size_t _r, const size_t _c, const vector<T> &_v)¶
constructor with a given size from a vector
-
inline matrix(const matrix<T> &A, const matrix<T> &B)¶
concatenation constructor (puts the matrix side by side)
-
inline void concatenate(const matrix<T> &A, const matrix<T> &B)¶
concatenation (puts the matrix side by side)
-
template<typename S>
inline void move_sub_matrix(size_t R, size_t C, size_t i, size_t j, size_t I, size_t J, matrix<S> &A, double z = 1.0) const¶ extracts a rectangular submatrix of size (R,C), starting at (i,j) of this, and copies it to position (I, J) of A
-
template<typename S>
inline void move_sub_matrix_conjugate(size_t R, size_t C, size_t i, size_t j, size_t I, size_t J, matrix<S> &A, double z = 1.0) const¶ extracts a rectangular submatrix of size (R,C), starting at (i,j) of this, and copies its complex conjugate to position (I, J) of A
-
template<typename S>
inline void move_sub_matrix_HC(size_t R, size_t C, size_t i, size_t j, size_t I, size_t J, matrix<S> &A, double z = 1.0) const¶ extracts a rectangular submatrix of size (R,C), starting at (i,j) of this, and copies its hermitian conjugate to position (I, J) of A
-
template<typename S>
inline void move_sub_matrix_transpose(size_t R, size_t C, size_t i, size_t j, size_t I, size_t J, matrix<S> &A, double z = 1.0) const¶ extracts a rectangular submatrix of size (R,C), starting at (i,j) of this, and copies its transpose to position (I, J) of A
-
inline void zero()¶
sets to zero
-
inline void apply_mask(const vector<size_t> &mask)¶
sets to zero the components addressed by the mask
-
inline void set_size(size_t _r, size_t _c)¶
sets size and allocate
-
inline void set_size(size_t _r)¶
-
inline void identity()¶
initializes to the identity matrix
-
template<typename S>
inline void diagonal(const vector<S> &x)¶ sets the diagonal of A equal to the vector x
-
inline void transpose()¶
replaces the matrix by its transpose
-
inline void hermitian_conjugate()¶
replaces the matrix by its Hermitean conjugate
-
template<typename S>
inline T trace_product(matrix<S> A, bool transpose = false)¶ computes the trace of the product with a matrix A
-
template<typename S>
inline matrix<T> &operator-=(const S &a)¶ substraction of a number times the unit matrix
-
template<typename S>
inline matrix<T> &operator+=(const S &a)¶ addition of a number times the unit matrix
-
inline double diff_sq(const matrix<T> &A, double a = 1.0)¶
calculates the squared difference between a matrix and this: |this -A|^2
-
template<typename S, typename U>
inline void product(const matrix<S> &A, const matrix<U> &B)¶ multiplies two matrices : this = A * B
-
template<typename S, typename U>
inline void product(const matrix<S> &A, const matrix<U> &B, size_t M)¶ multiplies two matrices : this = A * B with a bound on a the intermediate index
-
template<typename S, typename U>
inline void product_transpose(const matrix<S> &A, const matrix<U> &B)¶ multiplies two matrices : this = A * transpose(B)
-
template<typename S, typename U>
inline void product_hermitian_conjugate(const matrix<S> &A, const matrix<U> &B)¶ multiplies two matrices : this = A * hermitian(B)
-
template<typename S, typename B>
inline void add(const matrix<S> &A, B d)¶ adds a number times another matrix
-
template<typename S>
inline void simil(const matrix<S> &A)¶ performs a similarity transformation : this = hermitian(A) * this * A
-
template<typename S>
inline void simil_inv(const matrix<S> &A)¶ performs a similarity transformation : this = A * this * hermitian(A)
-
template<typename S>
inline void simil_transpose(const matrix<S> &A)¶ performs a similarity transformation : this = transpose(A) * this * A
-
template<typename S>
inline void simil_conjugate(const matrix<S> &A)¶ performs a similarity transformation : this = hermitian(A) * this * conjugate(A)
-
template<typename S1, typename S2>
inline void simil(const matrix<S1> &A, const matrix<S2> &B)¶ performs a similarity transformation : this = hermitian(A) * B * A
-
inline void left_apply_add(const vector<T> &x, vector<T> &y) const¶
Application on an array : y += conj(x) * this.
-
inline bool is_diagonal(double accuracy = 1.0e-8)¶
checks whether the matrix is diagonal
-
inline void cconjugate()¶
takes the complex conjugate
-
inline bool printable()¶
-
inline bool is_unitary(double threshold)¶
returns true if the matrix is unitary or orthogonal
-
inline bool is_hermitian(double threshold = 1e-10)¶
returns true if the matrix is hermitian or real symmetric
-
inline bool Gram_Schmidt(const vector<T> &x, size_t col)¶
Performs the Gram-Schmidt procedure on an input vector x to produce the current matrix, with the vector x located in the column associated with its largest value.
-
inline void antisymmetrize()¶
Replaces the current matrix by its antihermitian (antisymmetric) part.
-
inline void symmetrize()¶
Replaces the current matrix by its hermitian (symmetric) part.
-
double norm()¶
-
double norm2()¶
-
void inverse()¶
-
void eigenvalues(vector<double> &d)¶
-
bool is_real(double accuracy = 1e-6)¶
-
bool is_orthogonal(double accuracy = 1e-6)¶
-
bool triangular_inverse()¶
-
inline matrix()¶