Blaze  3.6
Public Types | Public Member Functions | Static Public Attributes | List of all members
blaze::SparseMatrixProxy< PT, MT > Class Template Reference

Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a sparse matrix and augments the Proxy interface by the complete interface required of sparse matrices. More...

#include <SparseMatrixProxy.h>

Inherits blaze::SparseMatrix< PT, IsColumnMajorMatrix_v< MT > >.

Public Types

using ResultType = ResultType_t< MT >
 Result type for expression template evaluations.
 
using OppositeType = OppositeType_t< MT >
 Result type with opposite storage order for expression template evaluations.
 
using TransposeType = TransposeType_t< MT >
 Transpose type for expression template evaluations.
 
using ElementType = ElementType_t< MT >
 Type of the sparse matrix elements.
 
using ReturnType = ReturnType_t< MT >
 Return type for expression template evaluations.
 
using CompositeType = CompositeType_t< MT >
 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 = PT
 Type of the matrix.
 

Public Member Functions

BLAZE_ALWAYS_INLINE constexpr MatrixTypeoperator~ () noexcept
 Conversion operator for non-constant matrices. More...
 
BLAZE_ALWAYS_INLINE constexpr const MatrixTypeoperator~ () const noexcept
 Conversion operator for constant matrices. More...
 
Data access functions
Reference operator() (size_t i, size_t j) const
 Function call operator for the direct access to matrix elements. More...
 
Reference at (size_t i, size_t j) const
 Checked access to the matrix elements. More...
 
Iterator begin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
ConstIterator cbegin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
Iterator end (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
ConstIterator cend (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
Utility functions
size_t rows () const
 Returns the current number of rows of the represented matrix. More...
 
size_t columns () const
 Returns the current number of columns of the represented matrix. More...
 
size_t capacity () const
 Returns the maximum capacity of the represented matrix. More...
 
size_t capacity (size_t i) const
 Returns the current capacity of the specified row/column of the represented matrix. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the represented matrix. More...
 
size_t nonZeros (size_t i) const
 Returns the number of non-zero elements in the specified row/column of the represented matrix. More...
 
void reset () const
 Reset to the default initial value. More...
 
void reset (size_t i) const
 Reset the specified row/column to the default initial values. More...
 
void clear () const
 Clearing the represented vector. More...
 
void finalize (size_t i) const
 Finalizing the element insertion of a row/column. More...
 
void resize (size_t m, size_t n, bool preserve=true) const
 Changing the size of the represented matrix. More...
 
void reserve (size_t n) const
 Setting the minimum capacity of the represented matrix. More...
 
void reserve (size_t i, size_t n) const
 Setting the minimum capacity of a specific row/column of the sparse matrix. More...
 
void trim () const
 Removing all excessive capacity from all rows/columns. More...
 
void trim (size_t i) const
 Removing all excessive capacity of a specific row/column of the sparse matrix. More...
 
Insertion functions
Iterator set (size_t i, size_t j, const ElementType &value) const
 Setting an element of the represented sparse matrix. More...
 
Iterator insert (size_t i, size_t j, const ElementType &value) const
 Inserting an element into the represented sparse matrix. More...
 
void append (size_t i, size_t j, const ElementType &value, bool check=false) const
 Appending an element to the specified row/column of the sparse matrix. More...
 
Erase functions
void erase (size_t i, size_t j) const
 Erasing an element from the sparse matrix. More...
 
Iterator erase (size_t i, Iterator pos) const
 Erasing an element from the sparse matrix. More...
 
Iterator erase (size_t i, Iterator first, Iterator last) const
 Erasing a range of elements from the sparse matrix. More...
 
template<typename Pred >
void erase (Pred predicate)
 Erasing specific elements from the sparse matrix. More...
 
template<typename Pred >
void erase (size_t i, Iterator first, Iterator last, Pred predicate)
 Erasing specific elements from a range of the sparse matrix. More...
 
Lookup functions
Iterator find (size_t i, size_t j) const
 Searches for a specific matrix element. More...
 
Iterator 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) const
 Returns an iterator to the first index greater then the given index. More...
 
Numeric functions
void transpose () const
 In-place transpose of the represented matrix. More...
 
void ctranspose () const
 In-place conjugate transpose of the represented matrix. More...
 
template<typename Other >
void scale (const Other &scalar) const
 Scaling of the sparse matrix by the scalar value scalar ( $ A=B*s $). More...
 

Static Public Attributes

static constexpr bool smpAssignable = MT::smpAssignable
 Compilation flag for SMP assignments.
 
static constexpr bool storageOrder
 Storage order of the matrix.
 

Detailed Description

template<typename PT, typename MT>
class blaze::SparseMatrixProxy< PT, MT >

Proxy backend for sparse matrix types.

The SparseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a sparse matrix and augments the Proxy interface by the complete interface required of sparse matrices.

Member Function Documentation

◆ append()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::append ( size_t  i,
size_t  j,
const ElementType value,
bool  check = false 
) const
inline

Appending an element to the specified row/column of the sparse matrix.

Parameters
iThe row index of the new element. The index has to be in the range $[0..M-1]$.
jThe column index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be appended.
checktrue if the new value should be checked for default values, false if not.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

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:

  • the index of the new element must be strictly larger than the largest index of non-zero elements in the specified row/column of the sparse matrix
  • the current number of non-zero elements in the matrix must be smaller than the capacity of the matrix

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.

Note
Although append() does not allocate new memory, it still invalidates all iterators returned by the end() functions!

◆ at()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Reference blaze::SparseMatrixProxy< PT, MT >::at ( size_t  i,
size_t  j 
) const
inline

Checked access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::invalid_argumentInvalid access to restricted element.
std::out_of_rangeInvalid matrix access index.

This function returns a reference to the accessed value at position (i,j). In case the sparse matrix does not yet store an element at position (i,j) , a new element is inserted into the sparse matrix. In contrast to the subscript operator this function always performs a check of the given access indices.

◆ begin()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::begin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.

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.

◆ capacity() [1/2]

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::capacity ( ) const
inline

Returns the maximum capacity of the represented matrix.

Returns
The capacity of the matrix.

◆ capacity() [2/2]

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::capacity ( size_t  i) const
inline

Returns the current capacity of the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The current capacity of row/column i.

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.

◆ cbegin()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::ConstIterator blaze::SparseMatrixProxy< PT, MT >::cbegin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.

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.

◆ cend()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::ConstIterator blaze::SparseMatrixProxy< PT, MT >::cend ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.

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.

◆ clear()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::clear ( ) const
inline

Clearing the represented vector.

Returns
void

This function clears the matrix to its default initial state.

◆ columns()

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::columns ( ) const
inline

Returns the current number of columns of the represented matrix.

Returns
The number of columns of the matrix.

◆ ctranspose()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::ctranspose ( ) const
inline

In-place conjugate transpose of the represented matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::invalid_argumentInvalid access to restricted element.

◆ end()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::end ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.

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.

◆ erase() [1/5]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::erase ( size_t  i,
size_t  j 
) const
inline

Erasing an element from the sparse matrix.

Parameters
iThe row index of the element to be erased. The index has to be in the range $[0..M-1]$.
jThe column index of the element to be erased. The index has to be in the range $[0..N-1]$.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function erases an element from the sparse matrix.

◆ erase() [2/5]

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::erase ( size_t  i,
Iterator  pos 
) const
inline

Erasing an element from the sparse matrix.

Parameters
iThe row/column index of the element to be erased. The index has to be in the range $[0..M-1]$.
posIterator to the element to be erased.
Returns
Iterator to the element after the erased element.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function erases an element from the sparse matrix. 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.

◆ erase() [3/5]

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::erase ( size_t  i,
Iterator  first,
Iterator  last 
) const
inline

Erasing a range of elements from the sparse matrix.

Parameters
iThe row/column index of the element to be erased. The index has to be in the range $[0..M-1]$.
firstIterator to first element to be erased.
lastIterator just past the last element to be erased.
Returns
Iterator to the element after the erased element.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function erases a range of elements from the sparse matrix. In case the storage order is set to rowMajor the function erases a range of elements from row i, in case the storage flag is set to columnMajor the function erases a range of elements from column i.

◆ erase() [4/5]

template<typename PT , typename MT >
template<typename Pred >
void blaze::SparseMatrixProxy< PT, MT >::erase ( Pred  predicate)
inline

Erasing specific elements from the sparse matrix.

Parameters
predicateThe unary predicate for the element selection.
Returns
void.

This function erases specific elements from the sparse matrix. The elements are selected by the given unary predicate predicate, which is expected to accept a single argument of the type of the elements and to be pure.

Note
The predicate is required to be pure, i.e. to produce deterministic results for elements with the same value. The attempt to use an impure predicate leads to undefined behavior!

◆ erase() [5/5]

template<typename PT , typename MT >
template<typename Pred >
void blaze::SparseMatrixProxy< PT, MT >::erase ( size_t  i,
Iterator  first,
Iterator  last,
Pred  predicate 
)
inline

Erasing specific elements from a range of the sparse matrix.

Parameters
iThe row/column index of the elements to be erased. The index has to be in the range $[0..M-1]$.
firstIterator to first element of the range.
lastIterator just past the last element of the range.
predicateThe unary predicate for the element selection.
Returns
void

This function erases specific elements from a range of elements of the sparse matrix. The elements are selected by the given unary predicate predicate, which is expected to accept a single argument of the type of the elements and to be pure. In case the storage order is set to rowMajor the function erases a range of elements from row i, in case the storage flag is set to columnMajor the function erases a range of elements from column i.

Note
The predicate is required to be pure, i.e. to produce deterministic results for elements with the same value. The attempt to use an impure predicate leads to undefined behavior!

◆ finalize()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::finalize ( size_t  i) const
inline

Finalizing the element insertion of a row/column.

Parameters
iThe index of the row/column to be finalized $[0..M-1]$.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function is part of the low-level interface to efficiently fill a 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().

Note
Although finalize() does not allocate new memory, it still invalidates all iterators returned by the end() functions!

◆ find()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::find ( size_t  i,
size_t  j 
) const
inline

Searches for a specific matrix element.

Parameters
iThe row index of the search element. The index has to be in the range $[0..M-1]$.
jThe column index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.

This function can be used to check whether a specific element is contained in the sparse matrix. 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 matrix iterator is subject to invalidation due to inserting operations via the function call operator, the set() function or the insert() function!

◆ insert()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::insert ( size_t  i,
size_t  j,
const ElementType value 
) const
inline

Inserting an element into the represented sparse matrix.

Parameters
iThe row index of the new element. The index has to be in the range $[0..M-1]$.
jThe column index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be inserted.
Returns
Iterator to the newly inserted element.
Exceptions
std::invalid_argumentInvalid access to restricted element.
std::invalid_argumentInvalid sparse matrix access index.

This function inserts 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.

◆ lowerBound()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::lowerBound ( size_t  i,
size_t  j 
) const
inline

Returns an iterator to the first index not less then the given index.

Parameters
iThe row index of the search element. The index has to be in the range $[0..M-1]$.
jThe column index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.

In case of a row-major matrix, 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 matrix, 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 sparse matrix iterator is subject to invalidation due to inserting operations via the function call operator, the set() function or the insert() function!

◆ nonZeros() [1/2]

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the represented matrix.

Returns
The number of non-zero elements in the matrix.

◆ nonZeros() [2/2]

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::nonZeros ( size_t  i) const
inline

Returns the number of non-zero elements in the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The number of non-zero elements of row/column i.

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.

◆ operator()()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Reference blaze::SparseMatrixProxy< PT, MT >::operator() ( size_t  i,
size_t  j 
) const
inline

Function call operator for the direct access to matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function returns a reference to the accessed value at position (i,j). In case the sparse matrix does not yet store an element at position (i,j) , a new element is inserted into the sparse matrix. Note that 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.

◆ operator~() [1/2]

BLAZE_ALWAYS_INLINE constexpr MatrixType& blaze::Matrix< PT , SO >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant matrices.

Returns
Reference of the actual type of the matrix.

◆ operator~() [2/2]

BLAZE_ALWAYS_INLINE constexpr const MatrixType& blaze::Matrix< PT , SO >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant matrices.

Returns
Constant reference of the actual type of the matrix.

◆ reserve() [1/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::reserve ( size_t  n) const
inline

Setting the minimum capacity of the represented matrix.

Parameters
nThe new minimum capacity of the matrix.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

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.

◆ reserve() [2/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::reserve ( size_t  i,
size_t  n 
) const
inline

Setting the minimum capacity of a specific row/column of the sparse matrix.

Parameters
iThe row/column index of the new element $[0..M-1]$ or $[0..N-1]$.
nThe new minimum capacity of the specified row/column.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

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 $[0..M-1]$. 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 $[0..N-1]$.

◆ reset() [1/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::reset ( ) const
inline

Reset to the default initial value.

Returns
void

This function resets all elements of the matrix to the default initial values.

◆ reset() [2/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::reset ( size_t  i) const
inline

Reset the specified row/column to the default initial values.

Parameters
iThe index of the row/column.
Returns
void

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.

◆ resize()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::resize ( size_t  m,
size_t  n,
bool  preserve = true 
) const
inline

Changing the size of the represented matrix.

Parameters
mThe new number of rows of the matrix.
nThe new number of columns of the matrix.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function resizes the matrix using the given size to $ m \times n $. Depending on the type of the matrix, during this operation new dynamic memory may be allocated in case the capacity of the matrix is too small. Note that this function may invalidate all existing views (submatrices, rows, columns, ...) on the matrix if it is used to shrink the matrix. Additionally, the resize operation potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true.

◆ rows()

template<typename PT , typename MT >
size_t blaze::SparseMatrixProxy< PT, MT >::rows ( ) const
inline

Returns the current number of rows of the represented matrix.

Returns
The number of rows of the matrix.

◆ scale()

template<typename PT , typename MT >
template<typename Other >
void blaze::SparseMatrixProxy< PT, MT >::scale ( const Other &  scalar) const
inline

Scaling of the sparse matrix by the scalar value scalar ( $ A=B*s $).

Parameters
scalarThe scalar value for the matrix scaling.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function scales the matrix by applying the given scalar value scalar to each element of the matrix. For built-in and complex data types it has the same effect as using the multiplication assignment operator.

◆ set()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::set ( size_t  i,
size_t  j,
const ElementType value 
) const
inline

Setting an element of the represented sparse matrix.

Parameters
iThe row index of the new element. The index has to be in the range $[0..M-1]$.
jThe column index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be set.
Returns
Iterator to the set element.
Exceptions
std::invalid_argumentInvalid access to restricted element.
std::invalid_argumentInvalid sparse matrix access index.

This function sets the value of an element of the sparse matrix. 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.

◆ transpose()

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::transpose ( ) const
inline

In-place transpose of the represented matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::invalid_argumentInvalid access to restricted element.

◆ trim() [1/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::trim ( ) const
inline

Removing all excessive capacity from all rows/columns.

Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

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.

◆ trim() [2/2]

template<typename PT , typename MT >
void blaze::SparseMatrixProxy< PT, MT >::trim ( size_t  i) const
inline

Removing all excessive capacity of a specific row/column of the sparse matrix.

Parameters
iThe index of the row/column to be trimmed ( $[0..M-1]$ or $[0..N-1]$).
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

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.

◆ upperBound()

template<typename PT , typename MT >
SparseMatrixProxy< PT, MT >::Iterator blaze::SparseMatrixProxy< PT, MT >::upperBound ( size_t  i,
size_t  j 
) const
inline

Returns an iterator to the first index greater then the given index.

Parameters
iThe row index of the search element. The index has to be in the range $[0..M-1]$.
jThe column index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

In case of a row-major matrix, 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 matrix, the function returns a column iterator to the first element with an index greater then the given row index. In combination with the lowerBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned sparse matrix iterator is subject to invalidation due to inserting operations via the function call operator, the set() function or the insert() function!


The documentation for this class was generated from the following files: