|
Data type for small dense matrix. More...
#include <SmallMatrix.h>
Public Member Functions | |
SmallMatrix () | |
Constructs a matrix of size n-rows by m-columns. More... | |
SmallMatrix (const SmallVector< numberOfRows > &other) | |
SmallMatrix (const Mdouble &c) | |
Constructs a matrix of size n-rows by m-columns and initialises all entry to a constant. More... | |
SmallMatrix (const std::initializer_list< SmallVector< numberOfRows >> &entries) | |
SmallMatrix (const SmallMatrix &other) | |
Construct and copy Matrix from another Matrix i.e. B(A) where B and A are both matrices. More... | |
SmallMatrix (std::array< SmallVector< numberOfRows >, numberOfColumns > entries) | |
Glues one or more vectors with the same number of rows together. More... | |
SmallMatrix (SmallMatrix &&other) | |
Move Matrix from another Matrix. More... | |
Mdouble & | operator() (unsigned int n, unsigned int m) |
defines the operator(n,m) to access the element on row n and column m More... | |
const Mdouble & | operator() (unsigned int n, unsigned int m) const |
defines the operator(n,m) to access the element on row n and column m More... | |
Mdouble & | operator[] (const unsigned int n) |
Access the n linear element in the matrix. More... | |
const Mdouble & | operator[] (const unsigned int n) const |
SmallVector< numberOfRows > | operator* (SmallVector< numberOfColumns > &right) |
Defines Matrix A times vector B and return vector C i.e. C_,j= A_ij B_,j. More... | |
SmallVector< numberOfRows > | operator* (SmallVector< numberOfColumns > &right) const |
SmallMatrix | operator* (const Mdouble &right) const |
Does matrix A_ij=scalar*B_ij. More... | |
template<unsigned int K> | |
SmallMatrix< numberOfRows, K > | operator* (const SmallMatrix< numberOfColumns, K > &other) |
Does matrix A_ij = B_ik * C_kj. More... | |
template<unsigned int K> | |
SmallMatrix< numberOfRows, K > | operator* (const SmallMatrix< numberOfColumns, K > &other) const |
SmallMatrix & | operator+= (const SmallMatrix &other) |
SmallMatrix & | operator-= (const SmallMatrix &other) |
SmallMatrix | operator+ (const SmallMatrix &other) const |
SmallMatrix | operator- (const SmallMatrix &other) const |
SmallMatrix | operator- () const |
SmallMatrix & | operator*= (const Mdouble &scalar) |
Does matrix A_ij=scalar*A_ij. More... | |
SmallMatrix & | operator*= (const SmallMatrix< numberOfColumns, numberOfColumns > &other) |
Does matrix A_ij = A_ik * B_kj note that other must be square because this is a fixed-size matrix. More... | |
SmallMatrix & | operator/= (const Mdouble &scalar) |
Does matrix A_ij=scalar*A_ij. More... | |
SmallMatrix | operator/ (const Mdouble &scalar) const |
this does element by divided by a scalar More... | |
SmallMatrix & | operator= (const SmallMatrix &right) |
Assigns one matrix to another. More... | |
SmallMatrix & | operator= (SmallMatrix &&right) |
Assigns one matrix to another. More... | |
SmallVector< numberOfRows > | computeWedgeStuffVector () const |
computeWedgeStuffVector. More... | |
void | axpy (Mdouble a, const SmallMatrix &x) |
Applies the matrix y=ax + y, where x is another matrix and a is a scalar. More... | |
unsigned int | size () const |
Get total number of Matrix entries. More... | |
unsigned int | getNumberOfRows () const |
Get the number of rows. More... | |
unsigned int | getNRows () const |
unsigned int | getNumberOfColumns () const |
Get the number of columns. More... | |
unsigned int | getNCols () const |
SmallVector< numberOfRows > | getColumn (unsigned int j) const |
get the j^th column More... | |
SmallVector< numberOfColumns > | getRow (unsigned int i) const |
get the i^th row More... | |
SmallMatrix | LUfactorisation () const |
Return the LUfactorisation of the matrix. More... | |
Mdouble | determinant () const |
SmallMatrix | inverse () const |
return the inverse in the vector result. The size of result matches the matrix. More... | |
SmallMatrix< numberOfColumns, numberOfRows > | transpose () const |
template<unsigned int numberOfRightHandSideColumns> | |
void | solve (SmallMatrix< numberOfRows, numberOfRightHandSideColumns > &B) const |
solves Ax=B where A is the current matrix and B is passed in. The result is returned in B. More... | |
void | solve (SmallVector< numberOfRows > &b) const |
solves Ax=b where A is the current matrix and NumericalVector b is the input parameter. The result is returned in b. More... | |
Mdouble * | data () |
const Mdouble * | data () const |
Private Attributes | |
std::array< Mdouble, numberOfRows *numberOfColumns > | data_ |
The actually data of the matrix class. More... | |
Data type for small dense matrix.
Stores small dense matrix efficiently. It only store Mdoubles as this is the main type linear algebra is done on in hpGEM It stores the matrix in fortran style (column-major) to give quicker access to extern BLAS libraries. For example, the order they are stored in a 2x2 matrix is 0 2 1 3
|
inline |
Constructs a matrix of size n-rows by m-columns.
|
inline |
References SmallVector< numberOfRows >::data(), SmallMatrix< numberOfRows, numberOfColumns >::data_, and logger.
|
inline |
Constructs a matrix of size n-rows by m-columns and initialises all entry to a constant.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
References constants::i, and logger.
|
inline |
Construct and copy Matrix from another Matrix i.e. B(A) where B and A are both matrices.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
|
inline |
|
inline |
Applies the matrix y=ax + y, where x is another matrix and a is a scalar.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and constants::i.
Referenced by main().
SmallVector< numberOfRows > SmallMatrix< numberOfRows, numberOfColumns >::computeWedgeStuffVector |
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getColumn(), SmallMatrix< numberOfRows, numberOfColumns >::inverse(), SmallMatrix< numberOfRows, numberOfColumns >::LUfactorisation(), main(), SmallMatrix< numberOfRows, numberOfColumns >::operator*(), operator*(), and SmallMatrix< numberOfRows, numberOfColumns >::solve().
|
inline |
Mdouble SmallMatrix< numberOfRows, numberOfColumns >::determinant |
|
inline |
get the j^th column
References SmallMatrix< numberOfRows, numberOfColumns >::data(), and logger.
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::getNumberOfColumns().
Referenced by main().
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::getNumberOfRows().
|
inline |
Get the number of columns.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getNCols().
|
inline |
Get the number of rows.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getNRows(), and main().
|
inline |
get the i^th row
References constants::i, and logger.
SmallMatrix< numberOfRows, numberOfColumns > SmallMatrix< numberOfRows, numberOfColumns >::inverse |
return the inverse in the vector result. The size of result matches the matrix.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgetrf_(), dgetri_(), and logger.
Referenced by main().
SmallMatrix< numberOfRows, numberOfColumns > SmallMatrix< numberOfRows, numberOfColumns >::LUfactorisation |
Return the LUfactorisation of the matrix.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), and dgetrf_().
|
inline |
defines the operator(n,m) to access the element on row n and column m
References SmallMatrix< numberOfRows, numberOfColumns >::data_, logger, and n.
|
inline |
defines the operator(n,m) to access the element on row n and column m
References SmallMatrix< numberOfRows, numberOfColumns >::data_, logger, and n.
|
inline |
SmallMatrix< numberOfRows, K > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | const SmallMatrix< numberOfColumns, K > & | other | ) |
Does matrix A_ij = B_ik * C_kj.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgemm_(), constants::i, logger, and WARN.
SmallMatrix< numberOfRows, K > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | const SmallMatrix< numberOfColumns, K > & | other | ) | const |
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgemm_(), constants::i, logger, and WARN.
SmallVector< numberOfRows > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | SmallVector< numberOfColumns > & | right | ) |
Defines Matrix A times vector B and return vector C i.e. C_,j= A_ij B_,j.
References SmallVector< numberOfRows >::data(), DEBUG, dgemv_(), logger, SmallVector< numberOfRows >::size(), and WARN.
SmallVector< numberOfRows > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | SmallVector< numberOfColumns > & | right | ) | const |
References SmallVector< numberOfRows >::data(), DEBUG, dgemv_(), logger, SmallVector< numberOfRows >::size(), and WARN.
|
inline |
SmallMatrix< numberOfRows, numberOfColumns > & SmallMatrix< numberOfRows, numberOfColumns >::operator*= | ( | const SmallMatrix< numberOfColumns, numberOfColumns > & | other | ) |
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
this does element by divided by a scalar
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
|
inline |
Assigns one matrix to another.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Assigns one matrix to another.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
|
inline |
|
inline |
Get total number of Matrix entries.
Referenced by main().
void SmallMatrix< numberOfRows, numberOfColumns >::solve | ( | SmallMatrix< numberOfRows, numberOfRightHandSideColumns > & | B | ) | const |
solves Ax=B where A is the current matrix and B is passed in. The result is returned in B.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgesv_(), logger, and n.
Referenced by SuperQuadricParticle::computeContactPoint(), and main().
void SmallMatrix< numberOfRows, numberOfColumns >::solve | ( | SmallVector< numberOfRows > & | b | ) | const |
solves Ax=b where A is the current matrix and NumericalVector b is the input parameter. The result is returned in b.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), SmallVector< numberOfRows >::data(), dgesv_(), logger, and n.
|
inline |
|
private |
The actually data of the matrix class.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::axpy(), SmallMatrix< numberOfRows, numberOfColumns >::data(), SmallMatrix< numberOfRows, numberOfColumns >::operator()(), SmallMatrix< numberOfRows, numberOfColumns >::operator*(), SmallMatrix< numberOfRows, numberOfColumns >::operator*=(), SmallMatrix< numberOfRows, numberOfColumns >::operator+(), SmallMatrix< numberOfRows, numberOfColumns >::operator+=(), SmallMatrix< numberOfRows, numberOfColumns >::operator-(), SmallMatrix< numberOfRows, numberOfColumns >::operator-=(), SmallMatrix< numberOfRows, numberOfColumns >::operator/(), SmallMatrix< numberOfRows, numberOfColumns >::operator/=(), SmallMatrix< numberOfRows, numberOfColumns >::operator=(), SmallMatrix< numberOfRows, numberOfColumns >::operator[](), and SmallMatrix< numberOfRows, numberOfColumns >::SmallMatrix().