G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMatrix< T, _Rows, _Cols, _Options > Class Template Reference

Detailed Description

template<class T, int _Rows, int _Cols, int _Options>
class gismo::gsMatrix< T, _Rows, _Cols, _Options >

A matrix with arbitrary coefficient type and fixed or dynamic size.

Forward declaration of gsMatrix class.

This class provides an interface to gsEigen::Matrix from the Eigen linear algebra library. Most operations from Eigen are supported on a gsMatrix.

See therefore also the Eigen documentation for dense matrices, http://eigen.tuxfamily.org/dox/group__QuickRefPage.html

Template Parameters
Tcoefficient type
_Rowsnumber of rows: an integer or Dynamic
_Colsnumber of rows: an integer or Dynamic
_Optionsfurther options; see Eigen documentation
+ Inheritance diagram for gsMatrix< T, _Rows, _Cols, _Options >:

Public Types

typedef memory::shared_ptr< gsMatrixPtr
 Shared pointer for gsMatrix.
 
typedef memory::unique_ptr< gsMatrixuPtr
 Unique pointer for gsMatrix.
 

Public Member Functions

gsAsMatrix< T, 1, Dynamic > asRowVector ()
 
gsAsConstMatrix< T, 1, Dynamic > asRowVector () const
 
gsAsVector< T, Dynamic > asVector ()
 Returns the entries of the matrix resized to a n*m vector column-wise.
 
gsAsConstVector< T, Dynamic > asVector () const
 Returns the entries of the matrix resized to a (const) n*m vector column-wise.
 
T & at (index_t i)
 Returns the i-th element of the vectorization of the matrix.
 
at (index_t i) const
 Returns the i-th element of the vectorization of the matrix.
 
void blockTransposeInPlace (const index_t colBlock)
 Transposes in place the matrix block-wise. The matrix is.
 
BlockView blockView (const gsVector< index_t > &rowSizes, const gsVector< index_t > &colSizes)
 Return a block view of the matrix with rowSizes and colSizes.
 
void cefInPlace ()
 Converts the matrix to a Column Echelon Form (CEF)
 
Col3DType col3d (index_t c)
 Returns column c as a fixed-size 3D vector.
 
void colMinor (index_t j, ColMinorMatrixType &result) const
 
void firstMinor (index_t i, index_t j, FirstMinorMatrixType &result) const
 
template<typename OtherDerived >
 gsMatrix (const gsEigen::EigenBase< OtherDerived > &other)
 This constructor allows constructing a gsMatrix from Eigen expressions.
 
template<typename OtherDerived >
 gsMatrix (const gsEigen::MatrixBase< OtherDerived > &other)
 This constructor allows constructing a gsMatrix from Eigen expressions.
 
template<typename OtherDerived >
 gsMatrix (const gsEigen::ReturnByValue< OtherDerived > &other)
 This constructor allows constructing a gsMatrix from Eigen expressions.
 
std::vector< index_tidxByColumn (const index_t j)
 Returns the vector permutation of the rows of the matrix by column j.
 
template<typename OtherDerived >
gsMatrix khatriRao (const gsEigen::MatrixBase< OtherDerived > &other) const
 Returns the Khatri-Rao product of this with other.
 
template<typename OtherDerived >
gsMatrix kron (const gsEigen::MatrixBase< OtherDerived > &other) const
 Returns the Kronecker product of this with other.
 
void lexSortRows (const std::vector< index_t > &lorder)
 Sorts rows of matrix by columns in vector lorder.
 
uPtr moveToPtr ()
 This function returns a smart pointer to the matrix. After calling it, the matrix object becomes empty, ie the size of the matrix is 0.
 
void rcefInPlace ()
 Converts the matrix to its Reduced Column Echelon Form (RCEF)
 
void refInPlace ()
 Converts the matrix to a Row Echelon Form (REF)
 
void removeCol (index_t i)
 
gsAsMatrix< T, Dynamic, Dynamic > reshape (index_t n, index_t m)
 Returns the matrix resized to n x m matrix (data is not copied) This function assumes that the matrix is size n*m, ie. already allocated.
 
gsAsConstMatrix< T, Dynamic, Dynamic > reshape (index_t n, index_t m) const
 Returns the matrix resized to n x m matrix (data is not copied) This function assumes that the matrix is size n*m, ie. already allocated.
 
gsAsMatrix< T, Dynamic, Dynamic > reshapeCol (index_t c, index_t n, index_t m)
 Returns column c of the matrix resized to n x m matrix This function assumes that the matrix is size n*m, ie. already allocated.
 
gsAsConstMatrix< T, Dynamic, Dynamic > reshapeCol (index_t c, index_t n, index_t m) const
 Returns column c of the matrix resized to n x m matrix This function assumes that the matrix is size n*m, ie. already allocated.
 
void rowMinor (index_t i, RowMinorMatrixType &result) const
 
void rrefInPlace ()
 Converts the matrix to its Reduced Row Echelon Form (RREF)
 
void sortByColumn (const index_t j)
 Sorts rows of matrix by column j.
 
template<class container >
void submatrix (const container &rowInd, const container &colInd, gsMatrix< T > &result) const
 
template<class container >
void submatrixCols (const container &colInd, gsMatrix< T > &result) const
 
template<class container >
void submatrixRows (const container &rowInd, gsMatrix< T > &result) const
 

Member Function Documentation

◆ asRowVector() [1/2]

template<class T , int _Rows, int _Cols, int _Options>
gsAsMatrix< T, 1, Dynamic > asRowVector ( )
inline

Returns the entries of the matrix resized to a 1 x n*m row-vector column-wise

◆ asRowVector() [2/2]

template<class T , int _Rows, int _Cols, int _Options>
gsAsConstMatrix< T, 1, Dynamic > asRowVector ( ) const
inline

Returns the entries of the matrix resized to a (const) 1 x n*m row-vector column-wise

◆ colMinor()

template<class T , int _Rows, int _Cols, int _Options>
void colMinor ( index_t  j,
ColMinorMatrixType result 
) const
inline

Returns the jth column minor, i.e. the matrix after removing column j from the matrix. After the operation the column size of the matrix is one less.

◆ firstMinor()

template<class T , int _Rows, int _Cols, int _Options>
void firstMinor ( index_t  i,
index_t  j,
FirstMinorMatrixType result 
) const
inline

Returns the (i,j)-minor, i.e. the matrix after removing row i and column j from the matrix. After the operation the row and column size of the matrix is one less.

◆ removeCol()

template<class T , int _Rows, int _Cols, int _Options>
void removeCol ( index_t  i)
inline

Removes column i from the matrix. After the operation the column size of the matrix is one less.

◆ rowMinor()

template<class T , int _Rows, int _Cols, int _Options>
void rowMinor ( index_t  i,
RowMinorMatrixType result 
) const
inline

Returns the ith row minor, i.e. the matrix after removing row i from the matrix. After the operation the row size of the matrix is one less.

◆ submatrix()

template<class T , int _Rows, int _Cols, int _Options>
template<class container >
void submatrix ( const container &  rowInd,
const container &  colInd,
gsMatrix< T > &  result 
) const
inline

Returns a submatrix consisting of the rows and columns indexed by the vector containers rowInd and colInd respectively

◆ submatrixCols()

template<class T , int _Rows, int _Cols, int _Options>
template<class container >
void submatrixCols ( const container &  colInd,
gsMatrix< T > &  result 
) const
inline

Returns a submatrix consisting of the columns indexed by the vector container colInd

◆ submatrixRows()

template<class T , int _Rows, int _Cols, int _Options>
template<class container >
void submatrixRows ( const container &  rowInd,
gsMatrix< T > &  result 
) const
inline

Returns a submatrix consisting of the rows indexed by the vector container rowInd