![]() |
View on a specific submatrix of a sparse matrix.The SparseSubmatrix template represents a view on a specific submatrix of a sparse matrix primitive. The type of the sparse matrix is specified via the first template parameter: More...
#include <SparseSubmatrix.h>
Inherits blaze::SparseMatrix< SparseSubmatrix< MT, AF, SO >, SO >, and blaze::Submatrix.
Classes | |
class | SubmatrixElement |
Access proxy for a specific element of the sparse submatrix. More... | |
class | SubmatrixIterator |
Iterator over the elements of the sparse submatrix. More... | |
Public Types | |
enum | { smpAssignable = MT::smpAssignable } |
Compilation switch for the expression template assignment strategy. | |
typedef SparseSubmatrix< MT, AF, SO > | This |
Type of this SparseSubmatrix instance. | |
typedef SubmatrixTrait< MT >::Type | ResultType |
Result type for expression template evaluations. | |
typedef ResultType::OppositeType | OppositeType |
Result type with opposite storage order for expression template evaluations. | |
typedef ResultType::TransposeType | TransposeType |
Transpose type for expression template evaluations. | |
typedef MT::ElementType | ElementType |
Type of the submatrix elements. | |
typedef MT::ReturnType | ReturnType |
Return type for expression template evaluations. | |
typedef const SparseSubmatrix & | CompositeType |
Data type for composite expression templates. | |
typedef MT::ConstReference | ConstReference |
Reference to a constant submatrix value. | |
typedef If< IsConst< MT >, ConstReference, typename MT::Reference >::Type | Reference |
Reference to a non-constant submatrix value. | |
typedef SubmatrixIterator< const MT, typename MT::ConstIterator > | ConstIterator |
Iterator over constant elements. | |
typedef If< IsConst< MT >, ConstIterator, SubmatrixIterator< MT, typename MT::Iterator > >::Type | Iterator |
Iterator over non-constant elements. | |
typedef SparseSubmatrix< MT, AF, SO > | MatrixType |
Type of the matrix. | |
Public Member Functions | |
template<typename MT2 , bool SO2> | |
SparseSubmatrix< MT, AF, SO > & | operator= (const Matrix< MT2, SO2 > &rhs) |
Assignment operator for different matrices. More... | |
template<typename MT2 , bool SO2> | |
SparseSubmatrix< MT, AF, SO > & | operator+= (const Matrix< MT2, SO2 > &rhs) |
Addition assignment operator for the addition of a matrix ( ![]() | |
template<typename MT2 , bool SO2> | |
SparseSubmatrix< MT, AF, SO > & | operator-= (const Matrix< MT2, SO2 > &rhs) |
Subtraction assignment operator for the subtraction of a matrix ( ![]() | |
template<typename MT2 , bool SO2> | |
SparseSubmatrix< MT, AF, SO > & | operator*= (const Matrix< MT2, SO2 > &rhs) |
Multiplication assignment operator for the multiplication of a matrix ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other >, SparseSubmatrix< MT, AF, SO > >::Type & | operator*= (Other rhs) |
Multiplication assignment operator for the multiplication between a sparse submatrix and a scalar value ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other >, SparseSubmatrix< MT, AF, SO > >::Type & | operator/= (Other rhs) |
Division assignment operator for the division of a sparse submatrix by a scalar value ( ![]() | |
template<typename Other > | |
SparseSubmatrix< MT, AF, SO > & | scale (const Other &scalar) |
Scaling of the sparse submatrix by the scalar value scalar ( ![]() | |
BLAZE_ALWAYS_INLINE MatrixType & | operator~ () |
Conversion operator for non-constant matrices. More... | |
BLAZE_ALWAYS_INLINE const MatrixType & | operator~ () const |
Conversion operator for constant matrices. More... | |
Constructors | |
SparseSubmatrix (Operand matrix, size_t rindex, size_t cindex, size_t m, size_t n) | |
The constructor for SparseSubmatrix. More... | |
Data access functions | |
Reference | operator() (size_t i, size_t j) |
2D-access to the sparse submatrix elements. More... | |
ConstReference | operator() (size_t i, size_t j) const |
2D-access to the sparse submatrix elements. More... | |
Reference | at (size_t i, size_t j) |
Checked access to the submatrix elements. More... | |
ConstReference | at (size_t i, size_t j) const |
Checked access to the submatrix 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... | |
Assignment operators | |
SparseSubmatrix & | operator= (const SparseSubmatrix &rhs) |
Copy assignment operator for SparseSubmatrix. More... | |
template<typename MT2 , bool SO2> | |
SparseSubmatrix & | operator= (const Matrix< MT2, SO2 > &rhs) |
template<typename MT2 , bool SO2> | |
SparseSubmatrix & | operator+= (const Matrix< MT2, SO2 > &rhs) |
template<typename MT2 , bool SO2> | |
SparseSubmatrix & | operator-= (const Matrix< MT2, SO2 > &rhs) |
template<typename MT2 , bool SO2> | |
SparseSubmatrix & | operator*= (const Matrix< MT2, SO2 > &rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other >, SparseSubmatrix >::Type & | operator*= (Other rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other >, SparseSubmatrix >::Type & | operator/= (Other rhs) |
Lookup functions | |
Iterator | find (size_t i, size_t j) |
Searches for a specific submatrix element. More... | |
ConstIterator | find (size_t i, size_t j) const |
Searches for a specific submatrix element. More... | |
Iterator | lowerBound (size_t i, size_t j) |
Returns an iterator to the first index not less then the given index. More... | |
ConstIterator | lowerBound (size_t i, size_t j) const |
Returns an iterator to the first index not less then the given index. More... | |
Iterator | upperBound (size_t i, size_t j) |
Returns an iterator to the first index greater then the given index. More... | |
ConstIterator | upperBound (size_t i, size_t j) const |
Returns an iterator to the first index greater then the given index. More... | |
Low-level utility functions | |
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 submatrix. More... | |
void | finalize (size_t i) |
Finalizing the element insertion of a row/column. More... | |
Expression template evaluation functions | |
template<typename Other > | |
bool | canAlias (const Other *alias) const |
Returns whether the submatrix can alias with the given address alias. More... | |
template<typename Other > | |
bool | isAliased (const Other *alias) const |
Returns whether the submatrix is aliased with the given address alias. More... | |
bool | canSMPAssign () const |
Returns whether the submatrix can be used in SMP assignments. More... | |
template<typename MT2 , bool SO2> | |
void | assign (const DenseMatrix< MT2, SO2 > &rhs) |
Default implementation of the assignment of a dense matrix. More... | |
template<typename MT2 > | |
void | assign (const SparseMatrix< MT2, false > &rhs) |
Default implementation of the assignment of a row-major sparse matrix. More... | |
template<typename MT2 > | |
void | assign (const SparseMatrix< MT2, true > &rhs) |
Default implementation of the assignment of a column-major sparse matrix. More... | |
template<typename MT2 , bool SO2> | |
void | addAssign (const DenseMatrix< MT2, SO2 > &rhs) |
Default implementation of the addition assignment of a dense matrix. More... | |
template<typename MT2 , bool SO2> | |
void | addAssign (const SparseMatrix< MT2, SO2 > &rhs) |
Default implementation of the addition assignment of a sparse matrix. More... | |
template<typename MT2 , bool SO2> | |
void | subAssign (const DenseMatrix< MT2, SO2 > &rhs) |
Default implementation of the subtraction assignment of a dense matrix. More... | |
template<typename MT2 , bool SO2> | |
void | subAssign (const SparseMatrix< MT2, SO2 > &rhs) |
Default implementation of the subtraction assignment of a sparse matrix. More... | |
Private Types | |
typedef If< IsExpression< MT >, MT, MT & >::Type | Operand |
Composite data type of the dense matrix expression. | |
Private Attributes | |
Member variables | |
Operand | matrix_ |
The sparse matrix containing the submatrix. | |
const size_t | row_ |
The first row of the submatrix. | |
const size_t | column_ |
The first column of the submatrix. | |
const size_t | m_ |
The number of rows of the submatrix. | |
const size_t | n_ |
The number of columns of the submatrix. | |
Utility functions | |
size_t | row () const |
Returns the index of the first row of the submatrix in the underlying sparse matrix. More... | |
size_t | rows () const |
Returns the number of rows of the sparse submatrix. More... | |
size_t | column () const |
Returns the index of the first column of the submatrix in the underlying sparse matrix. More... | |
size_t | columns () const |
Returns the number of columns of the sparse submatrix. More... | |
size_t | capacity () const |
Returns the maximum capacity of the sparse submatrix. More... | |
size_t | capacity (size_t i) const |
Returns the current capacity of the specified row/column. More... | |
size_t | nonZeros () const |
Returns the number of non-zero elements in the sparse submatrix. More... | |
size_t | nonZeros (size_t i) const |
Returns the number of non-zero elements in the specified row/column. More... | |
void | reset () |
Reset to the default initial values. More... | |
void | reset (size_t i) |
Reset the specified row/column to the default initial values. More... | |
Iterator | set (size_t i, size_t j, const ElementType &value) |
Setting an element of the sparse submatrix. More... | |
Iterator | insert (size_t i, size_t j, const ElementType &value) |
Inserting an element into the sparse submatrix. More... | |
void | erase (size_t i, size_t j) |
Erasing an element from the sparse submatrix. More... | |
Iterator | erase (size_t i, Iterator pos) |
Erasing an element from the sparse submatrix. More... | |
Iterator | erase (size_t i, Iterator first, Iterator last) |
Erasing a range of elements from the sparse submatrix. More... | |
void | reserve (size_t nonzeros) |
Setting the minimum capacity of the sparse submatrix. More... | |
void | reserve (size_t i, size_t nonzeros) |
Setting the minimum capacity of a specific row/column of the sparse submatrix. More... | |
void | trim () |
Removing all excessive capacity from all rows/columns. More... | |
void | trim (size_t i) |
Removing all excessive capacity of a specific row/column of the sparse matrix. More... | |
SparseSubmatrix & | transpose () |
In-place transpose of the submatrix. More... | |
SparseSubmatrix & | ctranspose () |
In-place conjugate transpose of the submatrix. More... | |
template<typename Other > | |
SparseSubmatrix & | scale (const Other &scalar) |
bool | hasOverlap () const |
Checking whether there exists an overlap in the context of a symmetric matrix. More... | |
View on a specific submatrix of a sparse matrix.
The SparseSubmatrix template represents a view on a specific submatrix of a sparse matrix primitive. The type of the sparse matrix is specified via the first template parameter:
A view on a sparse submatrix can be created very conveniently via the submatrix()
function:
This view can be treated as any other sparse matrix, i.e. it can be assigned to, it can be copied from, and it can be used in arithmetic operations. The view can also be used on both sides of an assignment: The submatrix can either be used as an alias to grant write access to a specific submatrix of a sparse matrix primitive on the left-hand side of an assignment or to grant read-access to a specific submatrix of a sparse matrix primitive or expression on the right-hand side of an assignment. The following example demonstrates this in detail:
A sparse submatrix can be used like any other sparse matrix. For instance, the elements of the sparse submatrix can be directly accessed with the function call operator:
Alternatively, the elements of a submatrix can be traversed via (const) iterators. Just as with matrices, in case of non-const submatrices, begin()
and end()
return an Iterator, which allows a manipulation of the non-zero values, in case of constant submatrices a ConstIterator is returned:
Inserting/accessing elements in a sparse submatrix can be done by several alternative functions. The following example demonstrates all options:
The current size of the matrix, i.e. the number of rows or columns can be obtained via the rows()
and columns()
functions, the current total capacity via the capacity()
function, and the number of non-zero elements via the nonZeros()
function. However, since submatrices are views on a specific submatrix of a matrix, several operations are not possible on views, such as resizing and swapping:
The following example gives an impression of the use of SparseSubmatrix within arithmetic operations. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of dense and sparse matrices with fitting element types:
Usually submatrices can be defined anywhere within a matrix. They may start at any position and may have an arbitrary extension (only restricted by the extension of the underlying matrix). However, in contrast to matrices themselves, which are always properly aligned in memory and therefore can provide maximum performance, this means that submatrices in general have to be considered to be unaligned. This can be made explicit by the blaze::unaligned flag:
All of these calls to the submatrix()
function are identical. Whether the alignment flag is explicitly specified or not, it always returns an unaligned submatrix. Whereas this may provide full flexibility in the creation of submatrices, this might result in performance restrictions (even in case the specified submatrix could be aligned). However, it is also possible to create aligned submatrices. Aligned submatrices are identical to unaligned submatrices in all aspects, except that they may pose additional alignment restrictions and therefore have less flexibility during creation, but don't suffer from performance penalties and provide the same performance as the underlying matrix. Aligned submatrices are created by explicitly specifying the blaze::aligned flag:
In contrast to dense submatrices, which pose several additional alignment restrictions based on the used element type, sparse submatrices at this time don't pose any additional restrictions. Therefore aligned and unaligned sparse submatrices are truly fully identical. Note however that this is not true for dense submatrices (see the DenseSubmatrix class description)!
It is also possible to create a submatrix view on another submatrix. In this context it is important to remember that the type returned by the submatrix()
function is the same type as the type of the given submatrix, since the view on a submatrix is just another view on the underlying sparse matrix:
Submatrices can also be created on symmetric matrices (see the SymmetricMatrix class template):
It is important to note, however, that (compound) assignments to such submatrices have a special restriction: The symmetry of the underlying symmetric matrix must not be broken! Since the modification of element of a symmetric matrix also modifies the element
, the matrix to be assigned must be structured such that the symmetry of the symmetric matrix is preserved. Otherwise a std::invalid_argument exception is thrown:
|
inlineexplicit |
The constructor for SparseSubmatrix.
matrix | The sparse matrix containing the submatrix. |
rindex | The index of the first row of the submatrix in the given sparse matrix. |
cindex | The index of the first column of the submatrix in the given sparse matrix. |
m | The number of rows of the submatrix. |
n | The number of columns of the submatrix. |
std::invalid_argument | Invalid submatrix specification. |
In case the submatrix is not properly specified (i.e. if the specified submatrix is not contained in the given sparse matrix) a std::invalid_argument exception is thrown.
|
inline |
Default implementation of the addition assignment of a dense matrix.
rhs | The right-hand side dense matrix to be added. |
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 |
Default implementation of the addition assignment of a sparse matrix.
rhs | The right-hand side sparse matrix to be added. |
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 |
Appending an element to the specified row/column of the sparse submatrix.
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 submatrix 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.
In combination with the reserve() and the finalize() function, append() provides the most efficient way to add new elements to a sparse submatrix:
|
inline |
Default implementation of the assignment of a dense matrix.
rhs | The right-hand side dense 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 |
Default implementation of the assignment of a row-major sparse matrix.
rhs | The right-hand side sparse 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 |
Default implementation of the assignment of a column-major sparse matrix.
rhs | The right-hand side sparse 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 submatrix 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. |
In contrast to the subscript operator this function always performs a check of the given access indices.
|
inline |
Checked access to the submatrix 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. |
In contrast to the subscript operator this function always performs a check of the given access indices.
|
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.
|
inline |
Returns whether the submatrix can alias with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address can alias with the submatrix. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.
|
inline |
Returns whether the submatrix can be used in SMP assignments.
This function returns whether the submatrix can be used in SMP assignments. In contrast to the smpAssignable member enumeration, which is based solely on compile time information, this function additionally provides runtime information (as for instance the current number of rows and/or columns of the matrix).
|
inline |
Returns the maximum capacity of the sparse submatrix.
|
inline |
Returns the current capacity of the specified row/column.
i | The index of the row/column. |
This function returns the current capacity of the specified row/column. In case the storage order is set to rowMajor the function returns the capacity of row i, in case the storage flag is set to columnMajor the function returns the capacity 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.
|
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 the index of the first column of the submatrix in the underlying sparse matrix.
|
inline |
Returns the number of columns of the sparse submatrix.
|
inline |
In-place conjugate transpose of the submatrix.
std::logic_error | Invalid transpose of a non-quadratic submatrix. |
std::logic_error | Invalid transpose operation. |
This function transposes the sparse submatrix in-place. Note that this function can only be used for quadratic submatrices, i.e. if the number of rows is equal to the number of columns. Also, the function fails if ...
In all cases, a std::logic_error is thrown.
|
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 |
Erasing an element from the sparse submatrix.
i | The row index of the element to be erased. The index has to be in the range ![]() |
j | The column index of the element to be erased. The index has to be in the range ![]() |
This function erases an element from the sparse submatrix.
|
inline |
Erasing an element from the sparse submatrix.
i | The row/column index of the element to be erased. The index has to be in the range ![]() |
pos | Iterator to the element to be erased. |
This function erases an element from the sparse submatrix. In case the storage order is set to rowMajor the function erases an element from row i, in case the storage flag is set to columnMajor the function erases an element from column i.
|
inline |
Erasing a range of elements from the sparse submatrix.
i | The row/column index of the element to be erased. The index has to be in the range ![]() |
first | Iterator to first element to be erased. |
last | Iterator just past the last element to be erased. |
This function erases a range of element from the sparse submatrix. In case the storage order is set to rowMajor the function erases a range of elements element from row i, in case the storage flag is set to columnMajor the function erases a range of elements from 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 a submatrix 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 |
Searches for a specific submatrix element.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
This function can be used to check whether a specific element is contained in the sparse submatrix. It specifically searches for the element with row index i and column index j. In case the element is found, the function returns an row/column iterator to the element. Otherwise an iterator just past the last non-zero element of row i or column j (the end() iterator) is returned. Note that the returned sparse submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!
|
inline |
Searches for a specific submatrix element.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
This function can be used to check whether a specific element is contained in the sparse submatrix. It specifically searches for the element with row index i and column index j. In case the element is found, the function returns an row/column iterator to the element. Otherwise an iterator just past the last non-zero element of row i or column j (the end() iterator) is returned. Note that the returned sparse submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!
|
inlineprivate |
Checking whether there exists an overlap in the context of a symmetric matrix.
This function checks if in the context of a symmetric matrix the submatrix has an overlap with its counterpart. In case an overlap exists, the function return true, otherwise it returns false.
|
inline |
Inserting an element into the sparse submatrix.
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 submatrix access index. |
This function inserts a new element into the sparse submatrix. However, duplicate elements are not allowed. In case the sparse submatrix already contains an element with row index i and column index j, a std::invalid_argument exception is thrown.
|
inline |
Returns whether the submatrix is aliased with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address is aliased with the submatrix. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.
|
inline |
Returns an iterator to the first index not less then the given index.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
In case of a row-major submatrix, this function returns a row iterator to the first element with an index not less then the given column index. In case of a column-major submatrix, the function returns a column iterator to the first element with an index not less then the given row index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!
|
inline |
Returns an iterator to the first index not less then the given index.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
In case of a row-major submatrix, this function returns a row iterator to the first element with an index not less then the given column index. In case of a column-major submatrix, the function returns a column iterator to the first element with an index not less then the given row index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!
|
inline |
Returns the number of non-zero elements in the sparse submatrix.
|
inline |
Returns the number of non-zero elements in the specified row/column.
i | The index of the row/column. |
This function returns the current number of non-zero elements in the specified row/column. In case the storage order is set to rowMajor the function returns the number of non-zero elements in row i, in case the storage flag is set to columnMajor the function returns the number of non-zero elements in column i.
|
inline |
2D-access to the sparse submatrix 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 ![]() |
This function only performs an index check in case BLAZE_USER_ASSERT() is active. In contrast, the at() function is guaranteed to perform a check of the given access indices.
|
inline |
2D-access to the sparse submatrix 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 ![]() |
This function only performs an index check in case BLAZE_USER_ASSERT() is active. In contrast, the at() function is guaranteed to perform a check of the given access indices.
|
inline |
Multiplication assignment operator for the multiplication of a matrix ( ).
rhs | The right-hand side matrix for the multiplication. |
std::invalid_argument | Matrix sizes do not match. |
std::invalid_argument | Invalid assignment to restricted matrix. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown. Also, if the underlying matrix MT is a lower triangular, upper triangular, or symmetric matrix and the assignment would violate its lower, upper, or symmetry property, respectively, a std::invalid_argument exception is thrown.
|
inline |
Multiplication assignment operator for the multiplication between a sparse submatrix and a scalar value ( ).
rhs | The right-hand side scalar value for the multiplication. |
Via this operator it is possible to scale the sparse submatrix. Note however that the function is subject to three restrictions. First, this operator cannot be used for submatrices on lower or upper unitriangular matrices. The attempt to scale such a submatrix results in a compilation error! Second, this operator can only be used for numeric data types. And third, the elements of the sparse row must support the multiplication assignment operator for the given scalar built-in data type.
|
inline |
Addition assignment operator for the addition of a matrix ( ).
rhs | The right-hand side matrix to be added to the submatrix. |
std::invalid_argument | Matrix sizes do not match. |
std::invalid_argument | Invalid assignment to restricted matrix. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown. Also, if the underlying matrix MT is a lower triangular, upper triangular, or symmetric matrix and the assignment would violate its lower, upper, or symmetry property, respectively, a std::invalid_argument exception is thrown.
|
inline |
Subtraction assignment operator for the subtraction of a matrix ( ).
rhs | The right-hand side matrix to be subtracted from the submatrix. |
std::invalid_argument | Matrix sizes do not match. |
std::invalid_argument | Invalid assignment to restricted matrix. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown. Also, if the underlying matrix MT is a lower triangular, upper triangular, or symmetric matrix and the assignment would violate its lower, upper, or symmetry property, respectively, a std::invalid_argument exception is thrown.
|
inline |
Division assignment operator for the division of a sparse submatrix by a scalar value ( ).
rhs | The right-hand side scalar value for the division. |
Via this operator it is possible to scale the sparse submatrix. Note however that the function is subject to three restrictions. First, this operator cannot be used for submatrices on lower or upper unitriangular matrices. The attempt to scale such a submatrix results in a compilation error! Second, this operator can only be used for numeric data types. And third, the elements of the sparse submatrix must either support the multiplication assignment operator for the given floating point data type or the division assignment operator for the given integral data type.
|
inline |
Copy assignment operator for SparseSubmatrix.
rhs | Sparse submatrix to be copied. |
std::invalid_argument | Submatrix sizes do not match. |
std::invalid_argument | Invalid assignment to restricted matrix. |
The sparse submatrix is initialized as a copy of the given sparse submatrix. In case the current sizes of the two submatrices don't match, a std::invalid_argument exception is thrown. Also, if the underlying matrix MT is a lower triangular, upper triangular, or symmetric matrix and the assignment would violate its lower, upper, or symmetry property, respectively, a std::invalid_argument exception is thrown.
|
inline |
Assignment operator for different matrices.
rhs | Matrix to be assigned. |
std::invalid_argument | Matrix sizes do not match. |
std::invalid_argument | Invalid assignment to restricted matrix. |
The sparse submatrix is initialized as a copy of the given matrix. In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown. Also, if the underlying matrix MT is a lower triangular, upper triangular, or symmetric matrix and the assignment would violate its lower, upper, or symmetry property, respectively, a std::invalid_argument exception is thrown.
|
inlineinherited |
Conversion operator for non-constant matrices.
|
inlineinherited |
Conversion operator for constant matrices.
|
inline |
Setting the minimum capacity of the sparse submatrix.
nonzeros | The new minimum capacity of the sparse submatrix. |
This function increases the capacity of the sparse submatrix to at least nonzeros elements. The current values of the submatrix elements and the individual capacities of the submatrix rows are preserved.
void blaze::SparseSubmatrix< MT, AF, SO >::reserve | ( | size_t | i, |
size_t | nonzeros | ||
) |
Setting the minimum capacity of a specific row/column of the sparse submatrix.
i | The row/column index of the new element ![]() ![]() |
nonzeros | The new minimum capacity of the specified row/column. |
This function increases the capacity of row/column i of the sparse submatrix to at least nonzeros elements, but not beyond the current number of columns/rows, respectively. The current values of the sparse submatrix 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 |
Reset to the default initial values.
|
inline |
Reset the specified row/column to the default initial values.
i | The index of the row/column. |
This function resets the values in the specified row/column to their default value. In case the storage order is set to rowMajor the function resets the values in row i, in case the storage order is set to columnMajor the function resets the values in column i. Note that the capacity of the row/column remains unchanged.
|
inline |
Returns the index of the first row of the submatrix in the underlying sparse matrix.
|
inline |
Returns the number of rows of the sparse submatrix.
|
inline |
Scaling of the sparse submatrix by the scalar value scalar ( ).
scalar | The scalar value for the submatrix scaling. |
This function scales all elements of the submatrix by the given scalar value scalar. Note that the function cannot be used to scale a submatrix on a lower or upper unitriangular matrix. The attempt to scale such a submatrix results in a compile time error!
|
inline |
Setting an element of the sparse submatrix.
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 set. |
This function sets the value of an element of the sparse submatrix. In case the sparse matrix already contains an element with row index i and column index j its value is modified, else a new element with the given value is inserted.
|
inline |
Default implementation of the subtraction assignment of a dense matrix.
rhs | The right-hand side dense matrix to be subtracted. |
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 |
Default implementation of the subtraction assignment of a sparse matrix.
rhs | The right-hand side sparse matrix to be subtracted. |
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 |
In-place transpose of the submatrix.
std::logic_error | Invalid transpose of a non-quadratic submatrix. |
std::logic_error | Invalid transpose operation. |
This function transposes the sparse submatrix in-place. Note that this function can only be used for quadratic submatrices, i.e. if the number of rows is equal to the number of columns. Also, the function fails if ...
In all cases, a std::logic_error is thrown.
|
inline |
Removing all excessive capacity from all rows/columns.
The trim() function can be used to reverse the effect of all row/column-specific reserve() calls. The function removes all excessive capacity from all rows (in case of a rowMajor matrix) or columns (in case of a columnMajor matrix). Note that this function does not remove the overall capacity but only reduces the capacity per row/column.
|
inline |
Removing all excessive capacity of a specific row/column of the sparse matrix.
i | The index of the row/column to be trimmed ( ![]() ![]() |
This function can be used to reverse the effect of a row/column-specific reserve() call. It removes all excessive capacity from the specified row (in case of a rowMajor matrix) or column (in case of a columnMajor matrix). The excessive capacity is assigned to the subsequent row/column.
|
inline |
Returns an iterator to the first index greater then the given index.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
In case of a row-major submatrix, this function returns a row iterator to the first element with an index greater then the given column index. In case of a column-major submatrix, the function returns a column iterator to the first element with an index greater then the given row index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!
|
inline |
Returns an iterator to the first index greater then the given index.
i | The row index of the search element. The index has to be in the range ![]() |
j | The column index of the search element. The index has to be in the range ![]() |
In case of a row-major submatrix, this function returns a row iterator to the first element with an index greater then the given column index. In case of a column-major submatrix, the function returns a column iterator to the first element with an index greater then the given row index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned submatrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!