Modules | Classes | Functions
Sparse Matrices

Modules

 Expressions
 
 CompressedMatrix
 

Classes

struct  blaze::SparseMatrix< MT, SO >
 Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes. It provides an abstraction from the actual type of the sparse matrix, but enables a conversion back to this type via the Matrix base class. More...
 
class  blaze::MatrixAccessProxy< MT >
 Access proxy for sparse, $ M \times N $ matrices.The MatrixAccessProxy provides safe access to the elements of a non-const sparse matrices.
The proxied access to the elements of a sparse matrix is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedMatrix class: More...
 

Functions

template<typename T1 , typename T2 >
const DVecTSVecMultExpr< T1, T2 > blaze::operator* (const DenseVector< T1, false > &lhs, const SparseVector< T2, true > &rhs)
 Multiplication operator for the dense vector-sparse vector outer product ( $ A=\vec{b}*\vec{c}^T $). More...
 
template<typename MT , bool SO>
const SMatAbsExpr< MT, SO > blaze::abs (const SparseMatrix< MT, SO > &sm)
 Returns a matrix containing the absolute values of each single element of sm. More...
 
template<typename MT , bool SO>
const SMatConjExpr< MT, SO > blaze::conj (const SparseMatrix< MT, SO > &sm)
 Returns a matrix containing the complex conjugate of each single element of sm. More...
 
template<typename MT , bool SO>
const CTransExprTrait< MT >::Type blaze::ctrans (const SparseMatrix< MT, SO > &sm)
 Returns the conjugate transpose matrix of sm. More...
 
template<typename MT , bool SO>
const SMatEvalExpr< MT, SO > blaze::eval (const SparseMatrix< MT, SO > &sm)
 Forces the evaluation of the given sparse matrix expression sm. More...
 
template<typename MT , bool SO>
const ImagExprTrait< MT >::Type blaze::imag (const SparseMatrix< MT, SO > &sm)
 Returns a matrix containing the imaginary parts of each single element of sm. More...
 
template<typename MT , bool SO>
const RealExprTrait< MT >::Type blaze::real (const SparseMatrix< MT, SO > &sm)
 Returns a matrix containing the real parts of each single element of sm. More...
 
template<typename T1 , bool SO, typename T2 >
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type blaze::operator/ (const SparseMatrix< T1, SO > &mat, T2 scalar)
 Division operator for the division of a sparse matrix by a scalar value ( $ A=B/s $). More...
 
template<typename MT , bool SO>
const SMatScalarMultExpr< MT, typename UnderlyingBuiltin< MT >::Type, SO > blaze::operator- (const SparseMatrix< MT, SO > &sm)
 Unary minus operator for the negation of a sparse matrix ( $ A = -B $). More...
 
template<typename T1 , bool SO, typename T2 >
const EnableIf< IsNumeric< T2 >, typename MultExprTrait< T1, T2 >::Type >::Type blaze::operator* (const SparseMatrix< T1, SO > &mat, T2 scalar)
 Multiplication operator for the multiplication of a sparse matrix and a scalar value ( $ A=B*s $). More...
 
template<typename T1 , typename T2 , bool SO>
const EnableIf< IsNumeric< T1 >, typename MultExprTrait< T1, T2 >::Type >::Type blaze::operator* (T1 scalar, const SparseMatrix< T2, SO > &mat)
 Multiplication operator for the multiplication of a scalar value and a sparse matrix ( $ A=s*B $). More...
 
template<typename MT , bool SO>
const SMatSerialExpr< MT, SO > blaze::serial (const SparseMatrix< MT, SO > &sm)
 Forces the serial evaluation of the given sparse matrix expression sm. More...
 
template<typename T1 , typename T2 >
const SMatSMatAddExpr< T1, T2 > blaze::operator+ (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, false > &rhs)
 Addition operator for the addition of two row-major sparse matrices ( $ A=B+C $). More...
 
template<typename T1 , typename T2 >
const SMatSMatMultExpr< T1, T2 > blaze::operator* (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, false > &rhs)
 Multiplication operator for the multiplication of two row-major sparse matrices ( $ A=B*C $). More...
 
template<typename T1 , typename T2 >
const SMatSMatSubExpr< T1, T2 > blaze::operator- (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, false > &rhs)
 Subtraction operator for the subtraction of two row-major sparse matrices ( $ A=B-C $). More...
 
template<typename MT , bool SO>
const SMatTransExpr< MT,!SO > blaze::trans (const SparseMatrix< MT, SO > &sm)
 Calculation of the transpose of the given sparse matrix. More...
 
template<typename T1 , typename T2 >
const SMatTSMatAddExpr< T1, T2 > blaze::operator+ (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, true > &rhs)
 Addition operator for the addition of a row-major and a column-major sparse matrix ( $ A=B+C $). More...
 
template<typename T1 , typename T2 >
const SMatTSMatAddExpr< T2, T1 > blaze::operator+ (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, false > &rhs)
 Addition operator for the addition of a column-major and a row-major sparse matrix ( $ A=B+C $). More...
 
template<typename T1 , typename T2 >
const SMatTSMatMultExpr< T1, T2 > blaze::operator* (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, true > &rhs)
 Multiplication operator for the multiplication of a row-major sparse matrix and a column-major sparse matrix ( $ A=B*C $). More...
 
template<typename T1 , typename T2 >
const SMatTSMatSubExpr< T1, T2 > blaze::operator- (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, true > &rhs)
 Subtraction operator for the subtraction of a row-major and a column-major sparse matrix ( $ A=B-C $). More...
 
template<typename T1 , typename T2 >
const SVecTDVecMultExpr< T1, T2 > blaze::operator* (const SparseVector< T1, false > &lhs, const DenseVector< T2, true > &rhs)
 Multiplication operator for the sparse vector-dense vector outer product ( $ A=\vec{b}*\vec{c}^T $). More...
 
template<typename T1 , typename T2 >
const SVecTSVecMultExpr< T1, T2 > blaze::operator* (const SparseVector< T1, false > &lhs, const SparseVector< T2, true > &rhs)
 Multiplication operator for the sparse vector-sparse vector outer product ( $ A=\vec{b}*\vec{c}^T $). More...
 
template<typename T1 , typename T2 >
const DisableIf< IsMatMatMultExpr< T2 >, TDVecTSMatMultExpr< T1, T2 > >::Type blaze::operator* (const DenseVector< T1, true > &vec, const SparseMatrix< T2, true > &mat)
 Multiplication operator for the multiplication of a transpose dense vector and a column-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $). More...
 
template<typename T1 , typename T2 >
const TSMatSMatMultExpr< T1, T2 > blaze::operator* (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, false > &rhs)
 Multiplication operator for the multiplication of a column-major sparse matrix and a row-major sparse matrix ( $ A=B*C $). More...
 
template<typename T1 , typename T2 >
const TSMatSMatSubExpr< T1, T2 > blaze::operator- (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, false > &rhs)
 Subtraction operator for the subtraction of a column-major and a row-major sparse matrix ( $ A=B-C $). More...
 
template<typename T1 , typename T2 >
const TSMatTSMatAddExpr< T1, T2 > blaze::operator+ (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, true > &rhs)
 Addition operator for the addition of two column-major sparse matrices ( $ A=B+C $). More...
 
template<typename T1 , typename T2 >
const TSMatTSMatMultExpr< T1, T2 > blaze::operator* (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, true > &rhs)
 Multiplication operator for the multiplication of two column-major sparse matrices ( $ A=B*C $). More...
 
template<typename T1 , typename T2 >
const TSMatTSMatSubExpr< T1, T2 > blaze::operator- (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, true > &rhs)
 Subtraction operator for the subtraction of two column-major sparse matrices ( $ A=B-C $). More...
 
template<typename T1 , typename T2 >
bool blaze::operator== (const SparseMatrix< T1, false > &lhs, const SparseMatrix< T2, false > &rhs)
 Equality operator for the comparison of two row-major sparse matrices. More...
 
template<typename T1 , typename T2 >
bool blaze::operator== (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, true > &rhs)
 Equality operator for the comparison of two column-major sparse matrices. More...
 

MatrixAccessProxy global functions

template<typename MT >
ConjExprTrait< typename MatrixAccessProxy< MT >::RepresentedType >::Type blaze::conj (const MatrixAccessProxy< MT > &proxy)
 Computing the complex conjugate of the represented element. More...
 
template<typename MT >
void blaze::reset (const MatrixAccessProxy< MT > &proxy)
 Resetting the represented element to the default initial values. More...
 
template<typename MT >
void blaze::clear (const MatrixAccessProxy< MT > &proxy)
 Clearing the represented element. More...
 
template<typename MT >
bool blaze::isDefault (const MatrixAccessProxy< MT > &proxy)
 Returns whether the represented element is in default state. More...
 
template<typename MT >
bool blaze::isReal (const MatrixAccessProxy< MT > &proxy)
 Returns whether the matrix element represents a real number. More...
 
template<typename MT >
bool blaze::isZero (const MatrixAccessProxy< MT > &proxy)
 Returns whether the represented element is 0. More...
 
template<typename MT >
bool blaze::isOne (const MatrixAccessProxy< MT > &proxy)
 Returns whether the represented element is 1. More...
 
template<typename MT >
bool blaze::isnan (const MatrixAccessProxy< MT > &proxy)
 Returns whether the represented element is not a number. More...
 
template<typename MT >
void blaze::swap (const MatrixAccessProxy< MT > &a, const MatrixAccessProxy< MT > &b)
 Swapping the contents of two access proxies. More...
 
template<typename MT , typename T >
void blaze::swap (const MatrixAccessProxy< MT > &a, T &b)
 Swapping the contents of an access proxy with another element. More...
 
template<typename T , typename MT >
void blaze::swap (T &a, const MatrixAccessProxy< MT > &b)
 Swapping the contents of an access proxy with another element. More...
 

SparseMatrix operators

template<typename T1 , typename T2 , bool SO>
bool blaze::operator== (const SparseMatrix< T1, SO > &lhs, const SparseMatrix< T2,!SO > &rhs)
 Equality operator for the comparison of two sparse matrices with different storage order. More...
 
template<typename T1 , bool SO1, typename T2 , bool SO2>
bool blaze::operator!= (const SparseMatrix< T1, SO1 > &lhs, const SparseMatrix< T2, SO2 > &rhs)
 Inequality operator for the comparison of two sparse matrices. More...
 
template<typename T1 , typename T2 , bool SO>
bool blaze::operator== (const SparseMatrix< T1, true > &lhs, const SparseMatrix< T2, true > &rhs)
 Equality operator for the comparison of two column-major sparse matrices. More...
 

SparseMatrix functions

template<typename MT , bool SO>
bool blaze::isnan (const SparseMatrix< MT, SO > &sm)
 Checks the given sparse matrix for not-a-number elements. More...
 
template<typename MT , bool SO>
bool blaze::isSymmetric (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is symmetric. More...
 
template<typename MT , bool SO>
bool blaze::isHermitian (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is Hermitian. More...
 
template<typename MT , bool SO>
bool blaze::isUniform (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is a uniform matrix. More...
 
template<typename MT , bool SO>
bool blaze::isLower (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is a lower triangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isUniLower (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is a lower unitriangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isStrictlyLower (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is a strictly lower triangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isUpper (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is an upper triangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isUniUpper (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is an upper unitriangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isStrictlyUpper (const SparseMatrix< MT, SO > &sm)
 Checks if the given sparse matrix is a strictly upper triangular matrix. More...
 
template<typename MT , bool SO>
bool blaze::isDiagonal (const SparseMatrix< MT, SO > &sm)
 Checks if the give sparse matrix is diagonal. More...
 
template<typename MT , bool SO>
bool blaze::isIdentity (const SparseMatrix< MT, SO > &sm)
 Checks if the give sparse matrix is an identity matrix. More...
 
template<typename MT , bool SO>
const MT::ElementType blaze::min (const SparseMatrix< MT, SO > &sm)
 Returns the smallest element of the sparse matrix. More...
 
template<typename MT , bool SO>
const MT::ElementType blaze::max (const SparseMatrix< MT, SO > &sm)
 Returns the largest element of the sparse matrix. More...
 

Detailed Description

Function Documentation

template<typename MT , bool SO>
const SMatAbsExpr<MT,SO> blaze::abs ( const SparseMatrix< MT, SO > &  sm)
inline

Returns a matrix containing the absolute values of each single element of sm.

Parameters
smThe input matrix.
Returns
The absolute value of each single element of sm.

The abs function calculates the absolute value of each element of the input matrix sm. The function returns an expression representing this operation.
The following example demonstrates the use of the abs function:

// ... Resizing and initialization
B = abs( A );
template<typename MT >
void blaze::clear ( const MatrixAccessProxy< MT > &  proxy)
inline

Clearing the represented element.

Parameters
proxyThe given access proxy.
Returns
void

This function clears the element represented by the access proxy to its default initial state. In case the access proxy represents a vector- or matrix-like data structure that provides a clear() function, this function clears the vector/matrix to its default initial state.

template<typename MT >
ConjExprTrait< typename MatrixAccessProxy< MT >::RepresentedType >::Type blaze::conj ( const MatrixAccessProxy< MT > &  proxy)
inline

Computing the complex conjugate of the represented element.

Parameters
proxyThe given proxy instance.
Returns
The complex conjugate of the represented element.

This function computes the complex conjugate of the element represented by the access proxy. In case the proxy represents a vector- or matrix-like data structure the function returns an expression representing the complex conjugate of the vector/matrix.

template<typename MT , bool SO>
const SMatConjExpr<MT,SO> blaze::conj ( const SparseMatrix< MT, SO > &  sm)
inline

Returns a matrix containing the complex conjugate of each single element of sm.

Parameters
smThe input matrix.
Returns
The complex conjugate of each single element of sm.

The conj function calculates the complex conjugate of each element of the input matrix sm. The function returns an expression representing this operation.
The following example demonstrates the use of the conj function:

// ... Resizing and initialization
B = conj( A );
template<typename MT , bool SO>
const CTransExprTrait<MT>::Type blaze::ctrans ( const SparseMatrix< MT, SO > &  sm)
inline

Returns the conjugate transpose matrix of sm.

Parameters
smThe input matrix.
Returns
The conjugate transpose of sm.

The ctrans function returns an expression representing the conjugate transpose (also called adjoint matrix, Hermitian conjugate matrix or transjugate matrix) of the given input matrix sm.
The following example demonstrates the use of the ctrans function:

// ... Resizing and initialization
B = ctrans( A );

Note that the ctrans function has the same effect as manually applying the conj and trans function in any order:

B = trans( conj( A ) ); // Computing the conjugate transpose matrix
B = conj( trans( A ) ); // Computing the conjugate transpose matrix
template<typename MT , bool SO>
const SMatEvalExpr<MT,SO> blaze::eval ( const SparseMatrix< MT, SO > &  sm)
inline

Forces the evaluation of the given sparse matrix expression sm.

Parameters
smThe input matrix.
Returns
The evaluated sparse matrix.

The eval function forces the evaluation of the given sparse matrix expression sm. The function returns an expression representing the operation.
The following example demonstrates the use of the eval function

// ... Resizing and initialization
B = eval( A );
template<typename MT , bool SO>
const ImagExprTrait<MT>::Type blaze::imag ( const SparseMatrix< MT, SO > &  sm)
inline

Returns a matrix containing the imaginary parts of each single element of sm.

Parameters
smThe input matrix.
Returns
The imaginary part of each single element of sm.

The imag function calculates the imaginary part of each element of the input matrix sm. The function returns an expression representing this operation.
The following example demonstrates the use of the imag function:

// ... Resizing and initialization
B = imag( A );
template<typename MT >
bool blaze::isDefault ( const MatrixAccessProxy< MT > &  proxy)
inline

Returns whether the represented element is in default state.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is in default state, false otherwise.

This function checks whether the element represented by the access proxy is in default state. In case it is in default state, the function returns true, otherwise it returns false.

template<typename MT , bool SO>
bool blaze::isDiagonal ( const SparseMatrix< MT, SO > &  sm)

Checks if the give sparse matrix is diagonal.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is diagonal, false if not.

This function tests whether the matrix is diagonal, i.e. if the non-diagonal elements are default elements. In case of integral or floating point data types, a diagonal matrix has the form

\[\left(\begin{array}{*{5}{c}} aa & 0 & 0 & \cdots & 0 \\ 0 & bb & 0 & \cdots & 0 \\ 0 & 0 & cc & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & 0 \\ 0 & 0 & 0 & 0 & xx \\ \end{array}\right)\]

The following example demonstrates the use of the function:

// ... Initialization
if( isDiagonal( A ) ) { ... }

It is also possible to check if a matrix expression results in a diagonal matrix:

if( isDiagonal( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isHermitian ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is Hermitian.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is Hermitian, false if not.

This function checks if the given sparse matrix is an Hermitian matrix. The matrix is considered to be an Hermitian matrix if it is a square matrix whose conjugate transpose is equal to itself ( $ A = \overline{A^T} $), i.e. each matrix element $ a_{ij} $ is equal to the complex conjugate of the element $ a_{ji} $. The following code example demonstrates the use of the function:

// ... Initialization
if( isHermitian( A ) ) { ... }

It is also possible to check if a matrix expression results in an Hermitian matrix:

if( isHermitian( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isIdentity ( const SparseMatrix< MT, SO > &  sm)

Checks if the give sparse matrix is an identity matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is an identity matrix, false if not.

This function tests whether the matrix is an identity matrix, i.e. if the diagonal elements are 1 and the non-diagonal elements are 0. In case of integral or floating point data types, an identity matrix has the form

\[\left(\begin{array}{*{5}{c}} 1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & 0 \\ 0 & 0 & 0 & 0 & 1 \\ \end{array}\right)\]

The following example demonstrates the use of the function:

// ... Initialization
if( isIdentity( A ) ) { ... }

It is also possible to check if a matrix expression results in an identity matrix:

if( isIdentity( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isLower ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is a lower triangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is a lower triangular matrix, false if not.

This function checks if the given sparse matrix is a lower triangular matrix. The matrix is considered to be lower triangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} l_{0,0} & 0 & 0 & \cdots & 0 \\ l_{1,0} & l_{1,1} & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & l_{2,2} & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & l_{N,N} \\ \end{array}\right).\]

$ 0 \times 0 $ or $ 1 \times 1 $ matrices are considered as trivially lower triangular. The following code example demonstrates the use of the function:

// ... Initialization
if( isLower( A ) ) { ... }

It is also possible to check if a matrix expression results in a lower triangular matrix:

if( isLower( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isnan ( const SparseMatrix< MT, SO > &  sm)

Checks the given sparse matrix for not-a-number elements.

Parameters
smThe sparse matrix to be checked for not-a-number elements.
Returns
true if at least one element of the sparse matrix is not-a-number, false otherwise.

This function checks the sparse matrix for not-a-number (NaN) elements. If at least one element of the matrix is not-a-number, the function returns true, otherwise it returns false.

// ... Initialization
if( isnan( A ) ) { ... }

Note that this function only works for matrices with floating point elements. The attempt to use it for a matrix with a non-floating point element type results in a compile time error.

template<typename MT >
bool blaze::isnan ( const MatrixAccessProxy< MT > &  proxy)
inline

Returns whether the represented element is not a number.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is in not a number, false otherwise.

This function checks whether the element represented by the access proxy is not a number (NaN). In case it is not a number, the function returns true, otherwise it returns false.

template<typename MT >
bool blaze::isOne ( const MatrixAccessProxy< MT > &  proxy)
inline

Returns whether the represented element is 1.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is 1, false otherwise.

This function checks whether the element represented by the access proxy represents the numeric value 1. In case it is 1, the function returns true, otherwise it returns false.

template<typename MT >
bool blaze::isReal ( const MatrixAccessProxy< MT > &  proxy)
inline

Returns whether the matrix element represents a real number.

Parameters
proxyThe given access proxy.
Returns
true in case the matrix element represents a real number, false otherwise.

This function checks whether the element represented by the access proxy represents the a real number. In case the element is of built-in type, the function returns true. In case the element is of complex type, the function returns true if the imaginary part is equal to 0. Otherwise it returns false.

template<typename MT , bool SO>
bool blaze::isStrictlyLower ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is a strictly lower triangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is a strictly lower triangular matrix, false if not.

This function checks if the given sparse matrix is a strictly lower triangular matrix. The matrix is considered to be strictly lower triangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} 0 & 0 & 0 & \cdots & 0 \\ l_{1,0} & 0 & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & 0 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & 0 \\ \end{array}\right).\]

The following code example demonstrates the use of the function:

// ... Initialization
if( isStrictlyLower( A ) ) { ... }

It is also possible to check if a matrix expression results in a strictly lower triangular matrix:

if( isStrictlyLower( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isStrictlyUpper ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is a strictly upper triangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is a strictly upper triangular matrix, false if not.

This function checks if the given sparse matrix is a strictly upper triangular matrix. The matrix is considered to be strictly upper triangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} 0 & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & 0 & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & 0 & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 0 \\ \end{array}\right).\]

The following code example demonstrates the use of the function:

// ... Initialization
if( isStrictlyUpper( A ) ) { ... }

It is also possible to check if a matrix expression results in a strictly upper triangular matrix:

if( isStrictlyUpper( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isSymmetric ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is symmetric.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is symmetric, false if not.

This function checks if the given sparse matrix is symmetric. The matrix is considered to be symmetric if it is a square matrix whose transpose is equal to itself ( $ A = A^T $). The following code example demonstrates the use of the function:

// ... Initialization
if( isSymmetric( A ) ) { ... }

It is also possible to check if a matrix expression results in a symmetric matrix:

if( isSymmetric( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isUniform ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is a uniform matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is a uniform matrix, false if not.

This function checks if the given sparse matrix is a uniform matrix. The matrix is considered to be uniform if all its elements are identical. The following code example demonstrates the use of the function:

// ... Initialization
if( isUniform( A ) ) { ... }

It is also possible to check if a matrix expression results in a uniform matrix:

if( isUniform( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isUniLower ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is a lower unitriangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is a lower unitriangular matrix, false if not.

This function checks if the given sparse matrix is a lower unitriangular matrix. The matrix is considered to be lower unitriangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} 1 & 0 & 0 & \cdots & 0 \\ l_{1,0} & 1 & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & 1 \\ \end{array}\right).\]

The following code example demonstrates the use of the function:

// ... Initialization
if( isUniLower( A ) ) { ... }

It is also possible to check if a matrix expression results in a lower unitriangular matrix:

if( isUniLower( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isUniUpper ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is an upper unitriangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is an upper unitriangular matrix, false if not.

This function checks if the given sparse matrix is an upper unitriangular matrix. The matrix is considered to be upper unitriangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} 1 & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & 1 & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & 1 & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ \end{array}\right).\]

The following code example demonstrates the use of the function:

// ... Initialization
if( isUniUpper( A ) ) { ... }

It is also possible to check if a matrix expression results in an upper unitriangular matrix:

if( isUniUpper( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT , bool SO>
bool blaze::isUpper ( const SparseMatrix< MT, SO > &  sm)

Checks if the given sparse matrix is an upper triangular matrix.

Parameters
smThe sparse matrix to be checked.
Returns
true if the matrix is an upper triangular matrix, false if not.

This function checks if the given sparse matrix is an upper triangular matrix. The matrix is considered to be upper triangular if it is a square matrix of the form

\[\left(\begin{array}{*{5}{c}} u_{0,0} & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & u_{1,1} & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & u_{2,2} & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & u_{N,N} \\ \end{array}\right).\]

$ 0 \times 0 $ or $ 1 \times 1 $ matrices are considered as trivially upper triangular. The following code example demonstrates the use of the function:

// ... Initialization
if( isUpper( A ) ) { ... }

It is also possible to check if a matrix expression results in an upper triangular matrix:

if( isUpper( A * B ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.

template<typename MT >
bool blaze::isZero ( const MatrixAccessProxy< MT > &  proxy)
inline

Returns whether the represented element is 0.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is 0, false otherwise.

This function checks whether the element represented by the access proxy represents the numeric value 0. In case it is 0, the function returns true, otherwise it returns false.

template<typename MT , bool SO>
const MT::ElementType blaze::max ( const SparseMatrix< MT, SO > &  sm)

Returns the largest element of the sparse matrix.

Parameters
smThe given sparse matrix.
Returns
The largest sparse matrix element.

This function returns the largest element of the given sparse matrix. This function can only be used for element types that support the smaller-than relationship. In case the matrix currently has either 0 rows or 0 columns, the returned value is the default value (e.g. 0 in case of fundamental data types).

template<typename MT , bool SO>
const MT::ElementType blaze::min ( const SparseMatrix< MT, SO > &  sm)

Returns the smallest element of the sparse matrix.

Parameters
smThe given sparse matrix.
Returns
The smallest sparse matrix element.

This function returns the smallest element of the given sparse matrix. This function can only be used for element types that support the smaller-than relationship. In case the matrix currently has either 0 rows or 0 columns, the returned value is the default value (e.g. 0 in case of fundamental data types).

template<typename T1 , bool SO1, typename T2 , bool SO2>
bool blaze::operator!= ( const SparseMatrix< T1, SO1 > &  lhs,
const SparseMatrix< T2, SO2 > &  rhs 
)
inline

Inequality operator for the comparison of two sparse matrices.

Parameters
lhsThe left-hand side sparse matrix for the comparison.
rhsThe right-hand side sparse matrix for the comparison.
Returns
true if the two sparse matrices are not equal, false if they are equal.
template<typename T1 , typename T2 >
const SVecTSVecMultExpr<T1,T2> blaze::operator* ( const SparseVector< T1, false > &  lhs,
const SparseVector< T2, true > &  rhs 
)
inline

Multiplication operator for the sparse vector-sparse vector outer product ( $ A=\vec{b}*\vec{c}^T $).

Parameters
lhsThe left-hand side sparse vector for the outer product.
rhsThe right-hand side transpose sparse vector for the outer product.
Returns
The resulting sparse matrix.

This operator represents the outer product between a sparse vector and a transpose sparse vector:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved element types T1::ElementType and T2::ElementType. Both vector types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.

template<typename T1 , typename T2 >
const DisableIf< IsMatMatMultExpr<T2>, TDVecTSMatMultExpr<T1,T2> >::Type blaze::operator* ( const DenseVector< T1, true > &  vec,
const SparseMatrix< T2, true > &  mat 
)
inline

Multiplication operator for the multiplication of a transpose dense vector and a column-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $).

Parameters
vecThe left-hand side transpose dense vector for the multiplication.
matThe right-hand side column-major sparse matrix for the multiplication.
Returns
The resulting transpose vector.
Exceptions
std::invalid_argumentVector and matrix sizes do not match.

This operator represents the multiplication between a transpose dense vector and a column-major sparse matrix:

The operator returns an expression representing a transpose dense vector of the higher-order element type of the two involved element types T1::ElementType and T2::ElementType. Both the dense matrix type T1 and the dense vector type T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.
In case the current size of the vector vec doesn't match the current number of rows of the matrix mat, a std::invalid_argument is thrown.

template<typename T1 , bool SO, typename T2 >
const EnableIf< IsNumeric<T2>, typename MultExprTrait<T1,T2>::Type >::Type blaze::operator* ( const SparseMatrix< T1, SO > &  mat,
T2  scalar 
)
inline

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

Parameters
matThe left-hand side sparse matrix for the multiplication.
scalarThe right-hand side scalar value for the multiplication.
Returns
The scaled result matrix.

This operator represents the multiplication between a sparse matrix and a scalar value:

// ... Resizing and initialization
B = A * 1.25;

The operator returns an expression representing a sparse matrix of the higher-order element type of the involved data types T1::ElementType and T2. Note that this operator only works for scalar values of built-in data type.

template<typename T1 , typename T2 , bool SO>
const EnableIf< IsNumeric<T1>, typename MultExprTrait<T1,T2>::Type >::Type blaze::operator* ( T1  scalar,
const SparseMatrix< T2, SO > &  mat 
)
inline

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

Parameters
scalarThe left-hand side scalar value for the multiplication.
matThe right-hand side sparse matrix for the multiplication.
Returns
The scaled result matrix.

This operator represents the multiplication between a scalar value and a sparse matrix:

// ... Resizing and initialization
B = 1.25 * A;

The operator returns an expression representing a sparse matrix of the higher-order element type of the involved data types T1::ElementType and T2. Note that this operator only works for scalar values of built-in data type.

template<typename T1 , typename T2 >
const SMatSMatMultExpr<T1,T2> blaze::operator* ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Multiplication operator for the multiplication of two row-major sparse matrices ( $ A=B*C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix multiplication.
rhsThe right-hand side sparse matrix for the matrix multiplication.
Returns
The product of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the multiplication of two row-major sparse matrices:

// ... Resizing and initialization
C = A * B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const TSMatTSMatMultExpr<T1,T2> blaze::operator* ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Multiplication operator for the multiplication of two column-major sparse matrices ( $ A=B*C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix multiplication.
rhsThe right-hand side sparse matrix for the matrix multiplication.
Returns
The product of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the multiplication of two column-major sparse matrices:

// ... Resizing and initialization
C = A * B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const TSMatSMatMultExpr<T1,T2> blaze::operator* ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Multiplication operator for the multiplication of a column-major sparse matrix and a row-major sparse matrix ( $ A=B*C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix multiplication.
rhsThe right-hand side sparse matrix for the matrix multiplication.
Returns
The product of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the multiplication of a column-major sparse matrix and a row-major sparse matrix:

// ... Resizing and initialization
C = A * B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const DVecTSVecMultExpr<T1,T2> blaze::operator* ( const DenseVector< T1, false > &  lhs,
const SparseVector< T2, true > &  rhs 
)
inline

Multiplication operator for the dense vector-sparse vector outer product ( $ A=\vec{b}*\vec{c}^T $).

Parameters
lhsThe left-hand side dense vector for the outer product.
rhsThe right-hand side transpose sparse vector for the outer product.
Returns
The resulting sparse matrix.

This operator represents the outer product between a dense vector and a transpose sparse vector:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved element types T1::ElementType and T2::ElementType. Both vector types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.

template<typename T1 , typename T2 >
const SVecTDVecMultExpr<T1,T2> blaze::operator* ( const SparseVector< T1, false > &  lhs,
const DenseVector< T2, true > &  rhs 
)
inline

Multiplication operator for the sparse vector-dense vector outer product ( $ A=\vec{b}*\vec{c}^T $).

Parameters
lhsThe left-hand side sparse vector for the outer product.
rhsThe right-hand side transpose dense vector for the outer product.
Returns
The resulting sparse matrix.

This operator represents the outer product between a sparse vector and a transpose dense vector:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved element types T1::ElementType and T2::ElementType. Both vector types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.

template<typename T1 , typename T2 >
const SMatTSMatMultExpr<T1,T2> blaze::operator* ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Multiplication operator for the multiplication of a row-major sparse matrix and a column-major sparse matrix ( $ A=B*C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix multiplication.
rhsThe right-hand side sparse matrix for the matrix multiplication.
Returns
The product of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the multiplication of a row-major sparse matrix and a column-major sparse matrix:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the MultTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const SMatSMatAddExpr<T1,T2> blaze::operator+ ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Addition operator for the addition of two row-major sparse matrices ( $ A=B+C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix addition.
rhsThe right-hand side sparse matrix to be added to the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the addition of two row-major sparse matrices:

// ... Resizing and initialization
C = A + B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the AddTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const SMatTSMatAddExpr<T1,T2> blaze::operator+ ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Addition operator for the addition of a row-major and a column-major sparse matrix ( $ A=B+C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix addition.
rhsThe right-hand side sparse matrix to be added to the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the addition of a row-major and a column-major sparse matrix:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the AddTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const TSMatTSMatAddExpr<T1,T2> blaze::operator+ ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Addition operator for the addition of two column-major sparse matrices ( $ A=B+C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix addition.
rhsThe right-hand side sparse matrix to be added to the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the addition of two column-major sparse matrices:

// ... Resizing and initialization
C = A + B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the AddTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const SMatTSMatAddExpr<T2,T1> blaze::operator+ ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Addition operator for the addition of a column-major and a row-major sparse matrix ( $ A=B+C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix addition.
rhsThe right-hand side sparse matrix to be added to the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the addition of a column-major and a row-major sparse matrix:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the AddTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename MT , bool SO>
const SMatScalarMultExpr<MT,typename UnderlyingBuiltin<MT>::Type,SO> blaze::operator- ( const SparseMatrix< MT, SO > &  sm)
inline

Unary minus operator for the negation of a sparse matrix ( $ A = -B $).

Parameters
smThe sparse matrix to be negated.
Returns
The negation of the matrix.

This operator represents the negation of a sparse matrix:

// ... Resizing and initialization
B = -A;

The operator returns an expression representing the negation of the given sparse matrix.

template<typename T1 , typename T2 >
const SMatSMatSubExpr<T1,T2> blaze::operator- ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Subtraction operator for the subtraction of two row-major sparse matrices ( $ A=B-C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix subtraction.
rhsThe right-hand side sparse matrix to be subtracted from the left-hand side matrix.
Returns
The difference of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the subtraction of two row-major sparse matrices:

// ... Resizing and initialization
C = A - B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the SubTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const TSMatSMatSubExpr<T1,T2> blaze::operator- ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Subtraction operator for the subtraction of a column-major and a row-major sparse matrix ( $ A=B-C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix subtraction.
rhsThe right-hand side sparse matrix to be added to the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the subtraction of a column-major and a row-major sparse matrix:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the SubTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const SMatTSMatSubExpr<T1,T2> blaze::operator- ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Subtraction operator for the subtraction of a row-major and a column-major sparse matrix ( $ A=B-C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix subtraction.
rhsThe right-hand side sparse matrix to be subtracted from the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the subtraction of a row-major and a column-major sparse matrix:

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the SubTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , typename T2 >
const TSMatTSMatSubExpr<T1,T2> blaze::operator- ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Subtraction operator for the subtraction of two column-major sparse matrices ( $ A=B-C $).

Parameters
lhsThe left-hand side sparse matrix for the matrix subtraction.
rhsThe right-hand side sparse matrix to be subtracted from the left-hand side matrix.
Returns
The sum of the two matrices.
Exceptions
std::invalid_argumentMatrix sizes do not match

This operator represents the subtraction of two column-major sparse matrices:

// ... Resizing and initialization
C = A - B;

The operator returns an expression representing a sparse matrix of the higher-order element type of the two involved matrix element types T1::ElementType and T2::ElementType. Both matrix types T1 and T2 as well as the two element types T1::ElementType and T2::ElementType have to be supported by the SubTrait class template.
In case the current number of rows and columns of the two given matrices don't match, a std::invalid_argument is thrown.

template<typename T1 , bool SO, typename T2 >
const EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type blaze::operator/ ( const SparseMatrix< T1, SO > &  mat,
T2  scalar 
)
inline

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

Parameters
matThe left-hand side sparse matrix for the division.
scalarThe right-hand side scalar value for the division.
Returns
The scaled result matrix.

This operator represents the division of a sparse matrix by a scalar value:

// ... Resizing and initialization
B = A / 0.24;

The operator returns an expression representing a sparse matrix of the higher-order element type of the involved data types T1::ElementType and T2. Note that this operator only works for scalar values of built-in data type.

Note
: A division by zero is only checked by a user assert.
template<typename T1 , typename T2 , bool SO>
bool blaze::operator== ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Equality operator for the comparison of two column-major sparse matrices.

Parameters
lhsThe left-hand side sparse matrix for the comparison.
rhsThe right-hand side sparse matrix for the comparison.
Returns
true if the two sparse matrices are equal, false if not.
template<typename T1 , typename T2 , bool SO>
bool blaze::operator== ( const SparseMatrix< T1, SO > &  lhs,
const SparseMatrix< T2,!SO > &  rhs 
)
inline

Equality operator for the comparison of two sparse matrices with different storage order.

Parameters
lhsThe left-hand side sparse matrix for the comparison.
rhsThe right-hand side sparse matrix for the comparison.
Returns
true if the two sparse matrices are equal, false if not.
template<typename T1 , typename T2 >
bool blaze::operator== ( const SparseMatrix< T1, false > &  lhs,
const SparseMatrix< T2, false > &  rhs 
)
inline

Equality operator for the comparison of two row-major sparse matrices.

Parameters
lhsThe left-hand side sparse matrix for the comparison.
rhsThe right-hand side sparse matrix for the comparison.
Returns
true if the two sparse matrices are equal, false if not.
template<typename T1 , typename T2 >
bool blaze::operator== ( const SparseMatrix< T1, true > &  lhs,
const SparseMatrix< T2, true > &  rhs 
)
inline

Equality operator for the comparison of two column-major sparse matrices.

Parameters
lhsThe left-hand side sparse matrix for the comparison.
rhsThe right-hand side sparse matrix for the comparison.
Returns
true if the two sparse matrices are equal, false if not.
template<typename MT , bool SO>
const RealExprTrait<MT>::Type blaze::real ( const SparseMatrix< MT, SO > &  sm)
inline

Returns a matrix containing the real parts of each single element of sm.

Parameters
smThe input matrix.
Returns
The real part of each single element of sm.

The real function calculates the real part of each element of the input matrix sm. The function returns an expression representing this operation.
The following example demonstrates the use of the real function:

// ... Resizing and initialization
B = real( A );
template<typename MT >
void blaze::reset ( const MatrixAccessProxy< MT > &  proxy)
inline

Resetting the represented element to the default initial values.

Parameters
proxyThe given access proxy.
Returns
void

This function resets the element represented by the access proxy to its default initial value. In case the access proxy represents a vector- or matrix-like data structure that provides a reset() function, this function resets all elements of the vector/matrix to the default initial values.

template<typename MT , bool SO>
const SMatSerialExpr< MT, SO > blaze::serial ( const SparseMatrix< MT, SO > &  sm)
inline

Forces the serial evaluation of the given sparse matrix expression sm.

Parameters
smThe input matrix.
Returns
The evaluated sparse matrix.

The serial function forces the serial evaluation of the given sparse matrix expression sm. The function returns an expression representing the operation.
The following example demonstrates the use of the serial function

// ... Resizing and initialization
B = serial( A );
template<typename MT >
void blaze::swap ( const MatrixAccessProxy< MT > &  a,
const MatrixAccessProxy< MT > &  b 
)
inline

Swapping the contents of two access proxies.

Parameters
aThe first access proxy to be swapped.
bThe second access proxy to be swapped.
Returns
void
Exceptions
no-throwguarantee.
template<typename MT , typename T >
void blaze::swap ( const MatrixAccessProxy< MT > &  a,
T &  b 
)
inline

Swapping the contents of an access proxy with another element.

Parameters
aThe access proxy to be swapped.
bThe other element to be swapped.
Returns
void
Exceptions
no-throwguarantee.
template<typename T , typename MT >
void blaze::swap ( T &  a,
const MatrixAccessProxy< MT > &  b 
)
inline

Swapping the contents of an access proxy with another element.

Parameters
aThe other element to be swapped.
bThe access proxy to be swapped.
Returns
void
Exceptions
no-throwguarantee.
template<typename MT , bool SO>
const SMatTransExpr< MT,!SO > blaze::trans ( const SparseMatrix< MT, SO > &  sm)
inline

Calculation of the transpose of the given sparse matrix.

Parameters
smThe sparse matrix to be transposed.
Returns
The transpose of the matrix.

This function returns an expression representing the transpose of the given sparse matrix: