Blaze 3.9
Modules | Classes

Modules

 Dense Vectors
 
 Sparse Vectors
 

Classes

class  blaze::Vector< VT, TF >
 Base class for N-dimensional vectors. More...
 

Vector global functions

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::begin (Vector< VT, TF > &vector)
 Returns an iterator to the first element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::begin (const Vector< VT, TF > &vector)
 Returns an iterator to the first element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::cbegin (const Vector< VT, TF > &vector)
 Returns an iterator to the first element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::end (Vector< VT, TF > &vector)
 Returns an iterator just past the last element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::end (const Vector< VT, TF > &vector)
 Returns an iterator just past the last element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::cend (const Vector< VT, TF > &vector)
 Returns an iterator just past the last element of the given vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE constexpr size_t blaze::size (const Vector< VT, TF > &vector) noexcept
 Returns the current size/dimension of the vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE size_t blaze::capacity (const Vector< VT, TF > &vector) noexcept
 Returns the maximum capacity of the vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE size_t blaze::nonZeros (const Vector< VT, TF > &vector)
 Returns the number of non-zero elements in the vector. More...
 
template<typename VT , bool TF>
constexpr void blaze::reset (Vector< VT, TF > &vector)
 Resetting the given vector. More...
 
template<typename VT , bool TF>
constexpr void blaze::reset (Vector< VT, TF > &&vector)
 Resetting the given temporary vector. More...
 
template<typename VT , bool TF>
constexpr void blaze::clear (Vector< VT, TF > &vector)
 Clearing the given vector. More...
 
template<typename VT , bool TF>
constexpr void blaze::clear (Vector< VT, TF > &&vector)
 Clearing the given temporary vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE void blaze::resize (Vector< VT, TF > &vector, size_t n, bool preserve)
 Changing the size of the vector. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE void blaze::shrinkToFit (Vector< VT, TF > &vector)
 Requesting the removal of unused capacity. More...
 
template<typename VT , bool TF>
VT::ResultType blaze::evaluate (const Vector< VT, TF > &vector)
 Evaluates the given vector expression. More...
 
template<bool B, typename VT , bool TF>
decltype(auto) blaze::evaluateIf (const Vector< VT, TF > &vector)
 Conditional evaluation of the given vector expression. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE constexpr bool blaze::isEmpty (const Vector< VT, TF > &vector) noexcept
 Checks if the given vector is empty. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
BLAZE_ALWAYS_INLINE bool blaze::isSame (const Vector< VT1, TF1 > &a, const Vector< VT2, TF2 > &b) noexcept
 Returns whether the two given vectors represent the same observable state. More...
 

Vector functions

template<typename VT , bool TF>
bool blaze::isUniform (const Vector< VT, TF > &v)
 Checks if the given vector is a uniform vector. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::inner (const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
 Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $). More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::dot (const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
 Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $). More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::operator, (const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
 Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $). More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::outer (const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
 Outer product of two vectors ( $ A=\vec{b}*\vec{c}^T $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::cross (const Vector< VT1, TF > &lhs, const Vector< VT2, TF > &rhs)
 Cross product of two vectors ( $ \vec{a}=\vec{b} \times \vec{c} $). More...
 
template<typename VT >
decltype(auto) blaze::reverse (VT &&v)
 Reverse the elements of a vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::pow2 (const Vector< VT, TF > &v)
 Computes the square for each single element of the vector v. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::pow3 (const Vector< VT, TF > &v)
 Computes the cube for each single element of the vector v. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::pow4 (const Vector< VT, TF > &v)
 Computes the quadruple for each single element of the vector v. More...
 

Vector operators

template<typename VT , bool TF>
std::ostream & blaze::operator<< (std::ostream &os, const Vector< VT, TF > &v)
 Global output operator for dense and sparse vectors. More...
 

Detailed Description

Function Documentation

◆ begin() [1/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::begin ( const Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator to the first element of the given vector.

◆ begin() [2/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::begin ( Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator to the first element of the given vector.

◆ capacity()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE size_t blaze::capacity ( const Vector< VT, TF > &  vector)
noexcept

Returns the maximum capacity of the vector.

Parameters
vectorThe given vector.
Returns
The capacity of the vector.

◆ cbegin()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::cbegin ( const Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator to the first element of the given vector.

◆ cend()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::cend ( const Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator just past the last element of the given vector.

◆ clear() [1/2]

template<typename VT , bool TF>
constexpr void blaze::clear ( Vector< VT, TF > &&  vector)
constexpr

Clearing the given temporary vector.

Parameters
vectorThe temporary vector to be cleared.
Returns
void

◆ clear() [2/2]

template<typename VT , bool TF>
constexpr void blaze::clear ( Vector< VT, TF > &  vector)
constexpr

Clearing the given vector.

Parameters
vectorThe vector to be cleared.
Returns
void

◆ cross()

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::cross ( const Vector< VT1, TF > &  lhs,
const Vector< VT2, TF > &  rhs 
)
inline

Cross product of two vectors ( $ \vec{a}=\vec{b} \times \vec{c} $).

Parameters
lhsThe left-hand side vector for the cross product.
rhsThe right-hand side vector for the cross product.
Returns
The cross product of the two vectors.
Exceptions
std::invalid_argumentInvalid vector size for cross product.

This function computes the cross product of two vectors:

blaze::DynamicVector<double> a( 3UL ), b( 3UL );
// ... Resizing and initialization
c = cross( a, b );
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
Efficient implementation of a fixed-sized vector.
Definition: StaticVector.h:230
decltype(auto) cross(const Vector< VT1, TF > &lhs, const Vector< VT2, TF > &rhs)
Cross product of two vectors ( ).
Definition: Vector.h:387

The function returns an expression representing a dense vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the CrossTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ dot()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::dot ( const Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
)
inline

Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $).

Parameters
lhsThe left-hand side vector for the scalar product.
rhsThe right-hand side vector for the scalar product.
Returns
The scalar product.

This function represents the scalar product (inner product) of two vectors:

blaze::double res;
// ... Resizing and initialization
res = dot( a, b );
decltype(auto) dot(const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Scalar product (dot/inner product) of two vectors ( ).
Definition: Vector.h:283

The function returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ end() [1/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::end ( const Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator just past the last element of the given vector.

◆ end() [2/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::end ( Vector< VT, TF > &  vector)

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

Parameters
vectorThe given dense or sparse vector.
Returns
Iterator just past the last element of the given vector.

◆ evaluate()

template<typename VT , bool TF>
VT::ResultType blaze::evaluate ( const Vector< VT, TF > &  vector)
inline

Evaluates the given vector expression.

Parameters
vectorThe vector to be evaluated.
Returns
The result of the evaluated vector expression.

This function forces an evaluation of the given vector expression and enables an automatic deduction of the correct result type of an operation. The following code example demonstrates its intended use for the multiplication of a dense and a sparse vector:

// ... Resizing and initialization
auto c = evaluate( a * b );
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
MT::ResultType evaluate(const Matrix< MT, SO > &matrix)
Evaluates the given matrix expression.
Definition: Matrix.h:1282

In this scenario, the evaluate() function assists in deducing the exact result type of the operation via the 'auto' keyword. Please note that if evaluate() is used in this way, no temporary vector is created and no copy operation is performed. Instead, the result is directly written to the target vector due to the return value optimization (RVO). However, if evaluate() is used in combination with an explicit target type, a temporary will be created and a copy operation will be performed if the used type differs from the type returned from the function:

CompressedVector<double> d( a * b ); // No temporary & no copy operation
DynamicVector<double> e( a * b ); // Temporary & copy operation
d = evaluate( a * b ); // Temporary & copy operation

Sometimes it might be desirable to explicitly evaluate a sub-expression within a larger expression. However, please note that evaluate() is not intended to be used for this purpose. This task is more elegantly and efficiently handled by the eval() function:

d = a + evaluate( b * c ); // Unnecessary creation of a temporary vector
d = a + eval( b * c ); // No creation of a temporary vector
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:790

In contrast to the evaluate() function, eval() can take the complete expression into account and therefore can guarantee the most efficient way to evaluate it.

◆ evaluateIf()

template<bool B, typename VT , bool TF>
decltype(auto) blaze::evaluateIf ( const Vector< VT, TF > &  vector)
inline

Conditional evaluation of the given vector expression.

Parameters
vectorThe vector to be evaluated.
Returns
The result of the evaluated vector expression.

In case the given compile time condition evaluates to true, this function evaluates the the given vector expression by means of the evaluate() function. Otherwise the function returns a reference to the given vector expression.

◆ inner()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::inner ( const Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
)
inline

Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $).

Parameters
lhsThe left-hand side vector for the scalar product.
rhsThe right-hand side vector for the scalar product.
Returns
The scalar product.

This function represents the scalar product (inner product) of two vectors:

blaze::double res;
// ... Resizing and initialization
res = inner( a, b );
decltype(auto) inner(const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Scalar product (dot/inner product) of two vectors ( ).
Definition: Vector.h:248

The function returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ isEmpty()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE constexpr bool blaze::isEmpty ( const Vector< VT, TF > &  vector)
constexprnoexcept

Checks if the given vector is empty.

Parameters
vectorThe vector to be checked.
Returns
true if the vector is empty, false if not.

This function checks if the total number of elements of the given vector is zero. If the total number of elements is zero the function returns true, otherwise it returns false.

◆ isSame()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
BLAZE_ALWAYS_INLINE bool blaze::isSame ( const Vector< VT1, TF1 > &  a,
const Vector< VT2, TF2 > &  b 
)
noexcept

Returns whether the two given vectors represent the same observable state.

Parameters
aThe first vector to be tested for its state.
bThe second vector to be tested for its state.
Returns
true in case the two vectors share a state, false otherwise.

The isSame function provides an abstract interface for testing if the two given vectors represent the same observable state. This happens for instance in case a and b refer to the same vector or in case a and b are aliases for the same vector. In case both vectors represent the same observable state, the function returns true, other it returns false.

blaze::DynamicVector<int> vec1( 4UL ); // Setup of a 4-dimensional dynamic vector
blaze::DynamicVector<int> vec2( 4UL ); // Setup of a second 4-dimensional dynamic vector
auto sub1 = subvector( vec1, 0UL, 4UL ); // Subvector of vec1 for the entire range
auto sub2 = subvector( vec1, 1UL, 2UL ); // Subvector of vec1 for the range [1..3]
auto sub3 = subvector( vec1, 1UL, 2UL ); // Second subvector of vec1 for the range [1..3]
isSame( vec1, vec1 ); // returns true since both objects refer to the same vector
isSame( vec1, vec2 ); // returns false since vec1 and vec2 are two different vectors
isSame( vec1, sub1 ); // returns true since sub1 represents the same observable state as vec1
isSame( vec1, sub3 ); // returns false since sub3 only covers part of the range of vec1
isSame( sub2, sub3 ); // returns true since sub1 and sub2 refer to exactly the same range of vec1
isSame( sub1, sub3 ); // returns false since sub1 and sub3 refer to different ranges of vec1
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:1424
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:158

◆ isUniform()

template<typename VT , bool TF>
bool blaze::isUniform ( const Vector< VT, TF > &  v)
inline

Checks if the given vector is a uniform vector.

Parameters
vThe vector to be checked.
Returns
true if the vector is a uniform vector, false if not.

This function checks if the given dense or sparse vector is a uniform vector. The vector is considered to be uniform if all its elements are identical. The following code example demonstrates the use of the function:

// ... Initialization
if( isUniform( a ) ) { ... }
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1766

Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):

if( isUniform<relaxed>( a ) ) { ... }

It is also possible to check if a vector expression results in a uniform vector:

if( isUniform( a + b ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary vector.

◆ nonZeros()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE size_t blaze::nonZeros ( const Vector< VT, TF > &  vector)

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

Parameters
vectorThe given 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 VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::operator, ( const Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
)
inline

Scalar product (dot/inner product) of two vectors ( $ s=(\vec{a},\vec{b}) $).

Parameters
lhsThe left-hand side vector for the scalar product.
rhsThe right-hand side vector for the scalar product.
Returns
The scalar product.

This function represents the scalar product (inner product) of two vectors:

blaze::double res;
// ... Resizing and initialization
res = (a,b);

The function returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator<<()

template<typename VT , bool TF>
std::ostream & blaze::operator<< ( std::ostream &  os,
const Vector< VT, TF > &  v 
)
inline

Global output operator for dense and sparse vectors.

Parameters
osReference to the output stream.
vReference to a constant vector object.
Returns
Reference to the output stream.

◆ outer()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
decltype(auto) blaze::outer ( const Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
)
inline

Outer product of two vectors ( $ A=\vec{b}*\vec{c}^T $).

Parameters
lhsThe left-hand side vector for the outer product.
rhsThe right-hand side vector for the outer product.
Returns
The outer product.

This function represents the outer product between two vectors:

// ... Resizing and initialization
A = outer( a, b );
Efficient implementation of a dynamic matrix.
Definition: DynamicMatrix.h:242
decltype(auto) outer(const Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Outer product of two vectors ( ).
Definition: Vector.h:352
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58

The operator returns an expression representing a matrix of the higher-order element type of the two involved element types VT1::ElementType and VT2::ElementType.

◆ pow2()

template<typename VT , bool TF>
decltype(auto) blaze::pow2 ( const Vector< VT, TF > &  v)
inline

Computes the square for each single element of the vector v.

Parameters
vThe input vector.
Returns
The square of each single element of v.

The pow2() function computes the square for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow2() function:

// ... Resizing and initialization
b = pow2( a );
decltype(auto) pow2(const Matrix< MT, SO > &m)
Computes the square for each single element of the matrix m.
Definition: Matrix.h:686

◆ pow3()

template<typename VT , bool TF>
decltype(auto) blaze::pow3 ( const Vector< VT, TF > &  v)
inline

Computes the cube for each single element of the vector v.

Parameters
vThe input vector.
Returns
The cube of each single element of v.

The pow3() function computes the cube for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow3() function:

// ... Resizing and initialization
b = pow3( a );
decltype(auto) pow3(const Matrix< MT, SO > &m)
Computes the cube for each single element of the matrix m.
Definition: Matrix.h:712

◆ pow4()

template<typename VT , bool TF>
decltype(auto) blaze::pow4 ( const Vector< VT, TF > &  v)
inline

Computes the quadruple for each single element of the vector v.

Parameters
vThe input vector.
Returns
The quadruple of each single element of v.

The pow4() function computes the quadruple for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow4() function:

// ... Resizing and initialization
b = pow4( a );
decltype(auto) pow4(const Matrix< MT, SO > &m)
Computes the quadruple for each single element of the matrix m.
Definition: Matrix.h:738

◆ reset() [1/2]

template<typename VT , bool TF>
constexpr void blaze::reset ( Vector< VT, TF > &&  vector)
constexpr

Resetting the given temporary vector.

Parameters
vectorThe temporary vector to be resetted.
Returns
void

◆ reset() [2/2]

template<typename VT , bool TF>
constexpr void blaze::reset ( Vector< VT, TF > &  vector)
constexpr

Resetting the given vector.

Parameters
vectorThe vector to be resetted.
Returns
void

◆ resize()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE void blaze::resize ( Vector< VT, TF > &  vector,
size_t  n,
bool  preserve 
)

Changing the size of the vector.

Parameters
vectorThe given vector to be resized.
nThe new size of the vector.
preservetrue if the old values of the vector should be preserved, false if not.
Returns
void
Exceptions
std::invalid_argumentVector cannot be resized.

This function provides a unified interface to resize dense and sparse vectors. In contrast to the resize() member function, which is only available on resizable vector types, this function can be used on both resizable and non-resizable vectors. In case the given vector type VT is resizable (i.e. provides a resize() function), the type-specific resize() member function is called. Depending on the type VT, this may result in the allocation of new dynamic memory and the invalidation of existing views (subvectors, ...). In case VT is non-resizable (i.e. does not provide a resize() function) and if the specified size is not identical to the current size of the vector, a std::invalid_argument exception is thrown.

resize( a, 5UL ); // OK: regular resize operation
resize( b, 3UL ); // OK: No resize necessary
resize( b, 5UL ); // Error: Vector cannot be resized!
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108

◆ reverse()

template<typename VT >
decltype(auto) blaze::reverse ( VT &&  v)
inline

Reverse the elements of a vector.

Parameters
vThe vector to be reversed.
Returns
The reversed vector.

This function reverses the elements of a dense or sparse vector. The following examples demonstrates this by means of a dense vector:

blaze::DynamicVector<int> a{ 1, 2, 3, 4, 5 };
b = reverse( a ); // Results in ( 5 4 3 2 1 )
decltype(auto) reverse(MT &&m)
Reverse the rows or columns of a matrix.
Definition: Matrix.h:878

◆ shrinkToFit()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE void blaze::shrinkToFit ( Vector< VT, TF > &  vector)

Requesting the removal of unused capacity.

Parameters
vectorThe given vector to be shrunk.
Returns
void

This function tries to minimize the capacity of the vector by removing unused capacity. Please note that in case of a shrinkable vector, due to padding the capacity might not be reduced exactly to the size of the vector. Please also note that in case a reallocation occurs, all iterators (including end() iterators), all pointers and references to elements of this vector are invalidated. In case of an unshrinkable vector the function has no effect.

◆ size()

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE constexpr size_t blaze::size ( const Vector< VT, TF > &  vector)
constexprnoexcept

Returns the current size/dimension of the vector.

Parameters
vectorThe given vector.
Returns
The size of the vector.