Blaze 3.9
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Types | List of all members
blaze::CompressedVector< Type, TF, Tag > Class Template Reference

Efficient implementation of an arbitrary sized sparse vector. More...

#include <CompressedVector.h>

Inherits blaze::SparseVector< CompressedVector< Type, TF, Tag >, TF >.

Classes

struct  Rebind
 Rebind mechanism to obtain a CompressedVector with different data/element type. More...
 
struct  Resize
 Resize mechanism to obtain a CompressedVector with a different fixed number of elements. More...
 

Public Types

using This = CompressedVector< Type, TF, Tag >
 Type of this CompressedVector instance.
 
using BaseType = SparseVector< This, TF >
 Base type of this CompressedVector instance.
 
using ResultType = This
 Result type for expression template evaluations.
 
using TransposeType = CompressedVector< Type,!TF, Tag >
 Transpose type for expression template evaluations.
 
using ElementType = Type
 Type of the compressed vector elements.
 
using TagType = Tag
 Tag type of this CompressedVector instance.
 
using ReturnType = const Type &
 Return type for expression template evaluations.
 
using CompositeType = const CompressedVector &
 Data type for composite expression templates.
 
using Reference = VectorAccessProxy< This >
 Reference to a non-constant vector value.
 
using ConstReference = const Type &
 Reference to a constant vector value.
 
using Iterator = Element *
 Iterator over non-constant elements.
 
using ConstIterator = const Element *
 Iterator over constant elements.
 
using VectorType = CompressedVector< Type, TF, Tag >
 Type of the vector.
 

Public Member Functions

template<typename VT >
CompressedVector< Type, TF, Tag > & operator= (const DenseVector< VT, TF > &rhs) &
 Assignment operator for dense vectors. More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator= (const SparseVector< VT, TF > &rhs) &
 Assignment operator for different sparse vectors. More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator+= (const Vector< VT, TF > &rhs) &
 Addition assignment operator for the addition of a vector ( $ \vec{a}+=\vec{b} $). More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator-= (const Vector< VT, TF > &rhs) &
 Subtraction assignment operator for the subtraction of a vector ( $ \vec{a}-=\vec{b} $). More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator*= (const DenseVector< VT, TF > &rhs) &
 Multiplication assignment operator for the multiplication of a dense vector ( $ \vec{a}*=\vec{b} $). More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator*= (const SparseVector< VT, TF > &rhs) &
 Multiplication assignment operator for the multiplication of a sparse vector ( $ \vec{a}*=\vec{b} $). More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & operator/= (const DenseVector< VT, TF > &rhs) &
 Division assignment operator for the division of a dense vector ( $ \vec{a}/=\vec{b} $). More...
 
template<typename VT >
CompressedVector< Type, TF, Tag > & 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 >
CompressedVector< Type, TF, Tag > & scale (const Other &scalar)
 Scaling of the compressed vector by the scalar value scalar ( $ \vec{a}=\vec{b}*s $). More...
 
Constructors
 CompressedVector () noexcept
 The default constructor for CompressedVector.
 
 CompressedVector (size_t size) noexcept
 Constructor for a compressed vector of size n. More...
 
 CompressedVector (size_t size, size_t nonzeros)
 Constructor for a compressed vector of size n. More...
 
 CompressedVector (initializer_list< Type > list)
 List initialization of all vector elements. More...
 
 CompressedVector (const CompressedVector &sv)
 The copy constructor for CompressedVector. More...
 
 CompressedVector (CompressedVector &&sv) noexcept
 The move constructor for CompressedVector. More...
 
template<typename VT >
 CompressedVector (const DenseVector< VT, TF > &dv)
 Conversion constructor from dense vectors. More...
 
template<typename VT >
 CompressedVector (const SparseVector< VT, TF > &sv)
 Conversion constructor from different sparse vectors. More...
 
Destructor
 ~CompressedVector ()
 The destructor for CompressedVector.
 
Data access functions
Reference operator[] (size_t index) noexcept
 Subscript operator for the direct access to the compressed vector elements. More...
 
ConstReference operator[] (size_t index) const noexcept
 Subscript operator for the direct access to the compressed vector elements. More...
 
Reference at (size_t index)
 Checked access to the compressed vector elements. More...
 
ConstReference at (size_t index) const
 Checked access to the compressed vector elements. More...
 
Iterator begin () noexcept
 Returns an iterator to the first non-zero element of the compressed vector. More...
 
ConstIterator begin () const noexcept
 Returns an iterator to the first non-zero element of the compressed vector. More...
 
ConstIterator cbegin () const noexcept
 Returns an iterator to the first non-zero element of the compressed vector. More...
 
Iterator end () noexcept
 Returns an iterator just past the last non-zero element of the compressed vector. More...
 
ConstIterator end () const noexcept
 Returns an iterator just past the last non-zero element of the compressed vector. More...
 
ConstIterator cend () const noexcept
 Returns an iterator just past the last non-zero element of the compressed vector. More...
 
Assignment operators
CompressedVectoroperator= (initializer_list< Type > list) &
 List assignment to all vector elements. More...
 
CompressedVectoroperator= (const CompressedVector &rhs) &
 Copy assignment operator for CompressedVector. More...
 
CompressedVectoroperator= (CompressedVector &&rhs) &noexcept
 
template<typename VT >
CompressedVectoroperator= (const DenseVector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator= (const SparseVector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator+= (const Vector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator-= (const Vector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator*= (const DenseVector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator*= (const SparseVector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator/= (const DenseVector< VT, TF > &rhs) &
 
template<typename VT >
CompressedVectoroperator%= (const Vector< VT, TF > &rhs) &
 
Erase functions
void erase (size_t index)
 Erasing an element from the compressed vector. More...
 
Iterator erase (Iterator pos)
 Erasing an element from the compressed vector. More...
 
Iterator erase (Iterator first, Iterator last)
 Erasing a range of elements from the compressed vector. More...
 
template<typename Pred , typename = DisableIf_t< IsIntegral_v<Pred> >>
void erase (Pred predicate)
 Erasing specific elements from the compressed vector. More...
 
template<typename Pred >
void erase (Iterator first, Iterator last, Pred predicate)
 Erasing specific elements from a range of the compressed vector. More...
 
Lookup functions
Iterator find (size_t index)
 Searches for a specific vector element. More...
 
ConstIterator find (size_t index) const
 Searches for a specific vector element. More...
 
Iterator lowerBound (size_t index)
 Returns an iterator to the first index not less then the given index. More...
 
ConstIterator lowerBound (size_t index) const
 Returns an iterator to the first index not less then the given index. More...
 
Iterator upperBound (size_t index)
 Returns an iterator to the first index greater then the given index. More...
 
ConstIterator upperBound (size_t index) const
 Returns an iterator to the first index greater then the given index. More...
 
Numeric functions
template<typename Other >
CompressedVectorscale (const Other &scalar)
 
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 canSMPAssign () const noexcept
 Returns whether the vector can be used in SMP assignments. More...
 
template<typename VT >
void assign (const DenseVector< VT, TF > &rhs)
 Default implementation of the assignment of a dense vector. More...
 
template<typename VT >
void assign (const SparseVector< VT, TF > &rhs)
 Default implementation of the assignment of a sparse vector. More...
 
template<typename VT >
void addAssign (const DenseVector< VT, TF > &rhs)
 Default implementation of the addition assignment of a dense vector. More...
 
template<typename VT >
void addAssign (const SparseVector< VT, TF > &rhs)
 Default implementation of the addition assignment of a sparse vector. More...
 
template<typename VT >
void subAssign (const DenseVector< VT, TF > &rhs)
 Default implementation of the subtraction assignment of a dense vector. More...
 
template<typename VT >
void subAssign (const SparseVector< VT, TF > &rhs)
 Default implementation of the subtraction assignment of a sparse vector. More...
 
template<typename VT >
void multAssign (const DenseVector< VT, TF > &rhs)
 Default implementation of the multiplication assignment of a dense vector. More...
 
template<typename VT >
void divAssign (const DenseVector< VT, TF > &rhs)
 Default implementation of the division assignment of a dense vector. More...
 
Conversion operators
BLAZE_ALWAYS_INLINE constexpr CompressedVector< Type, TF, Tag > & operator~ () noexcept
 CRTP-based conversion operation for non-constant vectors. More...
 
BLAZE_ALWAYS_INLINE constexpr const CompressedVector< Type, TF, Tag > & operator~ () const noexcept
 CRTP-based conversion operation for constant vectors. More...
 
constexpr CompressedVector< Type, TF, Tag > & operator* () noexcept
 CRTP-based conversion operation for non-constant vectors. More...
 
constexpr const CompressedVector< Type, TF, Tag > & operator* () const noexcept
 CRTP-based conversion operation for constant vectors. More...
 

Static Public Attributes

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

Private Types

using ElementBase = ValueIndexPair< Type >
 Base class for the compressed vector element.
 
using IteratorBase = ElementBase *
 Iterator over non-constant base elements.
 

Member variables

size_t size_
 The current size/dimension of the compressed vector.
 
size_t capacity_
 The maximum capacity of the compressed vector.
 
Iterator begin_
 Pointer to the first non-zero element of the compressed vector.
 
Iterator end_
 Pointer one past the last non-zero element of the compressed vector.
 
static const Type zero_ {}
 Neutral element for accesses to zero elements.
 

Utility functions

size_t size () const noexcept
 Returns the current size/dimension of the compressed vector. More...
 
size_t capacity () const noexcept
 Returns the maximum capacity of the compressed vector. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the compressed vector. More...
 
void reset ()
 Reset to the default initial values. More...
 
void clear ()
 Clearing the compressed vector. More...
 
void resize (size_t n, bool preserve=true)
 Changing the size of the compressed vector. More...
 
void reserve (size_t n)
 Setting the minimum capacity of the compressed vector. More...
 
void shrinkToFit ()
 Requesting the removal of unused capacity. More...
 
void swap (CompressedVector &sv) noexcept
 Swapping the contents of two compressed vectors. More...
 
size_t extendCapacity () const noexcept
 Calculating a new vector capacity. More...
 
Iterator castDown (IteratorBase it) const noexcept
 Performs a down-cast of the given iterator. More...
 
IteratorBase castUp (Iterator it) const noexcept
 Performs an up-cast of the given iterator. More...
 

Insertion functions

Iterator set (size_t index, const Type &value)
 Setting an element of the compressed vector. More...
 
Iterator insert (size_t index, const Type &value)
 Inserting an element into the compressed vector. More...
 
void append (size_t index, const Type &value, bool check=false)
 Appending an element to the compressed vector. More...
 
Iterator insert (Iterator pos, size_t index, const Type &value)
 Inserting an element into the compressed vector. More...
 

Detailed Description

template<typename Type, bool TF, typename Tag>
class blaze::CompressedVector< Type, TF, Tag >

Efficient implementation of an arbitrary sized sparse vector.

The CompressedVector class is the representation of an arbitrarily sized sparse vector, which stores only non-zero elements of arbitrary type. The type of the elements, the transpose flag, and the group tag of the vector can be specified via the three template parameters:

namespace blaze {
template< typename Type, bool TF, typename Tag >
} // namespace blaze
CompressedVector() noexcept
The default constructor for CompressedVector.
Definition: CompressedVector.h:548

Inserting/accessing elements in a compressed vector can be done by several alternative functions. The following example demonstrates all options:

// Creating a compressed column vector of size 100
CompressedVector<double,columnVector> a( 100 );
// The subscript operator provides access to all possible elements of the compressed vector,
// including the zero elements. In case the subscript operator is used to access an element
// that is currently not stored in the sparse vector, the element is inserted into the vector.
a[42] = 2.0;
// The second operation for inserting elements is the set() function. In case the element
// is not contained in the vector it is inserted into the vector, if it is already contained
// in the vector its value is modified.
a.set( 45, -1.2 );
// An alternative for inserting elements into the vector is the insert() function. However,
// it inserts the element only in case the element is not already contained in the vector.
a.insert( 50, 3.7 );
// A very efficient way to add new elements to a sparse vector is the append() function.
// Note that append() requires that the appended element's index is strictly larger than
// the currently largest non-zero index of the vector and that the vector's capacity
// is large enough to hold the new element.
a.reserve( 10 );
a.append( 51, -2.1 );
// In order to traverse all non-zero elements currently stored in the vector, the begin()
// and end() functions can be used. In the example, all non-zero elements of the vector are
// traversed.
for( CompressedVector<double,false>::Iterator it=a.begin(); it!=a.end(); ++it ) {
... = it->value(); // Access to the value of the non-zero element
... = it->index(); // Access to the index of the non-zero element
}
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:314

The use of CompressedVector is very natural and intuitive. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of dense and sparse vectors with fitting element types. The following example gives an impression of the use of CompressedVector:

CompressedVector<double> a( 2 ); // Default constructed, non-initialized 2D vectors
a[0] = 1.0; // Initialization of the first element
a[1] = 2.0; // Initialization of the second element
CompressedVector<double> b( 2 ); // Empty sparse vector
DynamicVector<float> c( 2, 2.0F ); // Directly, homogeneously initialized dense vector
CompressedVector<double> d; // Default constructed dynamic vector
CompressedMatrix<double> A; // Default constructed row-major matrix
d = a + b; // Vector addition between vectors of equal element type
d = a - c; // Vector subtraction between a sparse and dense 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
Efficient implementation of a compressed matrix.
Definition: CompressedMatrix.h:239
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766

Constructor & Destructor Documentation

◆ CompressedVector() [1/7]

template<typename Type , bool TF, typename Tag >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( size_t  n)
inlineexplicitnoexcept

Constructor for a compressed vector of size n.

Parameters
nThe size of the vector.

◆ CompressedVector() [2/7]

template<typename Type , bool TF, typename Tag >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( size_t  n,
size_t  nonzeros 
)
inline

Constructor for a compressed vector of size n.

Parameters
nThe size of the vector.
nonzerosThe number of expected non-zero elements.

◆ CompressedVector() [3/7]

template<typename Type , bool TF, typename Tag >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( initializer_list< Type >  list)
inline

List initialization of all vector elements.

Parameters
listThe initializer list.

This assignment operator provides the option to explicitly initialize the elements of the vector within a constructor call:

blaze::CompressedVector<double> v1{ 4.2, 6.3, -1.2 };

The vector is sized according to the size of the initializer list and all its elements are initialized by the non-zero elements of the given initializer list.

◆ CompressedVector() [4/7]

template<typename Type , bool TF, typename Tag >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( const CompressedVector< Type, TF, Tag > &  sv)
inline

The copy constructor for CompressedVector.

Parameters
svCompressed vector to be copied.

The copy constructor is explicitly defined due to the required dynamic memory management and in order to enable/facilitate NRV optimization.

◆ CompressedVector() [5/7]

template<typename Type , bool TF, typename Tag >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( CompressedVector< Type, TF, Tag > &&  sv)
inlinenoexcept

The move constructor for CompressedVector.

Parameters
svThe compressed vector to be moved into this instance.

◆ CompressedVector() [6/7]

template<typename Type , bool TF, typename Tag >
template<typename VT >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( const DenseVector< VT, TF > &  dv)
inline

Conversion constructor from dense vectors.

Parameters
dvDense vector to be copied.

◆ CompressedVector() [7/7]

template<typename Type , bool TF, typename Tag >
template<typename VT >
blaze::CompressedVector< Type, TF, Tag >::CompressedVector ( const SparseVector< VT, TF > &  sv)
inline

Conversion constructor from different sparse vectors.

Parameters
svSparse vector to be copied.

Member Function Documentation

◆ addAssign() [1/2]

template<typename Type , bool TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::addAssign ( const DenseVector< VT, TF > &  rhs)
inline

Default 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 TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::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.

◆ append()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::append ( size_t  index,
const Type &  value,
bool  check = false 
)
inline

Appending an element to the compressed vector.

Parameters
indexThe index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be appended.
checktrue if the new value should be checked for default values, false if not.
Returns
void

This function provides a very efficient way to fill a compressed vector with elements. It appends a new element to the end of the compressed vector without any memory allocation. Therefore it is strictly necessary to keep the following preconditions in mind:

  • the index of the new element must be strictly larger than the largest index of non-zero elements in the compressed vector
  • the current number of non-zero elements must be smaller than the capacity of the vector

Ignoring these preconditions might result in undefined behavior! The optional check parameter specifies whether the new value should be tested for a default value. If the new value is a default value (for instance 0 in case of an integral element type) the value is not appended. Per default the values are not tested.

Note
Although append() does not allocate new memory, it still invalidates all iterators returned by the end() functions!

◆ assign() [1/2]

template<typename Type , bool TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::assign ( const DenseVector< VT, TF > &  rhs)
inline

Default 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 TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::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 TF, typename Tag >
CompressedVector< Type, TF, Tag >::Reference blaze::CompressedVector< Type, TF, Tag >::at ( size_t  index)
inline

Checked access to the compressed 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 compressed vector access index.

This function returns a reference to the accessed value at position index. In case the compressed vector does not yet store an element for index index, a new element is inserted into the compressed vector. In contrast to the subscript operator this function always performs a check of the given access index.

◆ at() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstReference blaze::CompressedVector< Type, TF, Tag >::at ( size_t  index) const
inline

Checked access to the compressed 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 compressed vector access index.

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

◆ begin() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::begin
inlinenoexcept

Returns an iterator to the first non-zero element of the compressed vector.

Returns
Iterator to the first non-zero element of the compressed vector.

◆ begin() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::begin
inlinenoexcept

Returns an iterator to the first non-zero element of the compressed vector.

Returns
Iterator to the first non-zero element of the compressed vector.

◆ canAlias()

template<typename Type , bool TF, typename Tag >
template<typename Other >
bool blaze::CompressedVector< Type, TF, Tag >::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 TF, typename Tag >
bool blaze::CompressedVector< Type, TF, Tag >::canSMPAssign
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 TF, typename Tag >
size_t blaze::CompressedVector< Type, TF, Tag >::capacity
inlinenoexcept

Returns the maximum capacity of the compressed vector.

Returns
The capacity of the compressed vector.

◆ castDown()

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::castDown ( IteratorBase  it) const
inlineprivatenoexcept

Performs a down-cast of the given iterator.

Returns
The casted iterator.

This function performs a down-cast of the given iterator to base elements to an iterator to derived elements.

◆ castUp()

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::IteratorBase blaze::CompressedVector< Type, TF, Tag >::castUp ( Iterator  it) const
inlineprivatenoexcept

Performs an up-cast of the given iterator.

Returns
The casted iterator.

This function performs an up-cast of the given iterator to derived elements to an iterator to base elements.

◆ cbegin()

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::cbegin
inlinenoexcept

Returns an iterator to the first non-zero element of the compressed vector.

Returns
Iterator to the first non-zero element of the compressed vector.

◆ cend()

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::cend
inlinenoexcept

Returns an iterator just past the last non-zero element of the compressed vector.

Returns
Iterator just past the last non-zero element of the compressed vector.

◆ clear()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::clear
inline

Clearing the compressed vector.

Returns
void

After the clear() function, the size of the compressed vector is 0.

◆ divAssign()

template<typename Type , bool TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::divAssign ( const DenseVector< VT, TF > &  rhs)
inline

Default 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 TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::end
inlinenoexcept

Returns an iterator just past the last non-zero element of the compressed vector.

Returns
Iterator just past the last non-zero element of the compressed vector.

◆ end() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::end
inlinenoexcept

Returns an iterator just past the last non-zero element of the compressed vector.

Returns
Iterator just past the last non-zero element of the compressed vector.

◆ erase() [1/5]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::erase ( Iterator  first,
Iterator  last 
)
inline

Erasing a range of elements from the compressed vector.

Parameters
firstIterator to first element to be erased.
lastIterator just past the last element to be erased.
Returns
Iterator to the element after the erased element.

This function erases a range of elements from the compressed vector.

◆ erase() [2/5]

template<typename Type , bool TF, typename Tag >
template<typename Pred >
void blaze::CompressedVector< Type, TF, Tag >::erase ( Iterator  first,
Iterator  last,
Pred  predicate 
)
inline

Erasing specific elements from a range of the compressed vector.

Parameters
firstIterator to first element of the range.
lastIterator just past the last element of the range.
predicateThe unary predicate for the element selection.
Returns
void.

This function erases specific elements from a range of elements of the compressed vector. The elements are selected by the given unary predicate predicate, which is expected to accept a single argument of the type of the elements and to be pure. The following example demonstrates how to remove all elements that are smaller than a certain threshold value:

// ... Resizing and initialization
a.erase( a.begin(), a.end(), []( double value ){ return value < 1E-8; } );
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1788
Iterator begin() noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:844
Iterator end() noexcept
Returns an iterator just past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:892
Note
The predicate is required to be pure, i.e. to produce deterministic results for elements with the same value. The attempt to use an impure predicate leads to undefined behavior!

◆ erase() [3/5]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::erase ( Iterator  pos)
inline

Erasing an element from the compressed vector.

Parameters
posIterator to the element to be erased.
Returns
Iterator to the element after the erased element.

This function erases an element from the compressed vector.

◆ erase() [4/5]

template<typename Type , bool TF, typename Tag >
template<typename Pred , typename >
void blaze::CompressedVector< Type, TF, Tag >::erase ( Pred  predicate)
inline

Erasing specific elements from the compressed vector.

Parameters
predicateThe unary predicate for the element selection.
Returns
void.

This function erases specific elements from the compressed vector. The elements are selected by the given unary predicate predicate, which is expected to accept a single argument of the type of the elements and to be pure. The following example demonstrates how to remove all elements that are smaller than a certain threshold value:

// ... Resizing and initialization
a.erase( []( double value ){ return value < 1E-8; } );
Note
The predicate is required to be pure, i.e. to produce deterministic results for elements with the same value. The attempt to use an impure predicate leads to undefined behavior!

◆ erase() [5/5]

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::erase ( size_t  index)
inline

Erasing an element from the compressed vector.

Parameters
indexThe index of the element to be erased. The index has to be in the range $[0..N-1]$.
Returns
void

This function erases an element from the compressed vector.

◆ extendCapacity()

template<typename Type , bool TF, typename Tag >
size_t blaze::CompressedVector< Type, TF, Tag >::extendCapacity
inlineprivatenoexcept

Calculating a new vector capacity.

Returns
The new compressed vector capacity.

This function calculates a new vector capacity based on the current capacity of the sparse vector. Note that the new capacity is restricted to the interval $[7..size]$.

◆ find() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::find ( size_t  index)
inline

Searches for a specific vector element.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.

This function can be used to check whether a specific element is contained in the sparse vector. It specifically searches for the element with index index. In case the element is found, the function returns an iterator to the element. Otherwise an iterator just past the last non-zero element of the compressed vector (the end() iterator) is returned. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ find() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::find ( size_t  index) const
inline

Searches for a specific vector element.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.

This function can be used to check whether a specific element is contained in the sparse vector. It specifically searches for the element with index index. In case the element is found, the function returns an iterator to the element. Otherwise an iterator just past the last non-zero element of the compressed vector (the end() iterator) is returned. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ insert() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::insert ( Iterator  pos,
size_t  index,
const Type &  value 
)
private

Inserting an element into the compressed vector.

Parameters
posThe position of the new element.
indexThe index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be inserted.
Returns
Reference to the inserted value.
Exceptions
std::invalid_argumentInvalid compressed vector access index.

◆ insert() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::insert ( size_t  index,
const Type &  value 
)
inline

Inserting an element into the compressed vector.

Parameters
indexThe index of the new element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be inserted.
Returns
Reference to the inserted value.
Exceptions
std::invalid_argumentInvalid compressed vector access index.

This function inserts a new element into the compressed vector. However, duplicate elements are not allowed. In case the sparse vector already contains an element with index index, a std::invalid_argument exception is thrown.

◆ isAliased()

template<typename Type , bool TF, typename Tag >
template<typename Other >
bool blaze::CompressedVector< Type, TF, Tag >::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.

◆ lowerBound() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::lowerBound ( size_t  index)
inline

Returns an iterator to the first index not less then the given index.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index not less then the given index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ lowerBound() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::lowerBound ( size_t  index) const
inline

Returns an iterator to the first index not less then the given index.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index not less then the given index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ multAssign()

template<typename Type , bool TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::multAssign ( const DenseVector< VT, TF > &  rhs)
inline

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

◆ nonZeros()

template<typename Type , bool TF, typename Tag >
size_t blaze::CompressedVector< Type, TF, Tag >::nonZeros
inline

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

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

Note that the number of non-zero elements is always smaller than the current size of the compressed vector.

◆ operator%=()

template<typename Type , bool TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::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 compressed 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*() [1/2]

BLAZE_ALWAYS_INLINE constexpr const CompressedVector< Type, TF, Tag > & blaze::Vector< CompressedVector< Type, TF, Tag > , TF >::operator*
constexprnoexceptinherited

CRTP-based conversion operation for constant vectors.

Returns
Const reference of the actual type of the vector.

This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a constant reference to the actual type VT.

◆ operator*() [2/2]

BLAZE_ALWAYS_INLINE constexpr CompressedVector< Type, TF, Tag > & blaze::Vector< CompressedVector< Type, TF, Tag > , TF >::operator*
constexprnoexceptinherited

CRTP-based conversion operation for non-constant vectors.

Returns
Mutable reference of the actual type of the vector.

This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a mutable reference to the actual type VT.

◆ operator*=() [1/2]

template<typename Type , bool TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator*= ( const DenseVector< VT, TF > &  rhs) &
inline

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

Parameters
rhsThe right-hand side dense vector to be multiplied with the compressed vector.
Returns
Reference to the compressed 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*=() [2/2]

template<typename Type , bool TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator*= ( const SparseVector< VT, TF > &  rhs) &
inline

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

Parameters
rhsThe right-hand side sparse vector to be multiplied with the compressed vector.
Returns
Reference to the compressed 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 TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::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 compressed vector.
Returns
Reference to the compressed 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 TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::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 compressed vector.
Returns
Reference to the compressed 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 TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::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 compressed 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/4]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator= ( const CompressedVector< Type, TF, Tag > &  rhs) &
inline

Copy assignment operator for CompressedVector.

Parameters
rhsCompressed vector to be copied.
Returns
Reference to the assigned compressed vector.

The compressed vector is resized according to the given compressed vector and initialized as a copy of this vector.

◆ operator=() [2/4]

template<typename Type , bool TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator= ( const DenseVector< VT, TF > &  rhs) &
inline

Assignment operator for dense vectors.

Parameters
rhsDense vector to be copied.
Returns
Reference to the assigned compressed vector.

The vector is resized according to the given dense vector and initialized as a copy of this vector.

◆ operator=() [3/4]

template<typename Type , bool TF, typename Tag >
template<typename VT >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator= ( const SparseVector< VT, TF > &  rhs) &
inline

Assignment operator for different sparse vectors.

Parameters
rhsSparse vector to be copied.
Returns
Reference to the assigned compressed vector.

The vector is resized according to the given sparse vector and initialized as a copy of this vector.

◆ operator=() [4/4]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::operator= ( initializer_list< Type >  list) &
inline

List assignment to all vector elements.

Parameters
listThe initializer list.

This assignment operator offers the option to directly assign to all elements of the vector by means of an initializer list:

v = { 4.2, 6.3, -1.2 };

The vector is resized according to the size of the initializer list and all its elements are assigned the non-zero values from the given initializer list.

◆ operator[]() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstReference blaze::CompressedVector< Type, TF, Tag >::operator[] ( size_t  index) const
inlinenoexcept

Subscript operator for the direct access to the compressed vector elements.

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

◆ operator[]() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Reference blaze::CompressedVector< Type, TF, Tag >::operator[] ( size_t  index)
inlinenoexcept

Subscript operator for the direct access to the compressed vector elements.

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

This function returns a reference to the accessed value at position index. In case the compressed vector does not yet store an element for index index, a new element is inserted into the compressed vector. An alternative for traversing the non-zero elements of the sparse vector are the begin() and end() functions.

◆ operator~() [1/2]

BLAZE_ALWAYS_INLINE constexpr const CompressedVector< Type, TF, Tag > & blaze::Vector< CompressedVector< Type, TF, Tag > , TF >::operator~
constexprnoexceptinherited

CRTP-based conversion operation for constant vectors.

Returns
Constant reference of the actual type of the vector.

This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a constant reference to the actual type VT.

◆ operator~() [2/2]

BLAZE_ALWAYS_INLINE constexpr CompressedVector< Type, TF, Tag > & blaze::Vector< CompressedVector< Type, TF, Tag > , TF >::operator~
constexprnoexceptinherited

CRTP-based conversion operation for non-constant vectors.

Returns
Mutable reference of the actual type of the vector.

This operator performs the CRTP-based type-safe downcast to the actual type VT of the vector. It will return a mutable reference to the actual type VT.

◆ reserve()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::reserve ( size_t  n)

Setting the minimum capacity of the compressed vector.

Parameters
nThe new minimum capacity of the compressed vector.
Returns
void

This function increases the capacity of the compressed vector to at least n elements. The current values of the vector elements are preserved.

◆ reset()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::reset
inline

Reset to the default initial values.

Returns
void

◆ resize()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::resize ( size_t  n,
bool  preserve = true 
)
inline

Changing the size of the compressed vector.

Parameters
nThe new size of the compressed vector.
preservetrue if the old values of the vector should be preserved, false if not.
Returns
void

This function resizes the compressed vector using the given size to n. During this operation, new dynamic memory may be allocated in case the capacity of the compressed vector is too small. Note that this function may invalidate all existing views (subvectors, ...) on the vector if it is used to shrink the vector. Additionally, the resize operation potentially changes all vector elements. In order to preserve the old vector values, the preserve flag can be set to true.

◆ scale()

template<typename Type , bool TF, typename Tag >
template<typename Other >
CompressedVector< Type, TF, Tag > & blaze::CompressedVector< Type, TF, Tag >::scale ( const Other &  scalar)
inline

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

Parameters
scalarThe scalar value for the vector scaling.
Returns
Reference to the compressed 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:

// ... Resizing and initialization
a *= 4; // Scaling of the vector
a.scale( 4 ); // Same effect as above

◆ set()

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::set ( size_t  index,
const Type &  value 
)
inline

Setting an element of the compressed vector.

Parameters
indexThe index of the element. The index has to be in the range $[0..N-1]$.
valueThe value of the element to be set.
Returns
Reference to the set value.

This function sets the value of an element of the compressed vector. In case the sparse vector already contains an element with index index its value is modified, else a new element with the given value is inserted.

◆ shrinkToFit()

template<typename Type , bool TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::shrinkToFit
inline

Requesting the removal of unused capacity.

Returns
void

This function minimizes the capacity of the vector by removing unused capacity. Please note that in case a reallocation occurs, all iterators (including end() iterators), all pointers and references to elements of this vector are invalidated.

◆ size()

template<typename Type , bool TF, typename Tag >
size_t blaze::CompressedVector< Type, TF, Tag >::size
inlinenoexcept

Returns the current size/dimension of the compressed vector.

Returns
The size of the compressed vector.

◆ subAssign() [1/2]

template<typename Type , bool TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::subAssign ( const DenseVector< VT, TF > &  rhs)
inline

Default 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 TF, typename Tag >
template<typename VT >
void blaze::CompressedVector< Type, TF, Tag >::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 TF, typename Tag >
void blaze::CompressedVector< Type, TF, Tag >::swap ( CompressedVector< Type, TF, Tag > &  sv)
inlinenoexcept

Swapping the contents of two compressed vectors.

Parameters
svThe compressed vector to be swapped.
Returns
void

◆ upperBound() [1/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::Iterator blaze::CompressedVector< Type, TF, Tag >::upperBound ( size_t  index)
inline

Returns an iterator to the first index greater then the given index.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index greater then the given index. In combination with the lowerBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ upperBound() [2/2]

template<typename Type , bool TF, typename Tag >
CompressedVector< Type, TF, Tag >::ConstIterator blaze::CompressedVector< Type, TF, Tag >::upperBound ( size_t  index) const
inline

Returns an iterator to the first index greater then the given index.

Parameters
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index greater then the given index. In combination with the lowerBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned compressed vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

Member Data Documentation

◆ smpAssignable

template<typename Type , bool TF, typename Tag >
constexpr bool blaze::CompressedVector< Type, TF, Tag >::smpAssignable = !IsSMPAssignable_v<Type>
staticconstexpr

Compilation flag for SMP assignments.

The smpAssignable compilation flag indicates whether the vector can be used in SMP (shared memory parallel) assignments (both on the left-hand and right-hand side of the assignment).


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