![]() |
Blaze 3.9
|
Expression object for the transposition of a sparse matrix. More...
#include <SMatTransposer.h>
Inherits blaze::SparseMatrix< SMatTransposer< MT, SO >, SO >.
Public Types | |
using | This = SMatTransposer< MT, SO > |
Type of this SMatTransposer instance. | |
using | BaseType = SparseMatrix< This, SO > |
Base type of this SMatTransposer instance. | |
using | ResultType = TransposeType_t< MT > |
Result type for expression template evaluations. | |
using | OppositeType = MT |
Result type with opposite storage order for expression template evaluations. | |
using | TransposeType = ResultType_t< MT > |
Transpose type for expression template evaluations. | |
using | ElementType = ElementType_t< MT > |
Resulting element type. | |
using | ReturnType = ReturnType_t< MT > |
Return type for expression template evaluations. | |
using | CompositeType = const This & |
Data type for composite expression templates. | |
using | Reference = Reference_t< MT > |
Reference to a non-constant matrix value. | |
using | ConstReference = ConstReference_t< MT > |
Reference to a constant matrix value. | |
using | Iterator = Iterator_t< MT > |
Iterator over non-constant elements. | |
using | ConstIterator = ConstIterator_t< MT > |
Iterator over constant elements. | |
using | MatrixType = SMatTransposer< MT, SO > |
Type of the matrix. | |
Public Member Functions | |
SMatTransposer (MT &sm) noexcept | |
Constructor for the SMatTransposer class. More... | |
ConstReference | operator() (size_t i, size_t j) const |
2D-access to the matrix elements. More... | |
ConstReference | at (size_t i, size_t j) const |
Checked access to the matrix elements. More... | |
Iterator | begin (size_t i) |
Returns an iterator to the first non-zero element of row/column i. More... | |
ConstIterator | begin (size_t i) const |
Returns an iterator to the first non-zero element of row/column i. More... | |
ConstIterator | cbegin (size_t i) const |
Returns an iterator to the first non-zero element of row/column i. More... | |
Iterator | end (size_t i) |
Returns an iterator just past the last non-zero element of row/column i. More... | |
ConstIterator | end (size_t i) const |
Returns an iterator just past the last non-zero element of row/column i. More... | |
ConstIterator | cend (size_t i) const |
Returns an iterator just past the last non-zero element of row/column i. More... | |
size_t | rows () const noexcept |
Returns the current number of rows of the matrix. More... | |
size_t | columns () const noexcept |
Returns the current number of columns of the matrix. More... | |
size_t | capacity () const noexcept |
Returns the maximum capacity of the matrix. More... | |
size_t | capacity (size_t i) const noexcept |
Returns the current capacity of the specified row/column. More... | |
size_t | nonZeros () const |
Returns the number of non-zero elements in the matrix. More... | |
size_t | nonZeros (size_t i) const |
Returns the number of non-zero elements in the specified row/column. More... | |
void | reset () |
Resets the matrix elements. More... | |
Iterator | insert (size_t i, size_t j, const ElementType &value) |
Inserting an element into the sparse matrix. More... | |
void | reserve (size_t nonzeros) |
Setting the minimum capacity of the sparse matrix. More... | |
void | reserve (size_t i, size_t nonzeros) |
Setting the minimum capacity of a specific row/column of the sparse matrix. More... | |
void | append (size_t i, size_t j, const ElementType &value, bool check=false) |
Appending an element to the specified row/column of the sparse matrix. More... | |
void | finalize (size_t i) |
Finalizing the element insertion of a row/column. More... | |
bool | isIntact () const noexcept |
Returns whether the invariants of the matrix are intact. More... | |
template<typename Other > | |
bool | canAlias (const Other *alias) const noexcept |
Returns whether the matrix can alias with the given address alias. More... | |
template<typename Other > | |
bool | isAliased (const Other *alias) const noexcept |
Returns whether the matrix is aliased with the given address alias. More... | |
bool | canSMPAssign () const noexcept |
Returns whether the matrix can be used in SMP assignments. More... | |
template<typename MT2 , bool SO2> | |
void | assign (const Matrix< MT2, SO2 > &rhs) |
Implementation of the transpose assignment of a matrix. More... | |
Conversion operators | |
BLAZE_ALWAYS_INLINE constexpr SMatTransposer< MT, SO > & | operator~ () noexcept |
CRTP-based conversion operation for non-constant matrices. More... | |
BLAZE_ALWAYS_INLINE constexpr const SMatTransposer< MT, SO > & | operator~ () const noexcept |
CRTP-based conversion operation for constant matrices. More... | |
constexpr SMatTransposer< MT, SO > & | operator* () noexcept |
CRTP-based conversion operation for non-constant matrices. More... | |
constexpr const SMatTransposer< MT, SO > & | operator* () const noexcept |
CRTP-based conversion operation for constant matrices. More... | |
Static Public Attributes | |
static constexpr bool | smpAssignable = MT::smpAssignable |
Compilation flag for SMP assignments. More... | |
static constexpr bool | storageOrder |
Storage order of the matrix. | |
Private Attributes | |
MT & | sm_ |
The sparse matrix operand. | |
Expression object for the transposition of a sparse matrix.
The SMatTransposer class is a wrapper object for the temporary transposition of a sparse matrix.
|
inlineexplicitnoexcept |
Constructor for the SMatTransposer class.
sm | The sparse matrix operand. |
|
inline |
Appending an element to the specified row/column of the sparse matrix.
i | The row index of the new element. The index has to be in the range ![]() |
j | The column index of the new element. The index has to be in the range ![]() |
value | The value of the element to be appended. |
check | true if the new value should be checked for default values, false if not. |
This function provides a very efficient way to fill a sparse matrix with elements. It appends a new element to the end of the specified row/column without any additional memory allocation. Therefore it is strictly necessary to keep the following preconditions in mind:
Ignoring these preconditions might result in undefined behavior! The optional check parameter specifies whether the new value should be tested for a default value. If the new value is a default value (for instance 0 in case of an integral element type) the value is not appended. Per default the values are not tested.
|
inline |
Implementation of the transpose assignment of a matrix.
rhs | The right-hand side matrix to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Checked access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
std::out_of_range | Invalid matrix access index. |
|
inline |
Returns an iterator to the first non-zero element of row/column i.
i | The row/column index. |
This function returns a row/column iterator to the first non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first non-zero element of column i.
|
inline |
Returns an iterator to the first non-zero element of row/column i.
i | The row/column index. |
This function returns a row/column iterator to the first non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first non-zero element of column i.
|
inlinenoexcept |
Returns whether the matrix can alias with the given address alias.
alias | The alias to be checked. |
|
inlinenoexcept |
Returns whether the matrix can be used in SMP assignments.
|
inlinenoexcept |
Returns the maximum capacity of the matrix.
|
inlinenoexcept |
Returns the current capacity of the specified row/column.
i | The index of the row/column. |
|
inline |
Returns an iterator to the first non-zero element of row/column i.
i | The row/column index. |
This function returns a row/column iterator to the first non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first non-zero element of column i.
|
inline |
Returns an iterator just past the last non-zero element of row/column i.
i | The row/column index. |
This function returns an row/column iterator just past the last non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last non-zero element of column i.
|
inlinenoexcept |
Returns the current number of columns of the matrix.
|
inline |
Returns an iterator just past the last non-zero element of row/column i.
i | The row/column index. |
This function returns an row/column iterator just past the last non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last non-zero element of column i.
|
inline |
Returns an iterator just past the last non-zero element of row/column i.
i | The row/column index. |
This function returns an row/column iterator just past the last non-zero element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last non-zero element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last non-zero element of column i.
|
inline |
Finalizing the element insertion of a row/column.
i | The index of the row/column to be finalized ![]() |
This function is part of the low-level interface to efficiently fill the matrix with elements. After completion of row/column i via the append() function, this function can be called to finalize row/column i and prepare the next row/column for insertion process via append().
|
inline |
Inserting an element into the sparse matrix.
i | The row index of the new element. The index has to be in the range ![]() |
j | The column index of the new element. The index has to be in the range ![]() |
value | The value of the element to be inserted. |
std::invalid_argument | Invalid sparse matrix access index. |
This function insert a new element into the sparse matrix. However, duplicate elements are not allowed. In case the sparse matrix already contains an element with row index i and column index j, a std::invalid_argument exception is thrown.
|
inlinenoexcept |
Returns whether the matrix is aliased with the given address alias.
alias | The alias to be checked. |
|
inlinenoexcept |
Returns whether the invariants of the matrix are intact.
|
inline |
Returns the number of non-zero elements in the matrix.
|
inline |
Returns the number of non-zero elements in the specified row/column.
i | The index of the row/column. |
|
inline |
2D-access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
|
constexprnoexceptinherited |
CRTP-based conversion operation for constant matrices.
This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a constant reference to the actual type MT.
|
constexprnoexceptinherited |
CRTP-based conversion operation for non-constant matrices.
This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a mutable reference to the actual type MT.
|
constexprnoexceptinherited |
CRTP-based conversion operation for constant matrices.
matrix | The matrix to be downcast. |
This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a constant reference to the actual type MT.
|
constexprnoexceptinherited |
CRTP-based conversion operation for non-constant matrices.
matrix | The matrix to be downcast. |
This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a mutable reference to the actual type MT.
|
inline |
Setting the minimum capacity of a specific row/column of the sparse matrix.
i | The row/column index of the new element ![]() ![]() |
nonzeros | The new minimum capacity of the specified row. |
This function increases the capacity of row/column i of the sparse matrix to at least nonzeros elements. The current values of the sparse matrix and all other individual row/column capacities are preserved. In case the storage order is set to rowMajor, the function reserves capacity for row i and the index has to be in the range . In case the storage order is set to columnMajor, the function reserves capacity for column i and the index has to be in the range
.
|
inline |
Setting the minimum capacity of the sparse matrix.
nonzeros | The new minimum capacity of the sparse matrix. |
This function increases the capacity of the sparse matrix to at least nonzeros elements. The current values of the matrix elements and the individual capacities of the matrix rows are preserved.
|
inline |
Resets the matrix elements.
|
inlinenoexcept |
Returns the current number of rows of the matrix.
|
staticconstexpr |
Compilation flag for SMP assignments.
The smpAssignable compilation flag indicates whether the matrix can be used in SMP (shared memory parallel) assignments (both on the left-hand and right-hand side of the assignment).