![]() |
Dense matrix representation of an initializer list.The InitializerMatrix class template is a dense matrix representation of an (extended) initializer list of arbitrary type. The type of the elements of the matrix can be specified via the single template parameters: More...
#include <InitializerMatrix.h>
Inherits blaze::DenseMatrix< InitializerMatrix< Type >, false >.
Classes | |
struct | Rebind |
Rebind mechanism to obtain a InitializerMatrix with different data/element type. More... | |
struct | Resize |
Resize mechanism to obtain a InitializerMatrix with different fixed dimensions. More... | |
Public Types | |
using | This = InitializerMatrix< Type > |
Type of this InitializerMatrix instance. | |
using | BaseType = DenseMatrix< This, false > |
Base type of this InitializerMatrix instance. | |
using | ResultType = DynamicMatrix< Type, false > |
Result type for expression template evaluations. | |
using | OppositeType = DynamicMatrix< Type, true > |
Result type with opposite storage order for expression template evaluations. | |
using | TransposeType = DynamicMatrix< Type, true > |
Transpose type for expression template evaluations. | |
using | ElementType = Type |
Type of the matrix elements. | |
using | ReturnType = const Type & |
Return type for expression template evaluations. | |
using | CompositeType = const This & |
Data type for composite expression templates. | |
using | Reference = const Type & |
Reference to a non-constant matrix value. | |
using | ConstReference = const Type & |
Reference to a constant matrix value. | |
using | Pointer = const Type * |
Pointer to a non-constant matrix value. | |
using | ConstPointer = const Type * |
Pointer to a constant matrix value. | |
using | Iterator = InitializerIterator< Type > |
Iterator over non-constant elements. | |
using | ConstIterator = InitializerIterator< Type > |
Iterator over constant elements. | |
using | MatrixType = MT |
Type of the matrix. | |
Public Member Functions | |
BLAZE_ALWAYS_INLINE constexpr MatrixType & | operator~ () noexcept |
Conversion operator for non-constant matrices. More... | |
BLAZE_ALWAYS_INLINE constexpr const MatrixType & | operator~ () const noexcept |
Conversion operator for constant matrices. More... | |
Constructors | |
InitializerMatrix (initializer_list< initializer_list< Type > > list) noexcept | |
Constructor for InitializerMatrix. More... | |
InitializerMatrix (initializer_list< initializer_list< Type > > list, size_t n) | |
Constructor for InitializerMatrix. More... | |
InitializerMatrix (const InitializerMatrix &)=default | |
Destructor | |
~InitializerMatrix ()=default | |
Data access functions | |
ConstReference | operator() (size_t i, size_t j) const noexcept |
2D-access to the matrix elements. More... | |
ConstReference | at (size_t i, size_t j) const |
Checked access to the matrix elements. More... | |
ConstPointer | data () const noexcept |
Low-level data access to the matrix elements. More... | |
ConstPointer | data (size_t i) const noexcept |
Low-level data access to the matrix elements of row i. More... | |
ConstIterator | begin (size_t i) const noexcept |
Returns an iterator to the first element of row i. More... | |
ConstIterator | cbegin (size_t i) const noexcept |
Returns an iterator to the first element of row i. More... | |
ConstIterator | end (size_t i) const noexcept |
Returns an iterator just past the last element of row i. More... | |
ConstIterator | cend (size_t i) const noexcept |
Returns an iterator just past the last element of row i. More... | |
Assignment operators | |
InitializerMatrix & | operator= (const InitializerMatrix &)=delete |
Utility functions | |
size_t | rows () const noexcept |
Returns the current number of rows of the matrix. More... | |
size_t | columns () const noexcept |
Returns the current number of columns of the matrix. More... | |
size_t | spacing () const noexcept |
Returns the spacing between the beginning of two rows. More... | |
size_t | capacity () const noexcept |
Returns the maximum capacity of the matrix. More... | |
size_t | capacity (size_t i) const noexcept |
Returns the current capacity of the specified row. More... | |
size_t | nonZeros () const |
Returns the total number of non-zero elements in the matrix. More... | |
size_t | nonZeros (size_t i) const |
Returns the number of non-zero elements in the specified row. More... | |
void | swap (InitializerMatrix &m) noexcept |
Swapping the contents of two matrices. 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... | |
Static Public Attributes | |
static constexpr bool | simdEnabled = false |
Compilation flag for SIMD optimization. More... | |
static constexpr bool | smpAssignable = false |
Compilation flag for SMP assignments. More... | |
static constexpr bool | storageOrder = SO |
Storage order of the matrix. | |
Private Types | |
using | ListType = initializer_list< initializer_list< Type > > |
Type of the represented initializer list. | |
Member variables | |
size_t | m_ |
The current number of rows of the matrix. | |
size_t | n_ |
The current number of columns of the matrix. | |
ListType | list_ |
The initializer list represented by the matrix. More... | |
static const Type | zero_ {} |
Neutral element for accesses to zero elements. | |
Dense matrix representation of an initializer list.
The InitializerMatrix class template is a dense matrix representation of an (extended) initializer list of arbitrary type. The type of the elements of the matrix can be specified via the single template parameters:
Type specifies the type of the matrix elements. InitializerMatrix can be used with any non-cv-qualified, non-reference, non-pointer element type.
On construction, an InitializerMatrix is immediately bound to an initializer list:
It is possible to only represent an extended initializer list by explicitly specifying the number of columns:
Since an InitializerMatrix represents a specific initializer list, its lifetime is bound to the lifetime of the according initializer list. When the initializer list goes out of scope access to the initializer list via an InitializerMatrix results in undefined behavior:
Also, an InitializerMatrix can only be used on the right of an assignment as its elements are considered to be immutable. The following example gives an impression on the usage of an InitializerMatrix:
An initializer matrix can be used as operand in arithmetic operations. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of row-major and column-major dense and sparse matrices with fitting element types. The following example gives an impression of the use of InitializerMatrix:
|
inlineexplicitnoexcept |
Constructor for InitializerMatrix.
list | The initializer list represented by the matrix. |
|
inlineexplicit |
Constructor for InitializerMatrix.
list | The initializer list represented by the matrix. |
n | The number of columns of the matrix. |
std::invalid_argument | Invalid initializer list dimension. |
|
inline |
Checked access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
std::out_of_range | Invalid matrix access index. |
In contrast to the subscript operator this function always performs a check of the given access indices.
|
inlinenoexcept |
Returns an iterator to the first element of row i.
i | The row index. |
This function returns a row iterator to the first element of row i.
|
inlinenoexcept |
Returns whether the matrix can alias with the given address alias.
alias | The alias to be checked. |
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.
|
inlinenoexcept |
Returns the maximum capacity of the matrix.
|
inlinenoexcept |
Returns the current capacity of the specified row.
i | The index of the row. |
This function returns the current capacity of the specified row.
|
inlinenoexcept |
Returns an iterator to the first element of row i.
i | The row index. |
This function returns a row iterator to the first element of row i
|
inlinenoexcept |
Returns an iterator just past the last element of row i.
i | The row index. |
This function returns an row iterator just past the last element of row i.
|
inlinenoexcept |
Returns the current number of columns of the matrix.
|
inlinenoexcept |
Low-level data access to the matrix elements.
This function returns a pointer to the internal storage of the dynamic matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The dynamic matrix may use techniques such as padding to improve the alignment of the data. Whereas the number of elements within a row/column are given by the rows()
and columns()
member functions, respectively, the total number of elements including padding is given by the spacing()
member function.
|
inlinenoexcept |
Low-level data access to the matrix elements of row i.
i | The row index. |
This function returns a pointer to the internal storage for the elements in row i.
|
inlinenoexcept |
Returns an iterator just past the last element of row i.
i | The row index. |
This function returns an row iterator just past the last element of row i.
|
inlinenoexcept |
Returns whether the matrix is aliased with the given address alias.
alias | The alias to be checked. |
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.
|
inline |
Returns the total number of non-zero elements in the matrix.
|
inline |
Returns the number of non-zero elements in the specified row.
i | The index of the row. |
This function returns the current number of non-zero elements in the specified row.
|
inlinenoexcept |
2D-access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
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.
|
inlinenoexceptinherited |
Conversion operator for non-constant matrices.
|
inlinenoexceptinherited |
Conversion operator for constant matrices.
|
inlinenoexcept |
Returns the current number of rows of the matrix.
|
inlinenoexcept |
Returns the spacing between the beginning of two rows.
This function returns the spacing between the beginning of two rows, i.e. the total number of elements of a row.
|
inlinenoexcept |
Swapping the contents of two matrices.
m | The matrix to be swapped. |
|
private |
The initializer list represented by the matrix.
Access to the matrix elements is gained via the function call operator. The memory layout of the elements is
.
|
static |
Compilation flag for SIMD optimization.
The simdEnabled compilation flag indicates whether expressions the matrix is involved in can be optimized via SIMD operations. In case the element type of the matrix is a vectorizable data type, the simdEnabled compilation flag is set to true, otherwise it is set to false.
|
static |
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).