![]() |
Blaze
3.6
|
Classes | |
class | blaze::BandData< CBAs > |
Auxiliary class template for the data members of the Band class.The auxiliary BandData class template represents an abstraction of the data members of the Band class template. The necessary set of data member is selected depending on the number of compile time band arguments. More... | |
Functions | |
template<ptrdiff_t I, typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (Matrix< MT, SO > &matrix, RBAs... args) |
Creating a view on a specific band of the given matrix. More... | |
template<ptrdiff_t I, typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (const Matrix< MT, SO > &matrix, RBAs... args) |
Creating a view on a specific band of the given constant matrix. More... | |
template<ptrdiff_t I, typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (Matrix< MT, SO > &&matrix, RBAs... args) |
Creating a view on a specific band of the given temporary matrix. More... | |
template<typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (Matrix< MT, SO > &matrix, ptrdiff_t index, RBAs... args) |
Creating a view on a specific band of the given matrix. More... | |
template<typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (const Matrix< MT, SO > &matrix, ptrdiff_t index, RBAs... args) |
Creating a view on a specific band of the given constant matrix. More... | |
template<typename MT , bool SO, typename... RBAs> | |
decltype(auto) | blaze::band (Matrix< MT, SO > &&matrix, ptrdiff_t index, RBAs... args) |
Creating a view on a specific band of the given temporary matrix. More... | |
template<typename MT , bool SO, typename... RDAs> | |
decltype(auto) | blaze::diagonal (Matrix< MT, SO > &matrix, RDAs... args) |
Creating a view on the diagonal of the given matrix. More... | |
template<typename MT , bool SO, typename... RDAs> | |
decltype(auto) | blaze::diagonal (const Matrix< MT, SO > &matrix, RDAs... args) |
Creating a view on the diagonal of the given constant matrix. More... | |
template<typename MT , bool SO, typename... RDAs> | |
decltype(auto) | blaze::diagonal (Matrix< MT, SO > &&matrix, RDAs... args) |
Creating a view on the diagonal of the given temporary matrix. More... | |
Bands provide views on a specific band of a dense or sparse matrix (e.g. the diagonal, the subdiagonal, ...). As such, bands act as a reference to a specific band. This reference is valid and can be used in every way any other vector can be used as long as the matrix containing the band is not resized or entirely destroyed. The band also acts as an alias to the band elements: Changes made to the elements (e.g. modifying values, inserting or erasing elements) are immediately visible in the matrix and changes made via the matrix are immediately visible in the band.
A reference to a dense or sparse band can be created very conveniently via the band()
function. It can be included via the header file
The band index must be in the range from , where
M
is the total number of rows and N
is the total number of columns, and can be specified both at compile time or at runtime:
The band()
function returns an expression representing the band view. The type of this expression depends on the given band arguments, primarily the type of the matrix and the compile time arguments. If the type is required, it can be determined via decltype
specifier:
The resulting view can be treated as any other vector, i.e. it can be assigned to, it can be copied from, and it can be used in arithmetic operations. By default, bands are considered column vectors, but this setting can be changed via the defaultTransposeFlag
switch. The reference can also be used on both sides of an assignment: The band can either be used as an alias to grant write access to a specific band of a matrix primitive on the left-hand side of an assignment or to grant read-access to a specific band of a matrix primitive or expression on the right-hand side of an assignment. The following example demonstrates this in detail:
The elements of a band can be directly accessed with the subscript operator:
The numbering of the band elements is
where N is the number of elements of the referenced band. Alternatively, the elements of a band can be traversed via iterators. Just as with vectors, in case of non-const band, begin()
and end()
return an iterator, which allows to manipulate the elements, in case of constant bands an iterator to immutable elements is returned:
Inserting/accessing elements in a sparse band can be done by several alternative functions. The following example demonstrates all options:
A band view can be used like any other column vector. For instance, the current number of band elements can be obtained via the size()
function, the current capacity via the capacity()
function, and the number of non-zero elements via the nonZeros()
function. However, since bands are references to specific bands of a matrix, several operations are not possible, such as resizing and swapping. The following example shows this by means of a dense band view:
Both dense and sparse bands can be used in all arithmetic operations that any other dense or sparse vector can be used in. The following example gives an impression of the use of dense bands within arithmetic operations. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of dense and sparse bands with fitting element types:
|
inline |
Creating a view on a specific band of the given matrix.
matrix | The matrix containing the band. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given matrix.
By default, the provided band arguments are checked at runtime. // In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown. The checks can be skipped by providing the optional blaze::unchecked argument.
|
inline |
Creating a view on a specific band of the given constant matrix.
matrix | The constant matrix containing the band. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given constant matrix.
By default, the provided band arguments are checked at runtime. // In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown. The checks can be skipped by providing the optional blaze::unchecked argument.
|
inline |
Creating a view on a specific band of the given temporary matrix.
matrix | The temporary matrix containing the band. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given temporary matrix. In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown.
|
inline |
Creating a view on a specific band of the given matrix.
matrix | The matrix containing the band. |
index | The band index. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given matrix.
By default, the provided band arguments are checked at runtime. // In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown. The checks can be skipped by providing the optional blaze::unchecked argument.
|
inline |
Creating a view on a specific band of the given constant matrix.
matrix | The constant matrix containing the band. |
index | The band index. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given constant matrix.
By default, the provided band arguments are checked at runtime. // In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown. The checks can be skipped by providing the optional blaze::unchecked argument.
|
inline |
Creating a view on a specific band of the given temporary matrix.
matrix | The temporary matrix containing the band. |
index | The band index. |
args | Optional band arguments. |
std::invalid_argument | Invalid band access index. |
This function returns an expression representing the specified band of the given temporary matrix. In case the band is not properly specified (i.e. if the specified index does not correspond to a valid band in the given matrix) a std::invalid_argument exception is thrown.
|
inline |
Creating a view on the diagonal of the given matrix.
matrix | The matrix containing the diagonal. |
args | Optional diagonal arguments. |
This function returns an expression representing the diagonal of the given matrix.
|
inline |
Creating a view on the diagonal of the given constant matrix.
matrix | The constant matrix containing the diagonal. |
args | Optional diagonal arguments. |
This function returns an expression representing the diagonal of the given constant matrix.
|
inline |
Creating a view on the diagonal of the given temporary matrix.
matrix | The temporary matrix containing the diagonal. |
args | Optional diagonal arguments. |
This function returns an expression representing the diagonal of the given temporary matrix. In case the diagonal is not properly specified (i.e. in case the given matrix has zero rows or zero columns) a std::invalid_argument exception is thrown.