35#ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
36#define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
74class SparseVectorProxy
75 :
public SparseVector< PT, IsRowVector_v<VT> >
111 inline size_t size()
const;
114 inline void reset()
const;
115 inline void clear()
const;
116 inline void resize(
size_t n,
bool preserve=
true )
const;
117 inline void reserve(
size_t n )
const;
126 inline void append(
size_t index,
const ElementType& value,
bool check=
false )
const;
133 inline void erase(
size_t index )
const;
137 template<
typename Pred,
typename = DisableIf_t< IsIntegral_v<Pred> > >
138 inline void erase( Pred predicate );
140 template<
typename Pred >
157 template<
typename Other >
inline void scale(
const Other& scalar )
const;
165 SparseVectorProxy() =
default;
166 SparseVectorProxy(
const SparseVectorProxy& ) =
default;
167 SparseVectorProxy( SparseVectorProxy&& ) =
default;
168 ~SparseVectorProxy() =
default;
169 SparseVectorProxy& operator=(
const SparseVectorProxy& ) =
default;
170 SparseVectorProxy& operator=( SparseVectorProxy&& ) =
default;
209 if( (**this).isRestricted() ) {
213 return (**this).get()[index];
236 if( (**this).isRestricted() ) {
240 return (**this).get().at( index );
254 return (**this).get().begin();
268 return (**this).get().cbegin();
282 return (**this).get().end();
296 return (**this).get().cend();
318 return (**this).get().size();
332 return (**this).get().capacity();
349 return (**this).get().nonZeros();
367 reset( (**this).get() );
385 clear( (**this).get() );
408 if( (**this).isRestricted() ) {
412 return (**this).get().set( index, value );
435 if( (**this).isRestricted() ) {
439 return (**this).get().insert( index, value );
473 if( (**this).isRestricted() ) {
477 (**this).get().append( index, value, check );
501 if( (**this).isRestricted() ) {
505 (**this).get().resize( n, preserve );
524 if( (**this).isRestricted() ) {
528 (**this).get().reserve( n );
546template<
typename Other >
549 if( (**this).isRestricted() ) {
553 (**this).get().scale( scalar );
579 if( (**this).isRestricted() ) {
583 (**this).get().erase( index );
601 if( (**this).isRestricted() ) {
605 return (**this).get().erase( pos );
625 if( (**this).isRestricted() ) {
629 return (**this).get().erase( first, last );
649template<
typename Pred
653 if( (**this).isRestricted() ) {
657 (**this).get().erase( predicate );
679template<
typename Pred >
682 if( (**this).isRestricted() ) {
686 (**this).get().erase( first, last, predicate );
717 return (**this).get().find( index );
739 return (**this).get().lowerBound( index );
761 return (**this).get().upperBound( index );
777template<
typename PT,
typename VT >
781template<
typename PT,
typename VT >
785template<
typename PT,
typename VT >
789template<
typename PT,
typename VT >
793template<
typename PT,
typename VT >
796template<
typename PT,
typename VT >
799template<
typename PT,
typename VT >
802template<
typename PT,
typename VT >
805template<
typename PT,
typename VT >
809template<
typename PT,
typename VT >
813template<
typename PT,
typename VT >
832 return proxy.
begin();
954 proxy.
resize( n, preserve );
972 return proxy.
find( index );
1003template<
typename PT
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.
Definition Aliases.h:170
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition Aliases.h:130
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.
Definition Aliases.h:390
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.
Definition Aliases.h:210
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition Aliases.h:550
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition Aliases.h:450
Header file for the EnableIf class template.
Header file for the IsIntegral type trait.
Header file for the IsRowVector type trait.
Proxy backend for sparse vector types.
Definition SparseVectorProxy.h:76
size_t size() const
Returns the current size/dimension of the represented vector.
Definition SparseVectorProxy.h:316
Iterator_t< VT > Iterator
Iterator over non-constant elements.
Definition SparseVectorProxy.h:86
void reserve(size_t n) const
Setting the minimum capacity of the represented vector.
Definition SparseVectorProxy.h:522
Iterator end() const
Returns an iterator just past the last element of the represented vector.
Definition SparseVectorProxy.h:280
Iterator insert(size_t index, const ElementType &value) const
Inserting an element into the represented sparse vector.
Definition SparseVectorProxy.h:433
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition SparseVectorProxy.h:547
Iterator find(size_t index) const
Searches for a specific vector element.
Definition SparseVectorProxy.h:715
void clear() const
Clearing the represented vector.
Definition SparseVectorProxy.h:381
size_t nonZeros() const
Returns the number of non-zero elements in the represented vector.
Definition SparseVectorProxy.h:347
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition SparseVectorProxy.h:499
ConstIterator cend() const
Returns an iterator just past the last element of the represented vector.
Definition SparseVectorProxy.h:294
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition SparseVectorProxy.h:92
ConstReference_t< VT > ConstReference
Reference to a constant vector value.
Definition SparseVectorProxy.h:85
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition SparseVectorProxy.h:759
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition SparseVectorProxy.h:577
void reset() const
Reset to the default initial value.
Definition SparseVectorProxy.h:363
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition SparseVectorProxy.h:82
Iterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition SparseVectorProxy.h:737
ResultType_t< VT > ResultType
Result type for expression template evaluations.
Definition SparseVectorProxy.h:79
Iterator begin() const
Returns an iterator to the first element of the represented vector.
Definition SparseVectorProxy.h:252
void append(size_t index, const ElementType &value, bool check=false) const
Appending an element to the represented sparse vector.
Definition SparseVectorProxy.h:471
ElementType_t< VT > ElementType
Type of the sparse vector elements.
Definition SparseVectorProxy.h:81
size_t capacity() const
Returns the maximum capacity of the represented vector.
Definition SparseVectorProxy.h:330
Reference at(size_t index) const
Checked access to the vector elements.
Definition SparseVectorProxy.h:234
TransposeType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition SparseVectorProxy.h:80
ConstIterator_t< VT > ConstIterator
Iterator over constant elements.
Definition SparseVectorProxy.h:87
Reference operator[](size_t index) const
Subscript operator for the direct access to vector elements.
Definition SparseVectorProxy.h:207
CompositeType_t< VT > CompositeType
Data type for composite expression templates.
Definition SparseVectorProxy.h:83
ConstIterator cbegin() const
Returns an iterator to the first element of the represented vector.
Definition SparseVectorProxy.h:266
Reference_t< VT > Reference
Reference to a non-constant vector value.
Definition SparseVectorProxy.h:84
Iterator set(size_t index, const ElementType &value) const
Setting an element of the represented sparse vector.
Definition SparseVectorProxy.h:406
Constraint on the data type.
Header file for the SparseVector base class.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition SparseVector.h:61
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition Matrix.h:628
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition Matrix.h:730
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition Matrix.h:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
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
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition Matrix.h:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition Matrix.h:676
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition SparseMatrix.h:244
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition SparseMatrix.h:144
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
Header file for the exception macros of the math module.
Header file for the clear shim.
Header file for the reset shim.
System settings for the inline keywords.
Header file for basic type definitions.