![]() |
Efficient implementation of a customizable vector. More...
#include <CustomVector.h>
Inherits blaze::DenseVector< CustomVector< Type, AF, PF, TF >, TF >.
Classes | |
struct | Rebind |
Rebind mechanism to obtain a CustomVector with different data/element type. More... | |
struct | Resize |
Resize mechanism to obtain a CustomVector with a different fixed number of elements. More... | |
Public Types | |
enum | : bool { simdEnabled = IsVectorizable<Type>::value } |
Compilation flag for SIMD optimization. More... | |
enum | : bool { smpAssignable = !IsSMPAssignable<Type>::value } |
Compilation flag for SMP assignments. More... | |
using | This = CustomVector< Type, AF, PF, TF > |
Type of this CustomVector instance. | |
using | BaseType = DenseVector< This, TF > |
Base type of this CustomVector instance. | |
using | ResultType = DynamicVector< RemoveConst_< Type >, TF > |
Result type for expression template evaluations. | |
using | TransposeType = DynamicVector< RemoveConst_< Type >,!TF > |
Transpose type for expression template evaluations. | |
using | ElementType = Type |
Type of the vector elements. | |
using | SIMDType = SIMDTrait_< ElementType > |
SIMD type of the vector elements. | |
using | ReturnType = const Type & |
Return type for expression template evaluations. | |
using | CompositeType = const CustomVector & |
Data type for composite expression templates. | |
using | Reference = Type & |
Reference to a non-constant vector value. | |
using | ConstReference = const Type & |
Reference to a constant vector value. | |
using | Pointer = Type * |
Pointer to a non-constant vector value. | |
using | ConstPointer = const Type * |
Pointer to a constant vector value. | |
using | Iterator = DenseIterator< Type, AF > |
Iterator over non-constant elements. | |
using | ConstIterator = DenseIterator< const Type, AF > |
Iterator over constant elements. | |
using | VectorType = VT |
Type of the vector. | |
Public Member Functions | |
template<typename Other , size_t N> | |
CustomVector< Type, AF, PF, TF > & | operator= (const Other(&array)[N]) |
Array assignment to all vector elements. More... | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator= (const Vector< VT, TF > &rhs) |
Assignment operator for different vectors. More... | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator+= (const Vector< VT, TF > &rhs) |
Addition assignment operator for the addition of a vector ( ![]() | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator-= (const Vector< VT, TF > &rhs) |
Subtraction assignment operator for the subtraction of a vector ( ![]() | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator*= (const Vector< VT, TF > &rhs) |
Multiplication assignment operator for the multiplication of a vector ( ![]() | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator/= (const DenseVector< VT, TF > &rhs) |
Division assignment operator for the division of a dense vector ( ![]() | |
template<typename VT > | |
CustomVector< Type, AF, PF, TF > & | operator%= (const Vector< VT, TF > &rhs) |
Cross product assignment operator for the multiplication of a vector ( ![]() | |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, CustomVector< Type, AF, PF, TF > > & | operator*= (Other rhs) |
Multiplication assignment operator for the multiplication between a vector and a scalar value ( ![]() | |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, CustomVector< Type, AF, PF, TF > > & | operator/= (Other rhs) |
Division assignment operator for the division of a vector by a scalar value ( ![]() | |
template<typename Other > | |
CustomVector< Type, AF, PF, TF > & | scale (const Other &scalar) |
Scaling of the vector by the scalar value scalar ( ![]() | |
template<typename VT > | |
DisableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedAssign< VT > > | assign (const DenseVector< VT, TF > &rhs) |
Default implementation of the assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedAssign< VT > > | assign (const DenseVector< VT, TF > &rhs) |
SIMD optimized implementation of the assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedAddAssign< VT > > | addAssign (const DenseVector< VT, TF > &rhs) |
Default implementation of the addition assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedAddAssign< VT > > | addAssign (const DenseVector< VT, TF > &rhs) |
SIMD optimized implementation of the addition assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedSubAssign< VT > > | subAssign (const DenseVector< VT, TF > &rhs) |
Default implementation of the subtraction assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedSubAssign< VT > > | subAssign (const DenseVector< VT, TF > &rhs) |
SIMD optimized implementation of the subtraction assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedMultAssign< VT > > | multAssign (const DenseVector< VT, TF > &rhs) |
Default implementation of the multiplication assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedMultAssign< VT > > | multAssign (const DenseVector< VT, TF > &rhs) |
SIMD optimized implementation of the multiplication assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedDivAssign< VT > > | divAssign (const DenseVector< VT, TF > &rhs) |
Default implementation of the division assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf_< typename CustomVector< Type, AF, PF, TF >::BLAZE_TEMPLATE VectorizedDivAssign< VT > > | divAssign (const DenseVector< VT, TF > &rhs) |
SIMD optimized implementation of the division assignment of a dense vector. More... | |
BLAZE_ALWAYS_INLINE VectorType & | operator~ () noexcept |
Conversion operator for non-constant vectors. More... | |
BLAZE_ALWAYS_INLINE const VectorType & | operator~ () const noexcept |
Conversion operator for constant vectors. More... | |
Constructors | |
CustomVector () | |
The default constructor for CustomVector. | |
CustomVector (Type *ptr, size_t n) | |
Constructor for an unpadded custom vector of size n. More... | |
CustomVector (Type *ptr, size_t n, size_t nn) | |
Constructor for a padded custom vector of size n and capacity nn. More... | |
CustomVector (const CustomVector &v) | |
The copy constructor for CustomVector. More... | |
CustomVector (CustomVector &&v) noexcept | |
The move constructor for CustomVector. More... | |
Data access functions | |
Reference | operator[] (size_t index) noexcept |
Subscript operator for the direct access to the vector elements. More... | |
ConstReference | operator[] (size_t index) const noexcept |
Subscript operator for the direct access to the vector elements. More... | |
Reference | at (size_t index) |
Checked access to the vector elements. More... | |
ConstReference | at (size_t index) const |
Checked access to the vector elements. More... | |
Pointer | data () noexcept |
Low-level data access to the vector elements. More... | |
ConstPointer | data () const noexcept |
Low-level data access to the vector elements. More... | |
Iterator | begin () noexcept |
Returns an iterator to the first element of the custom vector. More... | |
ConstIterator | begin () const noexcept |
Returns an iterator to the first element of the custom vector. More... | |
ConstIterator | cbegin () const noexcept |
Returns an iterator to the first element of the custom vector. More... | |
Iterator | end () noexcept |
Returns an iterator just past the last element of the custom vector. More... | |
ConstIterator | end () const noexcept |
Returns an iterator just past the last element of the custom vector. More... | |
ConstIterator | cend () const noexcept |
Returns an iterator just past the last element of the custom vector. More... | |
Assignment operators | |
CustomVector & | operator= (const Type &rhs) |
Homogenous assignment to all vector elements. More... | |
CustomVector & | operator= (initializer_list< Type > list) |
List assignment to all vector elements. More... | |
template<typename Other , size_t N> | |
CustomVector & | operator= (const Other(&array)[N]) |
CustomVector & | operator= (const CustomVector &rhs) |
Copy assignment operator for CustomVector. More... | |
CustomVector & | operator= (CustomVector &&rhs) noexcept |
Move assignment operator for CustomVector. More... | |
template<typename VT > | |
CustomVector & | operator= (const Vector< VT, TF > &rhs) |
template<typename VT > | |
CustomVector & | operator+= (const Vector< VT, TF > &rhs) |
template<typename VT > | |
CustomVector & | operator-= (const Vector< VT, TF > &rhs) |
template<typename VT > | |
CustomVector & | operator*= (const Vector< VT, TF > &rhs) |
template<typename VT > | |
CustomVector & | operator/= (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
CustomVector & | operator%= (const Vector< VT, TF > &rhs) |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, CustomVector > & | operator*= (Other rhs) |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, CustomVector > & | operator/= (Other rhs) |
Utility functions | |
size_t | size () const noexcept |
Returns the 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 | reset () |
Reset to the default initial values. More... | |
void | clear () |
Clearing the vector to its default state. More... | |
void | swap (CustomVector &v) noexcept |
Swapping the contents of two vectors. More... | |
Numeric functions | |
template<typename Other > | |
CustomVector & | scale (const Other &scalar) |
Resource management functions | |
void | reset (Type *ptr, size_t n) |
Resets the custom vector and replaces the array of elements with the given array. More... | |
void | reset (Type *ptr, size_t n, size_t nn) |
Resets the custom vector and replaces the array of elements with the given array. More... | |
Expression template evaluation functions | |
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... | |
bool | isAligned () const noexcept |
Returns whether the vector is properly aligned in memory. More... | |
bool | canSMPAssign () const noexcept |
Returns whether the vector can be used in SMP assignments. More... | |
BLAZE_ALWAYS_INLINE SIMDType | load (size_t index) const noexcept |
Load of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE SIMDType | loada (size_t index) const noexcept |
Aligned load of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE SIMDType | loadu (size_t index) const noexcept |
Unaligned load of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE void | store (size_t index, const SIMDType &value) noexcept |
Store of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE void | storea (size_t index, const SIMDType &value) noexcept |
Aligned store of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE void | storeu (size_t index, const SIMDType &value) noexcept |
Unaligned store of a SIMD element of the vector. More... | |
BLAZE_ALWAYS_INLINE void | stream (size_t index, const SIMDType &value) noexcept |
Aligned, non-temporal store of a SIMD element of the vector. More... | |
template<typename VT > | |
DisableIf_< VectorizedAssign< VT > > | assign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
EnableIf_< VectorizedAssign< VT > > | assign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
void | assign (const SparseVector< VT, TF > &rhs) |
Default implementation of the assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf_< VectorizedAddAssign< VT > > | addAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
EnableIf_< VectorizedAddAssign< VT > > | addAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
void | addAssign (const SparseVector< VT, TF > &rhs) |
Default implementation of the addition assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf_< VectorizedSubAssign< VT > > | subAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
EnableIf_< VectorizedSubAssign< VT > > | subAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
void | subAssign (const SparseVector< VT, TF > &rhs) |
Default implementation of the subtraction assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf_< VectorizedMultAssign< VT > > | multAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
EnableIf_< VectorizedMultAssign< VT > > | multAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
void | multAssign (const SparseVector< VT, TF > &rhs) |
Default implementation of the multiplication assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf_< VectorizedDivAssign< VT > > | divAssign (const DenseVector< VT, TF > &rhs) |
template<typename VT > | |
EnableIf_< VectorizedDivAssign< VT > > | divAssign (const DenseVector< VT, TF > &rhs) |
Private Types | |
enum | : size_t { SIMDSIZE = SIMDTrait<ElementType>::size } |
The number of elements packed within a single SIMD element. | |
Private Attributes | |
Member variables | |
size_t | size_ |
The size/dimension of the custom vector. | |
Type * | v_ |
The custom array of elements. More... | |
Efficient implementation of a customizable vector.
The CustomVector class template provides the functionality to represent an external array of elements of arbitrary type and a fixed size as a native Blaze dense vector data structure. Thus in contrast to all other dense vector types a custom vector does not perform any kind of memory allocation by itself, but it is provided with an existing array of element during construction. A custom vector can therefore be considered an alias to the existing array.
The type of the elements, the properties of the given array of elements and the transpose flag of the vector can be specified via the following four template parameters:
The following examples give an impression of several possible types of custom vectors:
In comparison with the remaining Blaze dense vector types CustomVector has several special characteristics. All of these result from the fact that a custom vector is not performing any kind of memory allocation, but instead is given an existing array of elements. The following sections discuss all of these characteristics:
The CustomVector class template acts as an adaptor for an existing array of elements. As such it provides everything that is required to use the array just like a native Blaze dense vector data structure. However, this flexibility comes with the price that the user of a custom vector is responsible for the resource management.
The following examples give an impression of several possible types of custom vectors:
As with all dense vectors it is possible to copy construct a custom vector:
It is important to note that a custom vector acts as a reference to the specified array. Thus the result of the copy constructor is a new custom vector that is referencing and representing the same array as the original custom vector.
In contrast to copy construction, just as with references, copy assignment does not change which array is referenced by the custom vector, but modifies the values of the array:
In case the custom vector is specified as aligned the passed array must be guaranteed to be aligned according to the requirements of the used instruction set (SSE, AVX, ...). For instance, if AVX is active an array of integers must be 32-bit aligned:
In case the alignment requirements are violated, a std::invalid_argument exception is thrown.
Adding padding elements to the end of an array can have a significant impact on performance. For instance, assuming that AVX is available, then two aligned, padded, 3-dimensional vectors of double precision values can be added via a single SIMD addition operations:
In this example, maximum performance is possible. However, in case no padding elements are inserted, a scalar addition has to be used:
Note the different number of constructor parameters for unpadded and padded custom vectors: In contrast to unpadded vectors, where during the construction only the size of the array has to be specified, during the construction of a padded custom vector it is additionally necessary to explicitly specify the capacity of the array.
The number of padding elements is required to be sufficient with respect to the available instruction set: In case of an aligned padded custom vector the added padding elements must guarantee that the capacity is greater or equal than the size and a multiple of the SIMD vector width. In case of unaligned padded vectors the number of padding elements can be greater or equal the number of padding elements of an aligned padded custom vector. In case the padding is insufficient with respect to the available instruction set, a std::invalid_argument exception is thrown.
Please also note that Blaze will zero initialize the padding elements in order to achieve maximum performance!
The use of custom vectors in arithmetic operations is designed to be as natural and intuitive as possible. All operations (addition, subtraction, multiplication, scaling, ...) can be expressed similar to a text book representation. Also, custom vectors can be combined with all other dense and sparse vectors and matrices. The following example gives an impression of the use of CustomVector:
anonymous enum : bool |
Compilation flag for SIMD optimization.
The simdEnabled compilation flag indicates whether expressions the vector is involved in can be optimized via SIMD operations. 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.
anonymous enum : bool |
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).
|
inlineexplicit |
Constructor for an unpadded custom vector of size n.
ptr | The array of elements to be used by the vector. |
n | The number of array elements to be used by the custom vector. |
std::invalid_argument | Invalid setup of custom vector. |
This constructor creates an unpadded custom vector of size n. The construction fails if ...
nullptr
;In all failure cases a std::invalid_argument exception is thrown.
|
inlineexplicit |
Constructor for a padded custom vector of size n and capacity nn.
ptr | The array of elements to be used by the vector. |
n | The number of array elements to be used by the custom vector. |
nn | The maximum size of the given array. |
std::invalid_argument | Invalid setup of custom vector. |
This constructor creates a padded custom vector of size n and capacity nn. The construction fails if ...
nullptr
;In all failure cases a std::invalid_argument exception is thrown.
|
inline |
The copy constructor for CustomVector.
v | Vector to be copied. |
The copy constructor initializes the custom vector as an exact copy of the given custom vector.
|
inlinenoexcept |
The move constructor for CustomVector.
v | The vector to be moved into this instance. |
|
inline |
Default implementation of the addition assignment of a sparse vector.
rhs | The right-hand side sparse vector to be added. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the addition assignment of a dense vector.
rhs | The right-hand side dense vector to be added. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the addition assignment of a dense vector.
rhs | The right-hand side dense vector to be added. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the assignment of a sparse vector.
rhs | The right-hand side sparse vector to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the assignment of a dense vector.
rhs | The right-hand side dense vector to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the assignment of a dense vector.
rhs | The right-hand side dense vector to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
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.
|
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 custom vector.
|
inlinenoexcept |
Returns an iterator to the first element of the custom 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 whether the vector can be used in SMP assignments.
This function returns whether the vector can be used in SMP assignments. In contrast to the smpAssignable member enumeration, which is based solely on compile time information, this function additionally provides runtime information (as for instance the current size of the vector).
|
inlinenoexcept |
Returns the maximum capacity of the vector.
|
inlinenoexcept |
Returns an iterator to the first element of the custom vector.
|
inlinenoexcept |
Returns an iterator just past the last element of the custom vector.
|
inline |
Clearing the vector to its default state.
This function clears the vector to its default state. In case the vector has been passed the responsibility to manage the given array, it disposes the resource via the specified deleter.
|
inlinenoexcept |
Low-level data access to the vector elements.
This function returns a pointer to the internal storage of the custom vector.
|
inlinenoexcept |
Low-level data access to the vector elements.
This function returns a pointer to the internal storage of the custom vector.
|
inline |
Default implementation of the division assignment of a dense vector.
rhs | The right-hand side dense vector divisor. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the division assignment of a dense vector.
rhs | The right-hand side dense vector divisor. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inlinenoexcept |
Returns an iterator just past the last element of the custom vector.
|
inlinenoexcept |
Returns an iterator just past the last element of the custom 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.
|
inlinenoexcept |
Returns whether the vector is properly aligned in memory.
This function returns whether the vector is guaranteed to be properly aligned in memory, i.e. whether the beginning and the end of the vector are guaranteed to conform to the alignment restrictions of the element type Type.
|
noexcept |
Load of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
This function performs a load of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
noexcept |
Aligned load of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
This function performs an aligned load of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
noexcept |
Unaligned load of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
This function performs an unaligned load of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
inline |
Default implementation of the multiplication assignment of a sparse vector.
rhs | The right-hand side sparse vector to be multiplied. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the multiplication assignment of a dense vector.
rhs | The right-hand side dense vector to be multiplied. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the multiplication assignment of a dense vector.
rhs | The right-hand side dense vector to be multiplied. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Returns the number of non-zero elements in the vector.
Note that the number of non-zero elements is always less than or equal to the current size of the vector.
|
inline |
Cross product assignment operator for the multiplication of a vector ( ).
rhs | The right-hand side vector for the cross product. |
std::invalid_argument | Invalid vector size for cross product. |
In case the current size of any of the two vectors is not equal to 3, a std::invalid_argument exception is thrown.
|
inline |
Multiplication assignment operator for the multiplication of a vector ( ).
rhs | The right-hand side vector to be multiplied with the vector. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Multiplication assignment operator for the multiplication between a vector and a scalar value ( ).
rhs | The right-hand side scalar value for the multiplication. |
|
inline |
Addition assignment operator for the addition of a vector ( ).
rhs | The right-hand side vector to be added to the vector. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Subtraction assignment operator for the subtraction of a vector ( ).
rhs | The right-hand side vector to be subtracted from the vector. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Division assignment operator for the division of a dense vector ( ).
rhs | The right-hand side dense vector divisor. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Division assignment operator for the division of a vector by a scalar value ( ).
rhs | The right-hand side scalar value for the division. |
|
inline |
Homogenous assignment to all vector elements.
rhs | Scalar value to be assigned to all vector elements. |
|
inline |
List assignment to all vector elements.
list | The initializer list. |
std::invalid_argument | Invalid assignment to custom vector. |
This assignment operator offers the option to directly assign to all elements of the vector by means of an initializer list:
The vector elements are assigned the values from the given initializer list. Missing values are reset to their default state. Note that in case the size of the initializer list exceeds the size of the vector, a std::invalid_argument exception is thrown.
|
inline |
Copy assignment operator for CustomVector.
rhs | Vector to be copied. |
std::invalid_argument | Vector sizes do not match. |
The vector is initialized as a copy of the given vector. In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inlinenoexcept |
Move assignment operator for CustomVector.
rhs | The vector to be moved into this instance. |
|
inline |
Array assignment to all vector elements.
array | N-dimensional array for the assignment. |
std::invalid_argument | Invalid array size. |
This assignment operator offers the option to directly set all elements of the vector. The following example demonstrates this by means of an unaligned, unpadded custom vector:
The vector is assigned the values from the given array. Missing values are initialized with default values (as e.g. the fourth element in the example). Note that the size of the array must match the size of the custom vector. Otherwise a std::invalid_argument exception is thrown. Also note that after the assignment array will have the same entries as init.
|
inline |
Assignment operator for different vectors.
rhs | Vector to be copied. |
std::invalid_argument | Vector sizes do not match. |
The vector is initialized as a copy of the given vector. In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
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.
|
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.
|
inlinenoexceptinherited |
Conversion operator for non-constant vectors.
|
inlinenoexceptinherited |
Conversion operator for constant vectors.
|
inline |
Reset to the default initial values.
|
inline |
Resets the custom vector and replaces the array of elements with the given array.
ptr | The array of elements to be used by the vector. |
n | The number of array elements to be used by the custom vector. |
std::invalid_argument | Invalid setup of custom vector. |
This function resets the custom vector to the given array of elements of size n. The function fails if ...
nullptr
;In all failure cases a std::invalid_argument exception is thrown.
|
inline |
Resets the custom vector and replaces the array of elements with the given array.
ptr | The array of elements to be used by the vector. |
n | The number of array elements to be used by the custom vector. |
nn | The maximum size of the given array. |
std::invalid_argument | Invalid setup of custom vector. |
This function resets the custom vector to the given array of elements of size n and capacity nn. The function fails if ...
nullptr
;In all failure cases a std::invalid_argument exception is thrown.
|
inline |
Scaling of the vector by the scalar value scalar ( ).
scalar | The scalar value for the vector scaling. |
This function scales the vector by applying the given scalar value scalar to each element of the vector. For built-in and complex
data types it has the same effect as using the multiplication assignment operator:
|
inlinenoexcept |
Returns the 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.
|
noexcept |
Store of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
value | The SIMD element to be stored. |
This function performs a store of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
noexcept |
Aligned store of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
value | The SIMD element to be stored. |
This function performs an aligned store of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
noexcept |
Unaligned store of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
value | The SIMD element to be stored. |
This function performs an unaligned store of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
noexcept |
Aligned, non-temporal store of a SIMD element of the vector.
index | Access index. The index must be smaller than the number of vector elements. |
value | The SIMD element to be stored. |
This function performs an aligned, non-temporal store of a specific SIMD element of the dense vector. The index must be smaller than the number of vector elements and it must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.
|
inline |
Default implementation of the subtraction assignment of a sparse vector.
rhs | The right-hand side sparse vector to be subtracted. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the subtraction assignment of a dense vector.
rhs | The right-hand side dense vector to be subtracted. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the subtraction assignment of a dense vector.
rhs | The right-hand side dense vector to be subtracted. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inlinenoexcept |
Swapping the contents of two vectors.
v | The vector to be swapped. |
|
private |
The custom array of elements.
Access to the array of elements is gained via the subscript operator. The order of the elements is