Classes
Submatrix

Classes

class  blaze::Submatrix< MT, AF, SO, DF >
 View on a specific submatrix of a dense or sparse matrix.The Submatrix class template represents a view on a specific submatrix of a dense or sparse matrix primitive. The type of the matrix is specified via the first template parameter: More...
 

Submatrix operators

template<typename MT , bool AF, bool SO, bool DF>
void blaze::reset (Submatrix< MT, AF, SO, DF > &sm)
 Resetting the given submatrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
void blaze::reset (Submatrix< MT, AF, SO, DF > &sm, size_t i)
 Reset the specified row/column of the given submatrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
void blaze::clear (Submatrix< MT, AF, SO, DF > &sm)
 Clearing the given matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isDefault (const Submatrix< MT, AF, SO, DF > &sm)
 Returns whether the given submatrix is in default state. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isIntact (const Submatrix< MT, AF, SO, DF > &sm) noexcept
 Returns whether the invariants of the given submatrix are intact. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSymmetric (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is symmetric. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isHermitian (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is Hermitian. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isLower (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is a lower triangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUniLower (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is a lower unitriangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isStrictlyLower (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is a strictly lower triangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUpper (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is an upper triangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUniUpper (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is an upper unitriangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isStrictlyUpper (const Submatrix< MT, AF, SO, DF > &sm)
 Checks if the given submatrix is a strictly upper triangular matrix. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame (const Submatrix< MT, AF, SO, DF > &a, const Matrix< MT, SO > &b) noexcept
 Returns whether the given matrix and submatrix represent the same observable state. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame (const Matrix< MT, SO > &a, const Submatrix< MT, AF, SO, DF > &b) noexcept
 Returns whether the given matrix and submatrix represent the same observable state. More...
 
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame (const Submatrix< MT, AF, SO, DF > &a, const Submatrix< MT, AF, SO, DF > &b) noexcept
 Returns whether the two given submatrices represent the same observable state. More...
 

Detailed Description

Function Documentation

template<typename MT , bool AF, bool SO, bool DF>
void blaze::clear ( Submatrix< MT, AF, SO, DF > &  sm)
inline

Clearing the given matrix.

Parameters
smThe matrix to be cleared.
Returns
void

Clearing a submatrix is equivalent to resetting it via the reset() function.

template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isDefault ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Returns whether the given submatrix is in default state.

Parameters
smThe submatrix to be tested for its default state.
Returns
true in case the given submatrix is component-wise zero, false otherwise.

This function checks whether the submatrix is in default state. For instance, in case the submatrix is instantiated for a built-in integral or floating point data type, the function returns true in case all submatrix elements are 0 and false in case any submatrix element is not 0. The following example demonstrates the use of the isDefault function:

// ... Resizing and initialization
if( isDefault( submatrix( A, 12UL, 13UL, 22UL, 33UL ) ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isHermitian ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is Hermitian.

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

This function checks if the given submatrix is Hermitian. The submatrix is considered to be Hermitian if it is a square matrix whose transpose is equal to its conjugate transpose ( $ A = \overline{A^T} $). The following code example demonstrates the use of the function:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isHermitian( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isIntact ( const Submatrix< MT, AF, SO, DF > &  sm)
inlinenoexcept

Returns whether the invariants of the given submatrix are intact.

Parameters
smThe submatrix to be tested.
Returns
true in case the given submatrix's invariants are intact, false otherwise.

This function checks whether the invariants of the submatrix are intact, i.e. if its state is valid. In case the invariants are intact, the function returns true, else it will return false. The following example demonstrates the use of the isIntact() function:

// ... Resizing and initialization
if( isIntact( submatrix( A, 12UL, 13UL, 22UL, 33UL ) ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isLower ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is a lower triangular matrix.

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

This function checks if the given submatrix 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isLower( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame ( const Submatrix< MT, AF, SO, DF > &  a,
const Matrix< MT, SO > &  b 
)
inlinenoexcept

Returns whether the given matrix and submatrix represent the same observable state.

Parameters
aThe submatrix to be tested for its state.
bThe matrix to be tested for its state.
Returns
true in case the submatrix and matrix share a state, false otherwise.

This overload of the isSame function tests if the given submatrix refers to the full given matrix and by that represents the same observable state. In this case, the function returns true, otherwise it returns false.

template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame ( const Matrix< MT, SO > &  a,
const Submatrix< MT, AF, SO, DF > &  b 
)
inlinenoexcept

Returns whether the given matrix and submatrix represent the same observable state.

Parameters
aThe matrix to be tested for its state.
bThe submatrix to be tested for its state.
Returns
true in case the matrix and submatrix share a state, false otherwise.

This overload of the isSame function tests if the given submatrix refers to the full given matrix and by that represents the same observable state. In this case, the function returns true, otherwise it returns false.

template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSame ( const Submatrix< MT, AF, SO, DF > &  a,
const Submatrix< MT, AF, SO, DF > &  b 
)
inlinenoexcept

Returns whether the two given submatrices represent the same observable state.

Parameters
aThe first submatrix to be tested for its state.
bThe second submatrix to be tested for its state.
Returns
true in case the two submatrices share a state, false otherwise.

This overload of the isSame function tests if the two given submatrices refer to exactly the same part of the same matrix. In case both submatrices represent the same observable state, the function returns true, otherwise it returns false.

template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isStrictlyLower ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

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

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

This function checks if the given submatrix is a strictly 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}} 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isStrictlyLower( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isStrictlyUpper ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

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

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

This function checks if the given sparse submatrix is a strictly 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}} 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isStrictlyUpper( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isSymmetric ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is symmetric.

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

This function checks if the given submatrix is symmetric. The submatrix 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isSymmetric( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUniLower ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is a lower unitriangular matrix.

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

This function checks if the given submatrix is a lower unitriangular matrix. The matrix is considered to be lower triangular 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isUniLower( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUniUpper ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is an upper unitriangular matrix.

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

This function checks if the given sparse submatrix 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}} 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isUniUpper( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
bool blaze::isUpper ( const Submatrix< MT, AF, SO, DF > &  sm)
inline

Checks if the given submatrix is an upper triangular matrix.

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

This function checks if the given sparse submatrix 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:

Matrix A( 32UL, 16UL );
// ... Initialization
blaze::Submatrix<Matrix> sm( A, 8UL, 8UL, 16UL, 16UL );
if( isUpper( sm ) ) { ... }
template<typename MT , bool AF, bool SO, bool DF>
void blaze::reset ( Submatrix< MT, AF, SO, DF > &  sm)
inline

Resetting the given submatrix.

Parameters
smThe submatrix to be resetted.
Returns
void
template<typename MT , bool AF, bool SO, bool DF>
void blaze::reset ( Submatrix< MT, AF, SO, DF > &  sm,
size_t  i 
)
inline

Reset the specified row/column of the given submatrix.

Parameters
smThe submatrix to be resetted.
iThe index of the row/column to be resetted.
Returns
void

This function resets the values in the specified row/column of the given submatrix to their default value. In case the given submatrix is a rowMajor matrix the function resets the values in row i, if it is a columnMajor matrix the function resets the values in column i. Note that the capacity of the row/column remains unchanged.