Classes | Public Types | Public Member Functions | Private Types | List of all members
blaze::CompressedMatrix< Type, SO > Class Template Reference

Efficient implementation of a $ M \times N $ compressed matrix.The CompressedMatrix class template is the representation of an arbitrary sized sparse matrix with $ M \cdot N $ dynamically allocated elements of arbitrary type. The type of the elements and the storage order of the matrix can be specified via the two template parameters: More...

#include <CompressedMatrix.h>

Inherits blaze::SparseMatrix< CompressedMatrix< Type, SO >, SO >.

Classes

struct  Rebind
 Rebind mechanism to obtain a CompressedMatrix with different data/element type. More...
 

Public Types

enum  : bool { smpAssignable = !IsSMPAssignable<Type>::value }
 Compilation flag for SMP assignments. More...
 
typedef CompressedMatrix< Type, SO > This
 Type of this CompressedMatrix instance.
 
typedef SparseMatrix< This, SO > BaseType
 Base type of this CompressedMatrix instance.
 
typedef This ResultType
 Result type for expression template evaluations.
 
typedef CompressedMatrix< Type,!SO > OppositeType
 Result type with opposite storage order for expression template evaluations.
 
typedef CompressedMatrix< Type,!SO > TransposeType
 Transpose type for expression template evaluations.
 
typedef Type ElementType
 Type of the sparse matrix elements.
 
typedef const Type & ReturnType
 Return type for expression template evaluations.
 
typedef const ThisCompositeType
 Data type for composite expression templates.
 
typedef MatrixAccessProxy< ThisReference
 Reference to a sparse matrix value.
 
typedef const Type & ConstReference
 Reference to a constant sparse matrix value.
 
typedef Element * Iterator
 Iterator over non-constant elements.
 
typedef const Element * ConstIterator
 Iterator over constant elements.
 
typedef CompressedMatrix< Type, SO > MatrixType
 Type of the matrix.
 

Public Member Functions

template<typename MT , bool SO2>
CompressedMatrix< Type, SO > & operator= (const DenseMatrix< MT, SO2 > &rhs)
 Assignment operator for dense matrices. More...
 
template<typename MT , bool SO2>
CompressedMatrix< Type, SO > & operator= (const SparseMatrix< MT, SO2 > &rhs)
 Assignment operator for different sparse matrices. More...
 
template<typename MT , bool SO2>
CompressedMatrix< Type, SO > & operator+= (const Matrix< MT, SO2 > &rhs)
 Addition assignment operator for the addition of a matrix ( $ A+=B $). More...
 
template<typename MT , bool SO2>
CompressedMatrix< Type, SO > & operator-= (const Matrix< MT, SO2 > &rhs)
 Subtraction assignment operator for the subtraction of a matrix ( $ A-=B $). More...
 
template<typename MT , bool SO2>
CompressedMatrix< Type, SO > & operator*= (const Matrix< MT, SO2 > &rhs)
 Multiplication assignment operator for the multiplication of a matrix ( $ A*=B $). More...
 
template<typename Other >
EnableIf_< IsNumeric< Other >, CompressedMatrix< Type, SO > > & operator*= (Other rhs)
 Multiplication assignment operator for the multiplication between a sparse matrix and a scalar value ( $ A*=s $). More...
 
template<typename Other >
EnableIf_< IsNumeric< Other >, CompressedMatrix< Type, SO > > & operator/= (Other rhs)
 Division assignment operator for the division of a sparse matrix by a scalar value ( $ A/=s $). More...
 
template<typename Other >
CompressedMatrix< Type, SO > & scale (const Other &scalar)
 Scaling of the sparse matrix by the scalar value scalar ( $ A=B*s $). More...
 
template<typename Other >
CompressedMatrix< Type, SO > & scaleDiagonal (Other scalar)
 Scaling the diagonal of the sparse matrix by the scalar value scalar. More...
 
BLAZE_ALWAYS_INLINE MatrixTypeoperator~ () noexcept
 Conversion operator for non-constant matrices. More...
 
BLAZE_ALWAYS_INLINE const MatrixTypeoperator~ () const noexcept
 Conversion operator for constant matrices. More...
 
Constructors
 CompressedMatrix ()
 The default constructor for CompressedMatrix.
 
 CompressedMatrix (size_t m, size_t n)
 Constructor for a matrix of size $ M \times N $. More...
 
 CompressedMatrix (size_t m, size_t n, size_t nonzeros)
 Constructor for a matrix of size $ M \times N $. More...
 
 CompressedMatrix (size_t m, size_t n, const std::vector< size_t > &nonzeros)
 Constructor for a matrix of size $ M \times N $. More...
 
 CompressedMatrix (const CompressedMatrix &sm)
 The copy constructor for CompressedMatrix. More...
 
 CompressedMatrix (CompressedMatrix &&sm) noexcept
 The move constructor for CompressedMatrix. More...
 
template<typename MT , bool SO2>
 CompressedMatrix (const DenseMatrix< MT, SO2 > &dm)
 Conversion constructor from dense matrices. More...
 
template<typename MT , bool SO2>
 CompressedMatrix (const SparseMatrix< MT, SO2 > &sm)
 Conversion constructor from different sparse matrices. More...
 
Destructor
 ~CompressedMatrix ()
 The destructor for CompressedMatrix.
 
Data access functions
Reference operator() (size_t i, size_t j) noexcept
 2D-access to the sparse matrix elements. More...
 
ConstReference operator() (size_t i, size_t j) const noexcept
 2D-access to the sparse matrix elements. More...
 
Reference at (size_t i, size_t j)
 Checked 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) noexcept
 Returns an iterator to the first non-zero element of row/column i. More...
 
ConstIterator begin (size_t i) const noexcept
 Returns an iterator to the first non-zero element of row/column i. More...
 
ConstIterator cbegin (size_t i) const noexcept
 Returns an iterator to the first non-zero element of row/column i. More...
 
Iterator end (size_t i) noexcept
 Returns an iterator just past the last non-zero element of row/column i. More...
 
ConstIterator end (size_t i) const noexcept
 Returns an iterator just past the last non-zero element of row/column i. More...
 
ConstIterator cend (size_t i) const noexcept
 Returns an iterator just past the last non-zero element of row/column i. More...
 
Assignment operators
CompressedMatrixoperator= (const CompressedMatrix &rhs)
 Copy assignment operator for CompressedMatrix. More...
 
CompressedMatrixoperator= (CompressedMatrix &&rhs) noexcept
 Move assignment operator for CompressedMatrix. More...
 
template<typename MT , bool SO2>
CompressedMatrixoperator= (const DenseMatrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CompressedMatrixoperator= (const SparseMatrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CompressedMatrixoperator+= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CompressedMatrixoperator-= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CompressedMatrixoperator*= (const Matrix< MT, SO2 > &rhs)
 
template<typename Other >
EnableIf_< IsNumeric< Other >, CompressedMatrix > & operator*= (Other rhs)
 
template<typename Other >
EnableIf_< IsNumeric< Other >, CompressedMatrix > & operator/= (Other rhs)
 
Lookup functions
Iterator find (size_t i, size_t j)
 Searches for a specific matrix element. More...
 
ConstIterator find (size_t i, size_t j) const
 Searches for a specific matrix 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 Type &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...
 
Expression template evaluation functions
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 MT , bool SO2>
void assign (const DenseMatrix< MT, SO2 > &rhs)
 Default implementation of the assignment of a row-major dense matrix. More...
 
template<typename MT >
void assign (const SparseMatrix< MT, SO > &rhs)
 Default implementation of the assignment of a row-major sparse matrix. More...
 
template<typename MT >
void assign (const SparseMatrix< MT,!SO > &rhs)
 Default implementation of the assignment of a column-major sparse matrix. More...
 
template<typename MT , bool SO2>
void addAssign (const DenseMatrix< MT, SO2 > &rhs)
 Default implementation of the addition assignment of a dense matrix. More...
 
template<typename MT , bool SO2>
void addAssign (const SparseMatrix< MT, SO2 > &rhs)
 Default implementation of the addition assignment of a sparse matrix. More...
 
template<typename MT , bool SO2>
void subAssign (const DenseMatrix< MT, SO2 > &rhs)
 Default implementation of the subtraction assignment of a dense matrix. More...
 
template<typename MT , bool SO2>
void subAssign (const SparseMatrix< MT, SO2 > &rhs)
 Default implementation of the subtraction assignment of a sparse matrix. More...
 

Private Types

typedef ValueIndexPair< Type > ElementBase
 Base class for the sparse matrix element.
 

Utility functions

size_t rows () const noexcept
 Returns the current number of rows of the sparse matrix. More...
 
size_t columns () const noexcept
 Returns the current number of columns of the sparse matrix. More...
 
size_t capacity () const noexcept
 Returns the maximum capacity of the sparse 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 sparse matrix. 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...
 
void clear ()
 Clearing the sparse matrix. More...
 
Iterator set (size_t i, size_t j, const Type &value)
 Setting an element of the compressed matrix. More...
 
Iterator insert (size_t i, size_t j, const Type &value)
 Inserting an element into the compressed matrix. More...
 
void erase (size_t i, size_t j)
 Erasing an element from the sparse matrix. More...
 
Iterator erase (size_t i, Iterator pos)
 Erasing an element from the sparse matrix. More...
 
Iterator erase (size_t i, Iterator first, Iterator last)
 Erasing a range of elements from the sparse matrix. More...
 
void resize (size_t m, size_t n, bool preserve=true)
 Changing the size of 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 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...
 
CompressedMatrixtranspose ()
 In-place transpose of the matrix. More...
 
CompressedMatrixctranspose ()
 In-place conjugate transpose of the matrix. More...
 
template<typename Other >
CompressedMatrixscale (const Other &scalar)
 
template<typename Other >
CompressedMatrixscaleDiagonal (Other scalar)
 
void swap (CompressedMatrix &sm) noexcept
 Swapping the contents of two sparse matrices. More...
 
Iterator insert (Iterator pos, size_t i, size_t j, const Type &value)
 Inserting an element into the compressed matrix. More...
 
size_t extendCapacity () const noexcept
 Calculating a new matrix capacity. More...
 
void reserveElements (size_t nonzeros)
 Reserving the specified number of sparse matrix elements. More...
 

Member variables

size_t m_
 The current number of rows of the sparse matrix.
 
size_t n_
 The current number of columns of the sparse matrix.
 
size_t capacity_
 The current capacity of the pointer array.
 
Iteratorbegin_
 Pointers to the first non-zero element of each row.
 
Iteratorend_
 Pointers one past the last non-zero element of each row.
 
static const Type zero_ = Type()
 Neutral element for accesses to zero elements.
 

Detailed Description

template<typename Type, bool SO = defaultStorageOrder>
class blaze::CompressedMatrix< Type, SO >

Efficient implementation of a $ M \times N $ compressed matrix.

The CompressedMatrix class template is the representation of an arbitrary sized sparse matrix with $ M \cdot N $ dynamically allocated elements of arbitrary type. The type of the elements and the storage order of the matrix can be specified via the two template parameters:

template< typename Type, bool SO >

Inserting/accessing elements in a compressed matrix can be done by several alternative functions. The following example demonstrates all options:

// Creating a row-major 4x3 compressed matrix with 4 rows and 3 columns
CompressedMatrix<double,rowMajor> A( 4, 3 );
// The function call operator provides access to all possible elements of the compressed matrix,
// including the zero elements. In case the function call operator is used to access an element
// that is currently not stored in the sparse matrix, the element is inserted into the matrix.
A(1,2) = 2.0;
// The second operation for inserting elements is the set() function. In case the element
// is not contained in the matrix it is inserted into the matrix, if it is already contained
// in the matrix its value is modified.
A.set( 2, 0, -1.2 );
// An alternative for inserting elements into the matrix is the insert() function. However,
// it inserts the element only in case the element is not already contained in the matrix.
A.insert( 2, 1, 3.7 );
// A very efficient way to add new elements to a sparse matrix is the append() function.
// Note that append() requires that the appended element's index is strictly larger than
// the currently largest non-zero index of the specified row and that the matrix's capacity
// is large enough to hold the new element.
A.reserve( 3, 2 ); // Reserving space for 2 non-zero elements in row 3
A.append( 3, 1, -2.1 ); // Appending the value -2.1 at column index 1 in row 3
A.append( 3, 2, 1.4 ); // Appending the value 1.4 at column index 2 in row 3
// The most efficient way to fill a (newly created) sparse matrix with elements, however, is
// a combination of reserve(), append(), and the finalize() function.
CompressedMatrix<double,rowMajor> B( 4, 3 );
B.reserve( 3 ); // Reserving enough space for 3 non-zero elements
B.append( 0, 1, 1 ); // Appending the value 1 in row 0 with column index 1
B.finalize( 0 ); // Finalizing row 0
B.append( 1, 1, 2 ); // Appending the value 2 in row 1 with column index 1
B.finalize( 1 ); // Finalizing row 1
B.append( 2, 0, 3 ); // Appending the value 3 in row 2 with column index 0
B.finalize( 2 ); // Finalizing row 2
// In order to traverse all non-zero elements currently stored in the matrix, the begin()
// and end() functions can be used. In the example, all non-zero elements of the 2nd row
// of A are traversed.
for( CompressedMatrix<double,rowMajor>::Iterator i=A.begin(1); i!=A.end(1); ++i ) {
... = i->value(); // Access to the value of the non-zero element
... = i->index(); // Access to the index of the non-zero element
}

The use of CompressedMatrix is very natural and intuitive. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combination of row-major and column-major dense and sparse matrices with fitting element types. The following example gives an impression of the use of CompressedMatrix:

CompressedMatrix<double,rowMajor> A( 2, 3 ); // Default constructed, non-initialized, row-major 2x3 matrix
A(0,0) = 1.0; A(0,2) = 3.0; A(1,1) = 5.0; // Element initialization
CompressedMatrix<float,columnMajor> B( 2, 3 ); // Default constructed column-major single precision 2x3 matrix
B(0,1) = 3.0; B(1,0) = 2.0; B(1,2) = 6.0; // Element initialization
DynamicMatrixMatrix<float> C( 2, 3, 4.0F ); // Directly, homogeneously initialized single precision dense 2x3 matrix
CompressedMatrix<float> D( 3, 2 ); // Empty row-major sparse single precision matrix
CompressedMatrix<double,rowMajor> E( A ); // Creation of a new row-major matrix as a copy of A
CompressedMatrix<double,columnMajor> F; // Creation of a default column-major matrix
E = A + B; // Matrix addition and assignment to a row-major matrix
E = A - C; // Matrix subtraction and assignment to a column-major matrix
F = A * D; // Matrix multiplication between two matrices of different element types
A *= 2.0; // In-place scaling of matrix A
E = 2.0 * B; // Scaling of matrix B
F = D * 2.0; // Scaling of matrix D
E += A - B; // Addition assignment
E -= A + C; // Subtraction assignment
F *= A * D; // Multiplication assignment

Member Enumeration Documentation

template<typename Type, bool SO = defaultStorageOrder>
anonymous enum : bool

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).

Constructor & Destructor Documentation

template<typename Type , bool SO>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( size_t  m,
size_t  n 
)
inlineexplicit

Constructor for a matrix of size $ M \times N $.

Parameters
mThe number of rows of the matrix.
nThe number of columns of the matrix.

The matrix is initialized to the zero matrix and has no free capacity.

template<typename Type , bool SO>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( size_t  m,
size_t  n,
size_t  nonzeros 
)
inlineexplicit

Constructor for a matrix of size $ M \times N $.

Parameters
mThe number of rows of the matrix.
nThe number of columns of the matrix.
nonzerosThe number of expected non-zero elements.

The matrix is initialized to the zero matrix.

template<typename Type , bool SO>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( size_t  m,
size_t  n,
const std::vector< size_t > &  nonzeros 
)
explicit

Constructor for a matrix of size $ M \times N $.

Parameters
mThe number of rows of the matrix.
nThe number of columns of the matrix.
nonzerosThe expected number of non-zero elements in each row/column.

The matrix is initialized to the zero matrix and will have the specified capacity in each row/column. Note that in case of a row-major matrix the given vector must have at least m elements, in case of a column-major matrix at least n elements.

template<typename Type , bool SO>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( const CompressedMatrix< Type, SO > &  sm)
inline

The copy constructor for CompressedMatrix.

Parameters
smSparse matrix to be copied.
template<typename Type , bool SO>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( CompressedMatrix< Type, SO > &&  sm)
inlinenoexcept

The move constructor for CompressedMatrix.

Parameters
smThe sparse matrix to be moved into this instance.
template<typename Type , bool SO>
template<typename MT , bool SO2>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( const DenseMatrix< MT, SO2 > &  dm)
inline

Conversion constructor from dense matrices.

Parameters
dmDense matrix to be copied.
template<typename Type , bool SO>
template<typename MT , bool SO2>
blaze::CompressedMatrix< Type, SO >::CompressedMatrix ( const SparseMatrix< MT, SO2 > &  sm)
inline

Conversion constructor from different sparse matrices.

Parameters
smSparse matrix to be copied.

Member Function Documentation

template<typename Type , bool SO>
template<typename MT , bool SO2>
void blaze::CompressedMatrix< Type, SO >::addAssign ( const DenseMatrix< MT, SO2 > &  rhs)
inline

Default implementation of the addition assignment of a dense matrix.

Parameters
rhsThe right-hand side dense matrix to be added.
Returns
void

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.

template<typename Type , bool SO>
template<typename MT , bool SO2>
void blaze::CompressedMatrix< Type, SO >::addAssign ( const SparseMatrix< MT, SO2 > &  rhs)
inline

Default implementation of the addition assignment of a sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be added.
Returns
void

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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::append ( size_t  i,
size_t  j,
const Type &  value,
bool  check = false 
)
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

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.

In combination with the reserve() and the finalize() function, append() provides the most efficient way to add new elements to a (newly created) sparse matrix:

A.reserve( 3 ); // Reserving enough capacity for 3 non-zero elements
A.append( 0, 1, 1.0 ); // Appending the value 1 in row 0 with column index 1
A.finalize( 0 ); // Finalizing row 0
A.append( 1, 1, 2.0 ); // Appending the value 2 in row 1 with column index 1
A.finalize( 1 ); // Finalizing row 1
A.finalize( 2 ); // Finalizing the empty row 2 to prepare row 3
A.append( 3, 0, 3.0 ); // Appending the value 3 in row 3 with column index 0
A.finalize( 3 ); // Finalizing row 3
Note
Although append() does not allocate new memory, it still invalidates all iterators returned by the end() functions!
template<typename Type , bool SO>
template<typename MT , bool SO2>
void blaze::CompressedMatrix< Type, SO >::assign ( const DenseMatrix< MT, SO2 > &  rhs)
inline

Default implementation of the assignment of a row-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be assigned.
Returns
void

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.

template<typename Type , bool SO>
template<typename MT >
void blaze::CompressedMatrix< Type, SO >::assign ( const SparseMatrix< MT, SO > &  rhs)
inline

Default implementation of the assignment of a row-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be assigned.
Returns
void

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.

template<typename Type , bool SO>
template<typename MT >
void blaze::CompressedMatrix< Type, SO >::assign ( const SparseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the assignment of a column-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be assigned.
Returns
void

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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Reference blaze::CompressedMatrix< Type, SO >::at ( size_t  i,
size_t  j 
)
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::out_of_rangeInvalid matrix access index.

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

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstReference blaze::CompressedMatrix< Type, SO >::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::out_of_rangeInvalid matrix access index.

In contrast to the subscript operator this function always performs a check of the given access indices.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::begin ( size_t  i)
inlinenoexcept

Returns an iterator to the first non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator to the first non-zero 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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::begin ( size_t  i) const
inlinenoexcept

Returns an iterator to the first non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator to the first non-zero 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.

template<typename Type , bool SO>
template<typename Other >
bool blaze::CompressedMatrix< Type, SO >::canAlias ( const Other *  alias) const
inlinenoexcept

Returns whether the matrix can alias with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this matrix, false if not.

This function returns whether the given address can alias with the matrix. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.

template<typename Type , bool SO>
bool blaze::CompressedMatrix< Type, SO >::canSMPAssign ( ) const
inlinenoexcept

Returns whether the matrix can be used in SMP assignments.

Returns
true in case the matrix can be used in SMP assignments, false if not.

This function returns whether the matrix 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).

template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::capacity ( ) const
inlinenoexcept

Returns the maximum capacity of the sparse matrix.

Returns
The capacity of the sparse matrix.
template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::capacity ( size_t  i) const
inlinenoexcept

Returns the current capacity of the specified row/column.

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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::cbegin ( size_t  i) const
inlinenoexcept

Returns an iterator to the first non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator to the first non-zero 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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::cend ( size_t  i) const
inlinenoexcept

Returns an iterator just past the last non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator just past the last non-zero 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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::clear ( )
inline

Clearing the sparse matrix.

Returns
void

After the clear() function, the size of the sparse matrix is 0.

template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::columns ( ) const
inlinenoexcept

Returns the current number of columns of the sparse matrix.

Returns
The number of columns of the sparse matrix.
template<typename Type , bool SO>
CompressedMatrix< Type, SO > & blaze::CompressedMatrix< Type, SO >::ctranspose ( )
inline

In-place conjugate transpose of the matrix.

Returns
Reference to the transposed matrix.
template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::end ( size_t  i)
inlinenoexcept

Returns an iterator just past the last non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator just past the last non-zero 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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::end ( size_t  i) const
inlinenoexcept

Returns an iterator just past the last non-zero element of row/column i.

Parameters
iThe row/column index.
Returns
Iterator just past the last non-zero 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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::erase ( size_t  i,
size_t  j 
)
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

This function erases an element from the sparse matrix.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::erase ( size_t  i,
Iterator  pos 
)
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.

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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::erase ( size_t  i,
Iterator  first,
Iterator  last 
)
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.

This function erases a range of element 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.

template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::extendCapacity ( ) const
inlineprivatenoexcept

Calculating a new matrix capacity.

Returns
The new sparse matrix capacity.

This function calculates a new matrix capacity based on the current capacity of the sparse matrix. Note that the new capacity is restricted to the interval $[7..M \cdot N]$.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::finalize ( size_t  i)
inline

Finalizing the element insertion of a row/column.

Parameters
iThe index of the row/column to be finalized $[0..M-1]$.
Returns
void

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!
template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::find ( size_t  i,
size_t  j 
)
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 or the insert() function!

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::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 or the insert() function!

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::insert ( size_t  i,
size_t  j,
const Type &  value 
)
inline

Inserting an element into the compressed 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 compressed matrix access index.

This function inserts a new element into the compressed matrix. However, duplicate elements are not allowed. In case the compressed matrix already contains an element with row index i and column index j, a std::invalid_argument exception is thrown.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::insert ( Iterator  pos,
size_t  i,
size_t  j,
const Type &  value 
)
private

Inserting an element into the compressed matrix.

Parameters
posThe position of the new element.
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 compressed matrix access index.
template<typename Type , bool SO>
template<typename Other >
bool blaze::CompressedMatrix< Type, SO >::isAliased ( const Other *  alias) const
inlinenoexcept

Returns whether the matrix is aliased with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this matrix, false if not.

This function returns whether the given address is aliased with the matrix. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::lowerBound ( size_t  i,
size_t  j 
)
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 compressed matrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::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 compressed matrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!

template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::nonZeros ( ) const
inline

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

Returns
The number of non-zero elements in the sparse matrix.
template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::nonZeros ( size_t  i) const
inline

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

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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Reference blaze::CompressedMatrix< Type, SO >::operator() ( size_t  i,
size_t  j 
)
inlinenoexcept

2D-access to the sparse 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.

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

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstReference blaze::CompressedMatrix< Type, SO >::operator() ( size_t  i,
size_t  j 
) const
inlinenoexcept

2D-access to the sparse 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.

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.

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::operator*= ( const Matrix< MT, SO2 > &  rhs)
inline

Multiplication assignment operator for the multiplication of a matrix ( $ A*=B $).

Parameters
rhsThe right-hand side matrix for the multiplication.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename Type, bool SO = defaultStorageOrder>
template<typename Other >
EnableIf_< IsNumeric<Other>, CompressedMatrix<Type,SO> >& blaze::CompressedMatrix< Type, SO >::operator*= ( Other  rhs)
inline

Multiplication assignment operator for the multiplication between a sparse matrix and a scalar value ( $ A*=s $).

Parameters
rhsThe right-hand side scalar value for the multiplication.
Returns
Reference to the sparse matrix.
template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::operator+= ( const Matrix< MT, SO2 > &  rhs)
inline

Addition assignment operator for the addition of a matrix ( $ A+=B $).

Parameters
rhsThe right-hand side matrix to be added to the matrix.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::operator-= ( const Matrix< MT, SO2 > &  rhs)
inline

Subtraction assignment operator for the subtraction of a matrix ( $ A-=B $).

Parameters
rhsThe right-hand side matrix to be subtracted from the matrix.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

template<typename Type, bool SO = defaultStorageOrder>
template<typename Other >
EnableIf_< IsNumeric<Other>, CompressedMatrix<Type,SO> >& blaze::CompressedMatrix< Type, SO >::operator/= ( Other  rhs)
inline

Division assignment operator for the division of a sparse matrix by a scalar value ( $ A/=s $).

Parameters
rhsThe right-hand side scalar value for the division.
Returns
Reference to the matrix.
template<typename Type , bool SO>
CompressedMatrix< Type, SO > & blaze::CompressedMatrix< Type, SO >::operator= ( const CompressedMatrix< Type, SO > &  rhs)
inline

Copy assignment operator for CompressedMatrix.

Parameters
rhsSparse matrix to be copied.
Returns
Reference to the assigned sparse matrix.

The sparse matrix is resized according to the given sparse matrix and initialized as a copy of this matrix.

template<typename Type , bool SO>
CompressedMatrix< Type, SO > & blaze::CompressedMatrix< Type, SO >::operator= ( CompressedMatrix< Type, SO > &&  rhs)
inlinenoexcept

Move assignment operator for CompressedMatrix.

Parameters
rhsThe sparse matrix to be moved into this instance.
Returns
Reference to the assigned sparse matrix.
template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::operator= ( const DenseMatrix< MT, SO2 > &  rhs)
inline

Assignment operator for dense matrices.

Parameters
rhsDense matrix to be copied.
Returns
Reference to the assigned matrix.

The matrix is resized according to the given $ M \times N $ matrix and initialized as a copy of this matrix.

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::operator= ( const SparseMatrix< MT, SO2 > &  rhs)
inline

Assignment operator for different sparse matrices.

Parameters
rhsSparse matrix to be copied.
Returns
Reference to the assigned matrix.

The matrix is resized according to the given $ M \times N $ matrix and initialized as a copy of this matrix.

BLAZE_ALWAYS_INLINE MatrixType& blaze::Matrix< CompressedMatrix< Type, SO > , SO >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant matrices.

Returns
Reference of the actual type of the matrix.
BLAZE_ALWAYS_INLINE const MatrixType& blaze::Matrix< CompressedMatrix< Type, SO > , SO >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant matrices.

Returns
Constant reference of the actual type of the matrix.
template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::reserve ( size_t  nonzeros)
inline

Setting the minimum capacity of the sparse matrix.

Parameters
nonzerosThe new minimum capacity of the sparse matrix.
Returns
void

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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::reserve ( size_t  i,
size_t  nonzeros 
)

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

Parameters
iThe row/column index $[0..M-1]$ or $[0..N-1]$.
nonzerosThe new minimum capacity of the specified row/column.
Returns
void

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]$.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::reserveElements ( size_t  nonzeros)
private

Reserving the specified number of sparse matrix elements.

Parameters
nonzerosThe number of matrix elements to be reserved.
Returns
void
template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::reset ( )
inline

Reset to the default initial values.

Returns
void
template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::reset ( size_t  i)
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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::resize ( size_t  m,
size_t  n,
bool  preserve = true 
)

Changing the size of the sparse matrix.

Parameters
mThe new number of rows of the sparse matrix.
nThe new number of columns of the sparse matrix.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void

This function resizes the matrix using the given size to $ m \times n $. 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.

template<typename Type , bool SO>
size_t blaze::CompressedMatrix< Type, SO >::rows ( ) const
inlinenoexcept

Returns the current number of rows of the sparse matrix.

Returns
The number of rows of the sparse matrix.
template<typename Type, bool SO = defaultStorageOrder>
template<typename Other >
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::scale ( const Other &  scalar)
inline

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

Parameters
scalarThe scalar value for the matrix scaling.
Returns
Reference to the sparse matrix.
template<typename Type, bool SO = defaultStorageOrder>
template<typename Other >
CompressedMatrix<Type,SO>& blaze::CompressedMatrix< Type, SO >::scaleDiagonal ( Other  scalar)
inline

Scaling the diagonal of the sparse matrix by the scalar value scalar.

Parameters
scalarThe scalar value for the diagonal scaling.
Returns
Reference to the sparse matrix.
template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::set ( size_t  i,
size_t  j,
const Type &  value 
)
inline

Setting an element of the compressed 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.

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

template<typename Type , bool SO>
template<typename MT , bool SO2>
void blaze::CompressedMatrix< Type, SO >::subAssign ( const DenseMatrix< MT, SO2 > &  rhs)
inline

Default implementation of the subtraction assignment of a dense matrix.

Parameters
rhsThe right-hand side dense matrix to be subtracted.
Returns
void

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.

template<typename Type , bool SO>
template<typename MT , bool SO2>
void blaze::CompressedMatrix< Type, SO >::subAssign ( const SparseMatrix< MT, SO2 > &  rhs)
inline

Default implementation of the subtraction assignment of a sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be subtracted.
Returns
void

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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::swap ( CompressedMatrix< Type, SO > &  sm)
inlinenoexcept

Swapping the contents of two sparse matrices.

Parameters
smThe sparse matrix to be swapped.
Returns
void
template<typename Type , bool SO>
CompressedMatrix< Type, SO > & blaze::CompressedMatrix< Type, SO >::transpose ( )
inline

In-place transpose of the matrix.

Returns
Reference to the transposed matrix.
template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::trim ( )
inline

Removing all excessive capacity from all rows/columns.

Returns
void

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.

template<typename Type , bool SO>
void blaze::CompressedMatrix< Type, SO >::trim ( size_t  i)
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

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.

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::Iterator blaze::CompressedMatrix< Type, SO >::upperBound ( size_t  i,
size_t  j 
)
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 upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed matrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!

template<typename Type , bool SO>
CompressedMatrix< Type, SO >::ConstIterator blaze::CompressedMatrix< Type, SO >::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 upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed matrix iterator is subject to invalidation due to inserting operations via the function call operator or the insert() function!


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