HyperHDG
|
This class implements a small/dense matrix. More...
#include <dense_la.hxx>
Public Types | |
typedef mat_entry_t | value_type |
Define value_type of SmallMat as the typename of its entries! More... | |
Public Member Functions | |
SmallMat () | |
Empty constructor for a SmallMat. More... | |
SmallMat (const mat_entry_t entry_value) | |
Construct SmallMat that contains specified value. More... | |
SmallMat (const std::array< mat_entry_t, size()> &entries) | |
Construct SmallMat from array of entries. More... | |
SmallMat (std::array< mat_entry_t, size()> &&entries) noexcept | |
Move constructor from array. More... | |
SmallMat (const std::vector< mat_entry_t > &entries) | |
Construct SmallMat from std::vector of entries. More... | |
SmallMat (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) | |
Copy constructor. More... | |
template<typename other_entry_t > | |
SmallMat (const SmallMat< n_rowsT, n_colsT, other_entry_t > &other) | |
Conversion between different floating points artithmetics. More... | |
SmallMat (SmallMat< n_rowsT, n_colsT, mat_entry_t > &&other) noexcept | |
Move constructor. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator= (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) |
Copy assignment. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator= (SmallMat< n_rowsT, n_colsT, mat_entry_t > &&other) noexcept |
Move assignment. More... | |
std::array< mat_entry_t, size()> & | data () |
Return data array that allows to manipulate the SmallMat. More... | |
const std::array< mat_entry_t, size()> & | data () const |
Return data array of a constant SmallMat. More... | |
SmallMat< n_rowsT, 1, mat_entry_t > | get_column (const unsigned int col) const |
Return a column of a SmallMat. More... | |
void | set_column (const unsigned int col, const SmallMat< n_rowsT, 1, mat_entry_t > col_vec) |
Set column of a SmallMat. More... | |
mat_entry_t | operator() (const unsigned int row, const unsigned int column) const |
Return single entry of a constant SmallMat. More... | |
mat_entry_t & | operator() (const unsigned int row, const unsigned int column) |
Return reference to single entry of a SmallMat. More... | |
mat_entry_t | operator[] (const unsigned int index) const |
Return single entry of a constant SmallMat. More... | |
mat_entry_t & | operator[] (const unsigned int index) |
Return reference to single entry of a SmallMat. More... | |
bool | operator== (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) const |
Find out whether two SmallMats have (exactly) the same entries. More... | |
bool | operator!= (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) const |
Find out whether two SmallMats do not have (exactly) the same entries. More... | |
bool | operator< (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) const |
Find out whether the SmallMat is "smaller than" another SmallMat. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator+= (const mat_entry_t scalar) |
Add scalar to a given SmallMat. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator-= (const mat_entry_t scalar) |
Subtract scalar from a given SmallMat. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator*= (const mat_entry_t scalar) |
Multiply SmallMat by a given scalar. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator/= (const mat_entry_t scalar) |
Divide given SmallMat by a scalar. More... | |
template<unsigned int n_cols_other> | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator+= (const SmallMat< n_rowsT, n_cols_other, mat_entry_t > &other) |
Add SmallMat to given SmallMat. More... | |
template<unsigned int n_cols_other> | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator-= (const SmallMat< n_rowsT, n_cols_other, mat_entry_t > &other) |
Subtract other SmallMat from SmallMat. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator*= (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) |
Hadamard product with given SmallMat. More... | |
SmallMat< n_rowsT, n_colsT, mat_entry_t > & | operator/= (const SmallMat< n_rowsT, n_colsT, mat_entry_t > &other) |
Hadamard division by given SmallMat. More... | |
Static Public Member Functions | |
static constexpr unsigned int | n_rows () |
Return number of rows of the matrix. More... | |
static constexpr unsigned int | n_cols () |
Return number of columns of the matrix. More... | |
static constexpr unsigned int | size () |
Return size a SmallMat. More... | |
static constexpr std::array< unsigned int, 2 > | dimensions () |
Return dimensions a SmallMat. More... | |
Static Private Member Functions | |
static unsigned int | loc_matrix_index (const unsigned int row, const unsigned int column) |
Translate row and column indices to local index of entry in matrix' array entries_. More... | |
Private Attributes | |
std::array< mat_entry_t, size()> | entries_ |
Array containing the entries of the SmallMat. More... | |
This class implements a small/dense matrix.
n_rowsT | Number of rows of the matrix. |
n_colsT | Number of columns of the matrix. Defaults to create square matrix. |
mat_entry_t | Floating point type specification. Default is double. |
typedef mat_entry_t SmallMat< n_rowsT, n_colsT, mat_entry_t >::value_type |
Define value_type of SmallMat as the typename of its entries!
|
inlinenoexcept |
Move constructor from array.
|
inline |
Copy constructor.
|
inlineexplicit |
Conversion between different floating points artithmetics.
|
inlinenoexcept |
Move constructor.
|
inline |
Return data array that allows to manipulate the SmallMat.
|
inline |
Return data array of a constant SmallMat.
|
inlinestaticconstexpr |
|
inlinestaticprivate |
Translate row and column indices to local index of entry in matrix' array entries_.
Local \( m \times n \) matrices are encoded as arrays of size \(mn\). This function translates a row and a column index into the index of the long array, where the corresponding entry is located. Note that this is done column-wise (not row-wise as usually), to have the correct format for LAPACK.
The function is static inline, since it is used in the constructor's initializer list.
row | Row index of local mtatrix entry. |
column | Column index of local matrix entry. |
index | Overall index of local matrix entry. |
|
inlinestaticconstexpr |
Return number of columns of the matrix.
n_cols | Number of columns of the matrix. |
|
inlinestaticconstexpr |
Return number of rows of the matrix.
n_rows | Number of rows of the matrix. |
|
inline |
Find out whether two SmallMats do not have (exactly) the same entries.
This function compares the SmallMat to another SmallMat and returns false if and only if both SmallMats have exactly (that is not only with respect to some rounding errors) the same entries.
other | Another SmallMat<n_rows,n_cols> that is to be dicriminated from. |
isEqual | A boolean which is false if both SmallMats have the same entries. |
|
inline |
Return reference to single entry of a SmallMat.
row | Row index of the matrix entry to be returned. |
column | Column index of the matrix entry to be returned. |
entry | A reference to a mat_entry_t describing the matrix entry. |
|
inline |
Return single entry of a constant SmallMat.
row | Row index of the matrix entry to be returned. |
column | Column index of the matrix entry to be returned. |
entry | Matrix entry at given position. |
|
inline |
Find out whether the SmallMat is "smaller than" another SmallMat.
This function compares the SmallMat to another SmallMat and returns true if and only if the lowest ranked entry (according to the entry index) where the both SmallMats are not equal of the given SmallMat is smaller than that of the other SmallMat. It is false, if both SmallMats are equal.
other | Another SmallMat<n_rows,n_cols> that is to be dicriminated from. |
smalller | A boolean which is true if \ยข this is strictly smaller than other . |
|
inline |
Copy assignment.
|
inlinenoexcept |
Move assignment.
|
inline |
Find out whether two SmallMats have (exactly) the same entries.
This function compares the SmallMat to another SmallMat and returns true if and only if both SmallMats have exactly (that is not only with respect to some rounding errors) the same entries.
other | Another SmallMat<n_rows,n_cols> that is to be dicriminated from. |
isEqual | A boolean which is true if both SmallMats have the same entries. |
|
inline |
Return reference to single entry of a SmallMat.
index | An unsigned int referring to the entry that is to be returned. |
entry | Reference to mat_entry_t being the entry at given index. |
|
inline |
Return single entry of a constant SmallMat.
index | An unsigned int referring to the entry that is to be returned. |
entry | mat_entry_t being the entry at given index. |
|
inline |
Set column of a SmallMat.
col | An unsigned int referring to the column's index. |
col_vec | The column that should be located at the position col . |
|
inlinestaticconstexpr |
|
private |
Array containing the entries of the SmallMat.