![]() |
Blaze 3.9
|
Dense vector representation of an initializer list. More...
#include <InitializerVector.h>
Inherits blaze::DenseVector< InitializerVector< Type, TF, Tag >, TF >.
Classes | |
struct | Rebind |
Rebind mechanism to obtain a InitializerVector with different data/element type. More... | |
struct | Resize |
Resize mechanism to obtain a InitializerVector with a different fixed number of elements. More... | |
Public Types | |
using | This = InitializerVector< Type, TF, Tag > |
Type of this InitializerVector instance. | |
using | BaseType = DenseVector< This, TF > |
Base type of this InitializerVector instance. | |
using | ResultType = DynamicVector< Type, TF > |
Result type for expression template evaluations. | |
using | TransposeType = DynamicVector< Type,!TF > |
Transpose type for expression template evaluations. | |
using | ElementType = Type |
Type of the vector elements. | |
using | TagType = Tag |
Tag type of this InitializerVector instance. | |
using | ReturnType = const Type & |
Return type for expression template evaluations. | |
using | CompositeType = const InitializerVector & |
Data type for composite expression templates. | |
using | Reference = const Type & |
Reference to a non-constant vector value. | |
using | ConstReference = const Type & |
Reference to a constant vector value. | |
using | Pointer = const Type * |
Pointer to a non-constant vector value. | |
using | ConstPointer = const Type * |
Pointer to a constant vector value. | |
using | Iterator = InitializerIterator< Type > |
Iterator over non-constant elements. | |
using | ConstIterator = InitializerIterator< Type > |
Iterator over constant elements. | |
using | VectorType = InitializerVector< Type, TF, Tag > |
Type of the vector. | |
Public Member Functions | |
Constructors | |
InitializerVector (initializer_list< Type > list) noexcept | |
Constructor for InitializerVector. More... | |
InitializerVector (initializer_list< Type > list, size_t n) | |
Constructor for InitializerVector. More... | |
InitializerVector (const InitializerVector &)=default | |
Destructor | |
~InitializerVector ()=default | |
Data access functions | |
ConstReference | operator[] (size_t index) const noexcept |
Subscript operator for the direct access to the vector elements. More... | |
ConstReference | at (size_t index) const |
Checked access to the vector elements. More... | |
ConstPointer | data () const noexcept |
Low-level data access to the vector elements. More... | |
ConstIterator | begin () const noexcept |
Returns an iterator to the first element of the initializer vector. More... | |
ConstIterator | cbegin () const noexcept |
Returns an iterator to the first element of the initializer vector. More... | |
ConstIterator | end () const noexcept |
Returns an iterator just past the last element of the initializer vector. More... | |
ConstIterator | cend () const noexcept |
Returns an iterator just past the last element of the initializer vector. More... | |
Assignment operators | |
InitializerVector & | operator= (const InitializerVector &)=delete |
Utility functions | |
size_t | size () const noexcept |
Returns the current size/dimension of the vector. More... | |
size_t | spacing () const noexcept |
Returns the minimum capacity of the vector. More... | |
size_t | capacity () const noexcept |
Returns the maximum capacity of the vector. More... | |
size_t | nonZeros () const |
Returns the number of non-zero elements in the vector. More... | |
void | swap (InitializerVector &v) noexcept |
Swapping the contents of two vectors. More... | |
Conversion operators | |
BLAZE_ALWAYS_INLINE constexpr InitializerVector< Type, TF, Tag > & | operator~ () noexcept |
CRTP-based conversion operation for non-constant vectors. More... | |
BLAZE_ALWAYS_INLINE constexpr const InitializerVector< Type, TF, Tag > & | operator~ () const noexcept |
CRTP-based conversion operation for constant vectors. More... | |
constexpr InitializerVector< Type, TF, Tag > & | operator* () noexcept |
CRTP-based conversion operation for non-constant vectors. More... | |
constexpr const InitializerVector< Type, TF, Tag > & | operator* () const noexcept |
CRTP-based conversion operation for constant vectors. 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 | transposeFlag |
Transpose flag of the vector. | |
Expression template evaluation functions | |
using | ListType = initializer_list< Type > |
Type of the represented initializer list. | |
template<typename Other > | |
bool | canAlias (const Other *alias) const noexcept |
Returns whether the vector can alias with the given address alias. More... | |
template<typename Other > | |
bool | isAliased (const Other *alias) const noexcept |
Returns whether the vector is aliased with the given address alias. More... | |
Member variables | |
size_t | size_ |
The current size/dimension of the vector. | |
ListType | list_ |
The initializer list represented by the vector. More... | |
static const Type | zero_ {} |
Neutral element for accesses to zero elements. | |
Dense vector representation of an initializer list.
The InitializerVector class template is a dense vector representation of an (extended) initializer list of arbitrary type. The type of the elements, the transpose flag, and the group tag of the vector can be specified via the three template parameters:
blaze::rowVector
) or a column vector (blaze::columnVector
). The default value is blaze::defaultTransposeFlag
.blaze::Group0
. See Grouping/Tagging for details.On construction, an InitializerVector is immediately bound to an initializer list:
It is possible to only represent an extended initializer list by providing an additional size argument:
Since an InitializerVector 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 InitializerVector results in undefined behavior:
Also, an InitializerVector 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 InitializerVector:
An initializer vector can be used as operand in arithmetic operations. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of dense and sparse vectors with fitting element types. The following example gives an impression of the use of InitializerVector:
|
inlinenoexcept |
Constructor for InitializerVector.
list | The initializer list represented by the vector. |
|
inline |
Constructor for InitializerVector.
list | The initializer list represented by the vector. |
n | The size of the vector. |
std::invalid_argument | Invalid initializer list dimension. |
|
inline |
Checked access to the vector elements.
index | Access index. The index has to be in the range ![]() |
std::out_of_range | Invalid vector access index. |
In contrast to the subscript operator this function always performs a check of the given access index.
|
inlinenoexcept |
Returns an iterator to the first element of the initializer vector.
|
inlinenoexcept |
Returns whether the vector can alias with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address can alias with the vector. 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 vector.
|
inlinenoexcept |
Returns an iterator to the first element of the initializer vector.
|
inlinenoexcept |
Returns an iterator just past the last element of the initializer vector.
|
inlinenoexcept |
Low-level data access to the vector elements.
This function returns a pointer to the internal storage of the initializer vector.
|
inlinenoexcept |
Returns an iterator just past the last element of the initializer vector.
|
inlinenoexcept |
Returns whether the vector is aliased with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address is aliased with the vector. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.
|
inline |
Returns the number of non-zero elements in the vector.
This function returns the number of non-zero elements in the vector (i.e. the elements that compare unequal to their default value). Note that the number of non-zero elements is always less than or equal to the current size of the vector.
|
constexprnoexceptinherited |
CRTP-based conversion operation for constant vectors.
This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a constant reference to the actual type VT.
|
constexprnoexceptinherited |
CRTP-based conversion operation for non-constant vectors.
This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a mutable reference to the actual type VT.
|
inlinenoexcept |
Subscript operator for the direct access to the vector elements.
index | Access index. 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 index.
|
constexprnoexceptinherited |
CRTP-based conversion operation for constant vectors.
This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a constant reference to the actual type VT.
|
constexprnoexceptinherited |
CRTP-based conversion operation for non-constant vectors.
This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a mutable reference to the actual type VT.
|
inlinenoexcept |
Returns the current size/dimension of the vector.
|
inlinenoexcept |
Returns the minimum capacity of the vector.
This function returns the minimum capacity of the vector, which corresponds to the current size plus padding.
|
inlinenoexcept |
Swapping the contents of two vectors.
v | The vector to be swapped. |
|
private |
The initializer list represented by the vector.
Access to the vector elements is gained via the subscript operator. The order of the elements is
|
staticconstexpr |
Compilation flag for SIMD optimization.
The simdEnabled compilation flag indicates whether expressions the vector is involved in can be optimized via SIMD operationss. In case the element type of the vector is a vectorizable data type, the simdEnabled compilation flag is set to true, otherwise it is set to false.
|
staticconstexpr |
Compilation flag for SMP assignments.
The smpAssignable compilation flag indicates whether the vector can be used in SMP (shared memory parallel) assignments (both on the left-hand and right-hand side of the assignment).