MercuryDPM
Trunk
|
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. 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
Definition at line 67 of file SmallMatrix.h.
|
inline |
Constructs a matrix of size n-rows by m-columns.
Definition at line 72 of file SmallMatrix.h.
|
inline |
Definition at line 77 of file SmallMatrix.h.
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.
Definition at line 85 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Definition at line 91 of file SmallMatrix.h.
References constants::i, and logger.
|
inline |
Construct and copy Matrix from another Matrix i.e. B(A) where B and A are both matrices.
Definition at line 109 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Glues one or more vectors with the same number of rows together.
Definition at line 116 of file SmallMatrix.h.
References constants::i.
|
inline |
Move Matrix from another Matrix.
Definition at line 129 of file SmallMatrix.h.
|
inline |
Applies the matrix y=ax + y, where x is another matrix and a is a scalar.
Definition at line 266 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and constants::i.
SmallVector< numberOfRows > SmallMatrix< numberOfRows, numberOfColumns >::computeWedgeStuffVector | ( | ) | const |
computeWedgeStuffVector.
Definition at line 201 of file SmallMatrix_impl.h.
|
inline |
Definition at line 351 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getColumn(), SmallMatrix< numberOfRows, numberOfColumns >::inverse(), SmallMatrix< numberOfRows, numberOfColumns >::LUfactorisation(), SmallMatrix< numberOfRows, numberOfColumns >::operator*(), operator*(), and SmallMatrix< numberOfRows, numberOfColumns >::solve().
|
inline |
Definition at line 356 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
Mdouble SmallMatrix< numberOfRows, numberOfColumns >::determinant | ( | ) | const |
Definition at line 261 of file SmallMatrix_impl.h.
|
inline |
get the j^th column
Definition at line 304 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), and logger.
|
inline |
Definition at line 298 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::getNumberOfColumns().
|
inline |
Definition at line 287 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::getNumberOfRows().
|
inline |
Get the number of columns.
Definition at line 293 of file SmallMatrix.h.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getNCols().
|
inline |
Get the number of rows.
Definition at line 281 of file SmallMatrix.h.
Referenced by SmallMatrix< numberOfRows, numberOfColumns >::getNRows().
|
inline |
get the i^th row
Definition at line 311 of file SmallMatrix.h.
References constants::i, and logger.
SmallMatrix< numberOfRows, numberOfColumns > SmallMatrix< numberOfRows, numberOfColumns >::inverse | ( | ) | const |
return the inverse in the vector result. The size of result matches the matrix.
Definition at line 305 of file SmallMatrix_impl.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgetrf_(), dgetri_(), and logger.
SmallMatrix< numberOfRows, numberOfColumns > SmallMatrix< numberOfRows, numberOfColumns >::LUfactorisation | ( | ) | const |
Return the LUfactorisation of the matrix.
Definition at line 242 of file SmallMatrix_impl.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), and dgetrf_().
|
inline |
defines the operator(n,m) to access the element on row n and column m
Definition at line 135 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and logger.
|
inline |
defines the operator(n,m) to access the element on row n and column m
Definition at line 144 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and logger.
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.
Definition at line 81 of file SmallMatrix_impl.h.
References SmallVector< numberOfRows >::data(), DEBUG, dgemv_(), logger, SmallVector< numberOfRows >::size(), and WARN.
SmallVector< numberOfRows > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | SmallVector< numberOfColumns > & | right | ) | const |
Definition at line 110 of file SmallMatrix_impl.h.
References SmallVector< numberOfRows >::data(), DEBUG, dgemv_(), logger, SmallVector< numberOfRows >::size(), and WARN.
|
inline |
Does matrix A_ij=scalar*B_ij.
Definition at line 173 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
SmallMatrix< numberOfRows, K > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | const SmallMatrix< numberOfColumns, K > & | other | ) |
Does matrix A_ij = B_ik * C_kj.
Definition at line 141 of file SmallMatrix_impl.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgemm_(), constants::i, logger, and WARN.
SmallMatrix< numberOfRows, K > SmallMatrix< numberOfRows, numberOfColumns >::operator* | ( | const SmallMatrix< numberOfColumns, K > & | other | ) | const |
Definition at line 168 of file SmallMatrix_impl.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgemm_(), constants::i, logger, and WARN.
|
inline |
Does matrix A_ij=scalar*A_ij.
Definition at line 220 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
SmallMatrix< numberOfRows, numberOfColumns > & SmallMatrix< numberOfRows, numberOfColumns >::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.
Definition at line 194 of file SmallMatrix_impl.h.
|
inline |
Definition at line 200 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Definition at line 188 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Definition at line 207 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Definition at line 214 of file SmallMatrix.h.
|
inline |
Definition at line 194 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
this does element by divided by a scalar
Definition at line 240 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Does matrix A_ij=scalar*A_ij.
Definition at line 232 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Assigns one matrix to another.
Definition at line 249 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Assigns one matrix to another.
Definition at line 256 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_.
|
inline |
Access the n linear element in the matrix.
Definition at line 153 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and logger.
|
inline |
Definition at line 160 of file SmallMatrix.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data_, and logger.
|
inline |
Get total number of Matrix entries.
Definition at line 275 of file SmallMatrix.h.
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.
Definition at line 329 of file SmallMatrix_impl.h.
References SmallMatrix< numberOfRows, numberOfColumns >::data(), dgesv_(), and logger.
Referenced by SuperQuadricParticle::computeContactPoint().
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.
Definition at line 343 of file SmallMatrix_impl.h.
References SmallVector< numberOfRows >::data(), SmallMatrix< numberOfRows, numberOfColumns >::data(), dgesv_(), and logger.
|
inline |
Definition at line 330 of file SmallMatrix.h.
References constants::i.
Referenced by SuperQuadricParticle::computeHessianLabFixed(), SuperQuadricParticle::getCurvature(), and Quaternion::rotateTensor().
|
private |
The actually data of the matrix class.
Definition at line 363 of file SmallMatrix.h.
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().