HILA
|
Define type DiagonalMatrix<n,T> More...
#include <diagonal_matrix.h>
Public Member Functions | |
DiagonalMatrix ()=default | |
Define default constructors to ensure std::is_trivial. | |
T | e (const int i) const |
Element access - e(i) gives diagonal element i. | |
RowVector< n, T > | row (int i) const |
Return row from Diagonal matrix. | |
Vector< n, T > | column (int i) const |
Returns column vector i. | |
DiagonalMatrix< n, T > | operator- () const |
Unary - operator. | |
const auto & | operator+ () const |
Unary + operator. | |
template<typename S > | |
bool | operator!= (const S &rhs) const |
Boolean operator != to check if matrices are exactly different. | |
template<typename S , std::enable_if_t< hila::is_assignable< T &, S >::value, int > = 0> | |
DiagonalMatrix & | operator= (const DiagonalMatrix< n, S > &rhs) & |
template<typename S , std::enable_if_t< hila::is_assignable< T &, S >::value, int > = 0> | |
DiagonalMatrix & | fill (const S rhs) |
fill with constant value - same as assignment | |
DiagonalMatrix & | transpose () const |
transpose - leaves diagonal matrix as is | |
DiagonalMatrix | dagger () const |
dagger - conjugate elements | |
DiagonalMatrix | conj () const |
conj - conjugate elements | |
auto | abs () const |
absolute value of all elements | |
auto | real () const |
real and imaginary parts of diagonal matrix | |
template<typename S = T, std::enable_if_t< hila::is_arithmetic< S >::value, int > = 0> | |
T | max () const |
Find max or min value - only for arithmetic types. | |
DiagonalMatrix & | random () |
Fills Matrix with random elements. | |
std::string | str (int prec=8, char separator=' ') const |
convert to string for printing | |
Matrix< n, n, T > | toMatrix () const |
convert to generic matrix | |
template<int N> | |
DiagonalMatrix< n, T > | sort (Vector< N, int > &permutation, hila::sort order=hila::sort::ascending) const |
implement sort as casting to matrix | |
Static Public Member Functions | |
static constexpr int | rows () |
Returns matrix size - all give same result. | |
Define type DiagonalMatrix<n,T>
Class for diagonal matrix
More optimal storage and algebra than normal square matrix
n | dimensionality |
T | type |
Definition at line 18 of file diagonal_matrix.h.
|
inline |
absolute value of all elements
Returns a real DiagonalMatrix even if the original is complex
Definition at line 303 of file diagonal_matrix.h.
|
inline |
Returns column vector i.
Definition at line 105 of file diagonal_matrix.h.
|
inline |
Element access - e(i) gives diagonal element i.
Definition at line 73 of file diagonal_matrix.h.
|
inline |
Unary - operator.
Definition at line 116 of file diagonal_matrix.h.
|
inline |
Assignment operators: assign from another DiagonalMatrix, scalar or initializer list
Definition at line 146 of file diagonal_matrix.h.
|
inline |
Fills Matrix with random elements.
Works only for non-integer valued elements
Definition at line 385 of file diagonal_matrix.h.
|
inline |
real and imaginary parts of diagonal matrix
Returns a real DiagonalMatrix even if the original is complex
Definition at line 316 of file diagonal_matrix.h.
|
inline |
Return row from Diagonal matrix.
Definition at line 95 of file diagonal_matrix.h.