Blaze  3.6
Classes | Public Types | Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
blaze::CustomVector< Type, AF, PF, TF, RT > Class Template Reference

Efficient implementation of a customizable vector. More...

#include <CustomVector.h>

Inherits blaze::DenseVector< CustomVector< Type, AF, PF, TF, RT >, 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

using This = CustomVector< Type, AF, PF, TF, RT >
 Type of this CustomVector instance.
 
using BaseType = DenseVector< This, TF >
 Base type of this CustomVector instance.
 
using ResultType = RT
 Result type for expression template evaluations.
 
using TransposeType = TransposeType_t< ResultType >
 Transpose type for expression template evaluations.
 
using ElementType = Type
 Type of the vector elements.
 
using SIMDType = SIMDTrait_t< 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 Dim>
CustomVector< Type, AF, PF, TF, RT > & operator= (const Other(&array)[Dim])
 Array assignment to all vector elements. More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator= (const Vector< VT, TF > &rhs)
 Assignment operator for different vectors. More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator+= (const Vector< VT, TF > &rhs)
 Addition assignment operator for the addition of a vector ( $ \vec{a}+=\vec{b} $). More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator-= (const Vector< VT, TF > &rhs)
 Subtraction assignment operator for the subtraction of a vector ( $ \vec{a}-=\vec{b} $). More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator *= (const Vector< VT, TF > &rhs)
 Multiplication assignment operator for the multiplication of a vector ( $ \vec{a}*=\vec{b} $). More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator/= (const DenseVector< VT, TF > &rhs)
 Division assignment operator for the division of a dense vector ( $ \vec{a}/=\vec{b} $). More...
 
template<typename VT >
CustomVector< Type, AF, PF, TF, RT > & operator%= (const Vector< VT, TF > &rhs)
 Cross product assignment operator for the multiplication of a vector ( $ \vec{a}\times=\vec{b} $). More...
 
template<typename Other >
CustomVector< Type, AF, PF, TF, RT > & scale (const Other &scalar)
 Scaling of the vector by the scalar value scalar ( $ \vec{a}=\vec{b}*s $). More...
 
BLAZE_ALWAYS_INLINE constexpr VectorTypeoperator~ () noexcept
 Conversion operator for non-constant vectors. More...
 
BLAZE_ALWAYS_INLINE constexpr const VectorTypeoperator~ () 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...
 
Destructor
 ~CustomVector ()=default
 
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
CustomVectoroperator= (const Type &rhs)
 Homogenous assignment to all vector elements. More...
 
CustomVectoroperator= (initializer_list< Type > list)
 List assignment to all vector elements. More...
 
template<typename Other , size_t Dim>
CustomVectoroperator= (const Other(&array)[Dim])
 
CustomVectoroperator= (const CustomVector &rhs)
 Copy assignment operator for CustomVector. More...
 
CustomVectoroperator= (CustomVector &&rhs) noexcept
 Move assignment operator for CustomVector. More...
 
template<typename VT >
CustomVectoroperator= (const Vector< VT, TF > &rhs)
 
template<typename VT >
CustomVectoroperator+= (const Vector< VT, TF > &rhs)
 
template<typename VT >
CustomVectoroperator-= (const Vector< VT, TF > &rhs)
 
template<typename VT >
CustomVectoroperator *= (const Vector< VT, TF > &rhs)
 
template<typename VT >
CustomVectoroperator/= (const DenseVector< VT, TF > &rhs)
 
template<typename VT >
CustomVectoroperator%= (const Vector< VT, TF > &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 >
CustomVectorscale (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 >
auto assign (const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
 Default implementation of the assignment of a dense vector. More...
 
template<typename VT >
auto assign (const DenseVector< VT, TF > &rhs) -> EnableIf_t< VectorizedAssign_v< VT > >
 
template<typename VT >
void assign (const SparseVector< VT, TF > &rhs)
 Default implementation of the assignment of a sparse vector. More...
 
template<typename VT >
auto addAssign (const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
 Default implementation of the addition assignment of a dense vector. More...
 
template<typename VT >
auto addAssign (const DenseVector< VT, TF > &rhs) -> EnableIf_t< VectorizedAddAssign_v< VT > >
 
template<typename VT >
void addAssign (const SparseVector< VT, TF > &rhs)
 Default implementation of the addition assignment of a sparse vector. More...
 
template<typename VT >
auto subAssign (const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
 Default implementation of the subtraction assignment of a dense vector. More...
 
template<typename VT >
auto subAssign (const DenseVector< VT, TF > &rhs) -> EnableIf_t< VectorizedSubAssign_v< VT > >
 
template<typename VT >
void subAssign (const SparseVector< VT, TF > &rhs)
 Default implementation of the subtraction assignment of a sparse vector. More...
 
template<typename VT >
auto multAssign (const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
 Default implementation of the multiplication assignment of a dense vector. More...
 
template<typename VT >
auto multAssign (const DenseVector< VT, TF > &rhs) -> EnableIf_t< VectorizedMultAssign_v< VT > >
 
template<typename VT >
void multAssign (const SparseVector< VT, TF > &rhs)
 Default implementation of the multiplication assignment of a sparse vector. More...
 
template<typename VT >
auto divAssign (const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
 Default implementation of the division assignment of a dense vector. More...
 
template<typename VT >
auto divAssign (const DenseVector< VT, TF > &rhs) -> EnableIf_t< VectorizedDivAssign_v< VT > >
 

Static Public Attributes

static constexpr bool simdEnabled = IsVectorizable_v<Type>
 Compilation flag for SIMD optimization. More...
 
static constexpr bool smpAssignable = !IsSMPAssignable_v<Type>
 Compilation flag for SMP assignments. More...
 
static constexpr bool transposeFlag = TF
 Transpose flag of the vector.
 

Private Attributes

Member variables
size_t size_
 The size/dimension of the custom vector.
 
Type * v_
 The custom array of elements. More...
 

Static Private Attributes

static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size
 The number of elements packed within a single SIMD element.
 

Detailed Description

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
class blaze::CustomVector< Type, AF, PF, TF, RT >

Efficient implementation of a customizable vector.

General

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:

template< typename Type, bool AF, bool PF, bool TF >

The following examples give an impression of several possible types of custom vectors:

// Definition of a custom column vector for unaligned, unpadded integer arrays
using UnalignedUnpadded = CustomVector<int,unaligned,unpadded,columnVector>;
// Definition of a custom column vector for unaligned but padded 'float' arrays
using UnalignedPadded = CustomVector<float,unaligned,padded,columnVector>;
// Definition of a custom row vector for aligned, unpadded 'double' arrays
using AlignedUnpadded = CustomVector<double,aligned,unpadded,rowVector>;
// Definition of a custom row vector for aligned, padded 'complex<double>' arrays
using AlignedPadded = CustomVector<complex<double>,aligned,padded,rowVector>;


Special Properties 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:

  1. Memory Management
  2. Copy Operations
  3. Alignment
  4. Padding


Memory Management

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:

// Definition of a 3-dimensional custom vector with unaligned, unpadded and externally
// managed integer array. Note that the std::vector must be guaranteed to outlive the
// custom vector!
std::vector<int> vec( 3UL );
CustomVector<int,unaligned,unpadded> a( &vec[0], 3UL );
// Definition of a custom vector with size 3 and capacity 16 with aligned, padded and
// externally managed integer array. Note that the std::unique_ptr must be guaranteed
// to outlive the custom vector!
std::unique_ptr<int[],Deallocate> memory( allocate<int>( 16UL ) );
CustomVector<int,aligned,padded> b( memory.get(), 3UL, 16UL );


Copy Operations

As with all dense vectors it is possible to copy construct a custom vector:

using CustomType = CustomVector<int,unaligned,unpadded>;
std::vector<int> vec( 5UL, 10 ); // Vector of 5 integers of the value 10
CustomType a( &vec[0], 5UL ); // Represent the std::vector as Blaze dense vector
a[1] = 20; // Also modifies the std::vector
CustomType b( a ); // Creating a copy of vector a
b[2] = 20; // Also affects vector a and the std::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:

std::vector<int> vec2( 5UL, 4 ); // Vector of 5 integers of the value 4
CustomType c( &vec2[0], 5UL ); // Represent the std::vector as Blaze dense vector
a = c; // Copy assignment: Set all values of vector a and b to 4.


Alignment

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:

// Allocation of 32-bit aligned memory
std::unique_ptr<int[],Deallocate> memory( allocate<int>( 5UL ) );
CustomVector<int,aligned,unpadded> a( memory.get(), 5UL );

In case the alignment requirements are violated, a std::invalid_argument exception is thrown.


Padding

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:

using CustomType = CustomVector<double,aligned,padded>;
std::unique_ptr<int[],Deallocate> memory1( allocate<double>( 4UL ) );
std::unique_ptr<int[],Deallocate> memory2( allocate<double>( 4UL ) );
std::unique_ptr<int[],Deallocate> memory3( allocate<double>( 4UL ) );
// Creating padded custom vectors of size 3 and a capacity of 4
CustomType a( memory1.get(), 3UL, 4UL );
CustomType b( memory2.get(), 3UL, 4UL );
CustomType c( memory3.get(), 3UL, 4UL );
// ... Initialization
c = a + b; // AVX-based vector addition

In this example, maximum performance is possible. However, in case no padding elements are inserted, a scalar addition has to be used:

using CustomType = CustomVector<double,aligned,unpadded>;
std::unique_ptr<int[],Deallocate> memory1( allocate<double>( 3UL ) );
std::unique_ptr<int[],Deallocate> memory2( allocate<double>( 3UL ) );
std::unique_ptr<int[],Deallocate> memory3( allocate<double>( 3UL ) );
// Creating unpadded custom vector of size 3
CustomType a( allocate<double>( 3UL ), 3UL );
CustomType b( allocate<double>( 3UL ), 3UL );
CustomType c( allocate<double>( 3UL ), 3UL );
// ... Initialization
c = a + b; // Scalar vector addition

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!


Arithmetic Operations

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:

// Non-initialized custom column vector of size 2. All given arrays are considered to be
// unaligned and unpadded. The memory is managed via a 'std::vector'.
std::vector<double> memory1( 2UL );
CustomVector<double,unaligned,unpadded> a( memory1.data(), 2UL );
a[0] = 1.0; // Initialization of the first element
a[1] = 2.0; // Initialization of the second element
// Non-initialized custom column vector of size 2 and capacity 4. All given arrays are required
// to be properly aligned and padded. The memory is managed via a 'std::unique_ptr'.
std::unique_ptr<int[],Deallocate> memory2( allocate<double>( 4UL ) );
CustomVector<double,aligned,padded> b( memory2.get(), 2UL, 4UL );
b = 2.0; // Homogeneous initialization of all elements
CompressedVector<float> c( 2 ); // Empty sparse single precision vector
DynamicVector<double> d; // Default constructed dynamic vector
DynamicMatrix<double> A; // Default constructed row-major matrix
d = a + b; // Vector addition between custom vectors of equal element type
d = a - c; // Vector subtraction between a dense and sparse vector with different element types
d = a * b; // Component-wise vector multiplication
a *= 2.0; // In-place scaling of vector
d = a * 2.0; // Scaling of vector a
d = 2.0 * a; // Scaling of vector a
d += a - b; // Addition assignment
d -= a + c; // Subtraction assignment
d *= a * b; // Multiplication assignment
double scalar = trans( a ) * b; // Scalar/dot/inner product between two vectors
A = a * trans( b ); // Outer product between two vectors

Constructor & Destructor Documentation

◆ CustomVector() [1/4]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
blaze::CustomVector< Type, AF, PF, TF, RT >::CustomVector ( Type *  ptr,
size_t  n 
)
inlineexplicit

Constructor for an unpadded custom vector of size n.

Parameters
ptrThe array of elements to be used by the vector.
nThe number of array elements to be used by the custom vector.
Exceptions
std::invalid_argumentInvalid setup of custom vector.

This constructor creates an unpadded custom vector of size n. The construction fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...).

In all failure cases a std::invalid_argument exception is thrown.

Note
This constructor is NOT available for padded custom vectors!
The custom vector does NOT take responsibility for the given array of elements!

◆ CustomVector() [2/4]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
blaze::CustomVector< Type, AF, PF, TF, RT >::CustomVector ( Type *  ptr,
size_t  n,
size_t  nn 
)
inlineexplicit

Constructor for a padded custom vector of size n and capacity nn.

Parameters
ptrThe array of elements to be used by the vector.
nThe number of array elements to be used by the custom vector.
nnThe maximum size of the given array.
Exceptions
std::invalid_argumentInvalid setup of custom vector.

This constructor creates a padded custom vector of size n and capacity nn. The construction fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...);
  • ... the specified capacity nn is insufficient for the given data type Type and the available instruction set.

In all failure cases a std::invalid_argument exception is thrown.

Note
This constructor is NOT available for unpadded custom vectors!
The custom vector does NOT take responsibility for the given array of elements!

◆ CustomVector() [3/4]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
blaze::CustomVector< Type, AF, PF, TF, RT >::CustomVector ( const CustomVector< Type, AF, PF, TF, RT > &  v)
inline

The copy constructor for CustomVector.

Parameters
vVector to be copied.

The copy constructor initializes the custom vector as an exact copy of the given custom vector.

◆ CustomVector() [4/4]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
blaze::CustomVector< Type, AF, PF, TF, RT >::CustomVector ( CustomVector< Type, AF, PF, TF, RT > &&  v)
inlinenoexcept

The move constructor for CustomVector.

Parameters
vThe vector to be moved into this instance.

Member Function Documentation

◆ addAssign() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
auto blaze::CustomVector< Type, AF, PF, TF, RT >::addAssign ( const DenseVector< VT, TF > &  rhs) -> DisableIf_t< VectorizedAddAssign_v<VT> >
inline

Default implementation of the addition assignment of a dense vector.

SIMD optimized implementation of the addition assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be added.
Returns
void

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.

◆ addAssign() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::addAssign ( const SparseVector< VT, TF > &  rhs)
inline

Default implementation of the addition assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be added.
Returns
void

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.

◆ assign() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
auto blaze::CustomVector< Type, AF, PF, TF, RT >::assign ( const DenseVector< VT, TF > &  rhs) -> DisableIf_t< VectorizedAssign_v<VT> >
inline

Default implementation of the assignment of a dense vector.

SIMD optimized implementation of the assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be assigned.
Returns
void

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.

◆ assign() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::assign ( const SparseVector< VT, TF > &  rhs)
inline

Default implementation of the assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be assigned.
Returns
void

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.

◆ at() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::Reference blaze::CustomVector< Type, AF, PF, TF, RT >::at ( size_t  index)
inline

Checked access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::out_of_rangeInvalid vector access index.

In contrast to the subscript operator this function always performs a check of the given access index.

◆ at() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstReference blaze::CustomVector< Type, AF, PF, TF, RT >::at ( size_t  index) const
inline

Checked access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::out_of_rangeInvalid vector access index.

In contrast to the subscript operator this function always performs a check of the given access index.

◆ begin() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::Iterator blaze::CustomVector< Type, AF, PF, TF, RT >::begin ( )
inlinenoexcept

Returns an iterator to the first element of the custom vector.

Returns
Iterator to the first element of the custom vector.

◆ begin() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstIterator blaze::CustomVector< Type, AF, PF, TF, RT >::begin ( ) const
inlinenoexcept

Returns an iterator to the first element of the custom vector.

Returns
Iterator to the first element of the custom vector.

◆ canAlias()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename Other >
bool blaze::CustomVector< Type, AF, PF, TF, RT >::canAlias ( const Other *  alias) const
inlinenoexcept

Returns whether the vector can alias with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this vector, false if not.

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.

◆ canSMPAssign()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
bool blaze::CustomVector< Type, AF, PF, TF, RT >::canSMPAssign ( ) const
inlinenoexcept

Returns whether the vector can be used in SMP assignments.

Returns
true in case the vector can be used in SMP assignments, false if not.

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).

◆ capacity()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
size_t blaze::CustomVector< Type, AF, PF, TF, RT >::capacity ( ) const
inlinenoexcept

Returns the maximum capacity of the vector.

Returns
The maximum capacity of the vector.

◆ cbegin()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstIterator blaze::CustomVector< Type, AF, PF, TF, RT >::cbegin ( ) const
inlinenoexcept

Returns an iterator to the first element of the custom vector.

Returns
Iterator to the first element of the custom vector.

◆ cend()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstIterator blaze::CustomVector< Type, AF, PF, TF, RT >::cend ( ) const
inlinenoexcept

Returns an iterator just past the last element of the custom vector.

Returns
Iterator just past the last element of the custom vector.

◆ clear()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::clear ( )
inline

Clearing the vector to its default state.

Returns
void

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.

◆ data() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::Pointer blaze::CustomVector< Type, AF, PF, TF, RT >::data ( )
inlinenoexcept

Low-level data access to the vector elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the custom vector.

◆ data() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstPointer blaze::CustomVector< Type, AF, PF, TF, RT >::data ( ) const
inlinenoexcept

Low-level data access to the vector elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the custom vector.

◆ divAssign()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
auto blaze::CustomVector< Type, AF, PF, TF, RT >::divAssign ( const DenseVector< VT, TF > &  rhs) -> DisableIf_t< VectorizedDivAssign_v<VT> >
inline

Default implementation of the division assignment of a dense vector.

SIMD optimized implementation of the division assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector divisor.
Returns
void

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.

◆ end() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::Iterator blaze::CustomVector< Type, AF, PF, TF, RT >::end ( )
inlinenoexcept

Returns an iterator just past the last element of the custom vector.

Returns
Iterator just past the last element of the custom vector.

◆ end() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstIterator blaze::CustomVector< Type, AF, PF, TF, RT >::end ( ) const
inlinenoexcept

Returns an iterator just past the last element of the custom vector.

Returns
Iterator just past the last element of the custom vector.

◆ isAliased()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename Other >
bool blaze::CustomVector< Type, AF, PF, TF, RT >::isAliased ( const Other *  alias) const
inlinenoexcept

Returns whether the vector is aliased with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this vector, false if not.

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.

◆ isAligned()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
bool blaze::CustomVector< Type, AF, PF, TF, RT >::isAligned ( ) const
inlinenoexcept

Returns whether the vector is properly aligned in memory.

Returns
true in case the vector is aligned, false if not.

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.

◆ load()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE CustomVector< Type, AF, PF, TF, RT >::SIMDType blaze::CustomVector< Type, AF, PF, TF, RT >::load ( size_t  index) const
noexcept

Load of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
Returns
The loaded SIMD element.

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.

◆ loada()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE CustomVector< Type, AF, PF, TF, RT >::SIMDType blaze::CustomVector< Type, AF, PF, TF, RT >::loada ( size_t  index) const
noexcept

Aligned load of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
Returns
The loaded SIMD element.

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.

◆ loadu()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE CustomVector< Type, AF, PF, TF, RT >::SIMDType blaze::CustomVector< Type, AF, PF, TF, RT >::loadu ( size_t  index) const
noexcept

Unaligned load of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
Returns
The loaded SIMD element.

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.

◆ multAssign() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
auto blaze::CustomVector< Type, AF, PF, TF, RT >::multAssign ( const DenseVector< VT, TF > &  rhs) -> DisableIf_t< VectorizedMultAssign_v<VT> >
inline

Default implementation of the multiplication assignment of a dense vector.

SIMD optimized implementation of the multiplication assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be multiplied.
Returns
void

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.

◆ multAssign() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::multAssign ( const SparseVector< VT, TF > &  rhs)
inline

Default implementation of the multiplication assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be multiplied.
Returns
void

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.

◆ nonZeros()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
size_t blaze::CustomVector< Type, AF, PF, TF, RT >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the vector.

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.

◆ operator *=()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator *= ( const Vector< VT, TF > &  rhs)
inline

Multiplication assignment operator for the multiplication of a vector ( $ \vec{a}*=\vec{b} $).

Parameters
rhsThe right-hand side vector to be multiplied with the vector.
Returns
Reference to the vector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

◆ operator%=()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator%= ( const Vector< VT, TF > &  rhs)
inline

Cross product assignment operator for the multiplication of a vector ( $ \vec{a}\times=\vec{b} $).

Parameters
rhsThe right-hand side vector for the cross product.
Returns
Reference to the vector.
Exceptions
std::invalid_argumentInvalid 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.

◆ operator+=()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator+= ( const Vector< VT, TF > &  rhs)
inline

Addition assignment operator for the addition of a vector ( $ \vec{a}+=\vec{b} $).

Parameters
rhsThe right-hand side vector to be added to the vector.
Returns
Reference to the vector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

◆ operator-=()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator-= ( const Vector< VT, TF > &  rhs)
inline

Subtraction assignment operator for the subtraction of a vector ( $ \vec{a}-=\vec{b} $).

Parameters
rhsThe right-hand side vector to be subtracted from the vector.
Returns
Reference to the vector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

◆ operator/=()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator/= ( const DenseVector< VT, TF > &  rhs)
inline

Division assignment operator for the division of a dense vector ( $ \vec{a}/=\vec{b} $).

Parameters
rhsThe right-hand side dense vector divisor.
Returns
Reference to the vector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

◆ operator=() [1/6]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT > & blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( const Type &  rhs)
inline

Homogenous assignment to all vector elements.

Parameters
rhsScalar value to be assigned to all vector elements.
Returns
Reference to the assigned vector.

◆ operator=() [2/6]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT > & blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( initializer_list< Type >  list)
inline

List assignment to all vector elements.

Parameters
listThe initializer list.
Exceptions
std::invalid_argumentInvalid 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:

using blaze::unaliged;
const int array[4] = { 1, 2, 3, 4 };
CustomVector<double,unaligned,unpadded> v( array, 4UL );
v = { 5, 6, 7 };

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.

◆ operator=() [3/6]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT > & blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( const CustomVector< Type, AF, PF, TF, RT > &  rhs)
inline

Copy assignment operator for CustomVector.

Parameters
rhsVector to be copied.
Returns
Reference to the assigned vector.
Exceptions
std::invalid_argumentVector 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.

◆ operator=() [4/6]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT > & blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( CustomVector< Type, AF, PF, TF, RT > &&  rhs)
inlinenoexcept

Move assignment operator for CustomVector.

Parameters
rhsThe vector to be moved into this instance.
Returns
Reference to the assigned vector.

◆ operator=() [5/6]

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename Other , size_t Dim>
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( const Other(&)  array[Dim])
inline

Array assignment to all vector elements.

Parameters
arrayN-dimensional array for the assignment.
Returns
Reference to the assigned vector.
Exceptions
std::invalid_argumentInvalid 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:

using blaze::unaliged;
const int array[4] = { 1, 2, 3, 4 };
const int init[4] = { 5, 6, 7 };
CustomVector<double,unaligned,unpadded> v( array, 4UL );
v = init;

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.

◆ operator=() [6/6]

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename VT >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::operator= ( const Vector< VT, TF > &  rhs)
inline

Assignment operator for different vectors.

Parameters
rhsVector to be copied.
Returns
Reference to the assigned vector.
Exceptions
std::invalid_argumentVector 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.

◆ operator[]() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::Reference blaze::CustomVector< Type, AF, PF, TF, RT >::operator[] ( size_t  index)
inlinenoexcept

Subscript operator for the direct access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.

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.

◆ operator[]() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
CustomVector< Type, AF, PF, TF, RT >::ConstReference blaze::CustomVector< Type, AF, PF, TF, RT >::operator[] ( size_t  index) const
inlinenoexcept

Subscript operator for the direct access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.

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.

◆ operator~() [1/2]

template<typename VT, bool TF>
BLAZE_ALWAYS_INLINE constexpr VectorType& blaze::Vector< VT, TF >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant vectors.

Returns
Reference of the actual type of the vector.

◆ operator~() [2/2]

template<typename VT, bool TF>
BLAZE_ALWAYS_INLINE constexpr const VectorType& blaze::Vector< VT, TF >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant vectors.

Returns
Const reference of the actual type of the vector.

◆ reset() [1/3]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::reset ( )
inline

Reset to the default initial values.

Returns
void

◆ reset() [2/3]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::reset ( Type *  ptr,
size_t  n 
)
inline

Resets the custom vector and replaces the array of elements with the given array.

Parameters
ptrThe array of elements to be used by the vector.
nThe number of array elements to be used by the custom vector.
Returns
void
Exceptions
std::invalid_argumentInvalid setup of custom vector.

This function resets the custom vector to the given array of elements of size n. The function fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...).

In all failure cases a std::invalid_argument exception is thrown.

Note
This function is NOT available for padded custom vectors!
In case a deleter was specified, the previously referenced array will only be destroyed when the last custom vector referencing the array goes out of scope.
The custom vector does NOT take responsibility for the new array of elements!

◆ reset() [3/3]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::reset ( Type *  ptr,
size_t  n,
size_t  nn 
)
inline

Resets the custom vector and replaces the array of elements with the given array.

Parameters
ptrThe array of elements to be used by the vector.
nThe number of array elements to be used by the custom vector.
nnThe maximum size of the given array.
Returns
void
Exceptions
std::invalid_argumentInvalid 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 ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...);
  • ... the specified capacity nn is insufficient for the given data type Type and the available instruction set.

In all failure cases a std::invalid_argument exception is thrown.

Note
This function is NOT available for unpadded custom vectors!
In case a deleter was specified, the previously referenced array will only be destroyed when the last custom vector referencing the array goes out of scope.
The custom vector does NOT take responsibility for the new array of elements!

◆ scale()

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
template<typename Other >
CustomVector<Type,AF,PF,TF,RT>& blaze::CustomVector< Type, AF, PF, TF, RT >::scale ( const Other &  scalar)
inline

Scaling of the vector by the scalar value scalar ( $ \vec{a}=\vec{b}*s $).

Parameters
scalarThe scalar value for the vector scaling.
Returns
Reference to the vector.

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:

using blaze::unaliged;
CustomVector<double,unaligned,unpadded> v( ... );
a *= 4; // Scaling of the vector
a.scale( 4 ); // Same effect as above

◆ size()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
size_t blaze::CustomVector< Type, AF, PF, TF, RT >::size ( ) const
inlinenoexcept

Returns the size/dimension of the vector.

Returns
The size of the vector.

◆ spacing()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
size_t blaze::CustomVector< Type, AF, PF, TF, RT >::spacing ( ) const
inlinenoexcept

Returns the minimum capacity of the vector.

Returns
The minimum capacity of the vector.

This function returns the minimum capacity of the vector, which corresponds to the current size plus padding.

◆ store()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomVector< Type, AF, PF, TF, RT >::store ( size_t  index,
const SIMDType value 
)
noexcept

Store of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
valueThe SIMD element to be stored.
Returns
void

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.

◆ storea()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomVector< Type, AF, PF, TF, RT >::storea ( size_t  index,
const SIMDType value 
)
noexcept

Aligned store of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
valueThe SIMD element to be stored.
Returns
void

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.

◆ storeu()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomVector< Type, AF, PF, TF, RT >::storeu ( size_t  index,
const SIMDType value 
)
noexcept

Unaligned store of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
valueThe SIMD element to be stored.
Returns
void

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.

◆ stream()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomVector< Type, AF, PF, TF, RT >::stream ( size_t  index,
const SIMDType value 
)
noexcept

Aligned, non-temporal store of a SIMD element of the vector.

Parameters
indexAccess index. The index must be smaller than the number of vector elements.
valueThe SIMD element to be stored.
Returns
void

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.

◆ subAssign() [1/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
auto blaze::CustomVector< Type, AF, PF, TF, RT >::subAssign ( const DenseVector< VT, TF > &  rhs) -> DisableIf_t< VectorizedSubAssign_v<VT> >
inline

Default implementation of the subtraction assignment of a dense vector.

SIMD optimized implementation of the subtraction assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be subtracted.
Returns
void

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.

◆ subAssign() [2/2]

template<typename Type , bool AF, bool PF, bool TF, typename RT >
template<typename VT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::subAssign ( const SparseVector< VT, TF > &  rhs)
inline

Default implementation of the subtraction assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be subtracted.
Returns
void

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.

◆ swap()

template<typename Type , bool AF, bool PF, bool TF, typename RT >
void blaze::CustomVector< Type, AF, PF, TF, RT >::swap ( CustomVector< Type, AF, PF, TF, RT > &  v)
inlinenoexcept

Swapping the contents of two vectors.

Parameters
vThe vector to be swapped.
Returns
void

Member Data Documentation

◆ simdEnabled

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
constexpr bool blaze::CustomVector< Type, AF, PF, TF, RT >::simdEnabled = IsVectorizable_v<Type>
static

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.

◆ smpAssignable

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
constexpr bool blaze::CustomVector< Type, AF, PF, TF, RT >::smpAssignable = !IsSMPAssignable_v<Type>
static

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).

◆ v_

template<typename Type, bool AF, bool PF, bool TF = defaultTransposeFlag, typename RT = DynamicVector<RemoveConst_t<Type>,TF>>
Type* blaze::CustomVector< Type, AF, PF, TF, RT >::v_
private

The custom array of elements.

Access to the array of elements is gained via the subscript operator. The order of the elements is

\[\left(\begin{array}{*{5}{c}} 0 & 1 & 2 & \cdots & N-1 \\ \end{array}\right)\]


The documentation for this class was generated from the following file: