35 #ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 36 #define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 74 class 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 >
160 template<
typename Other >
inline void scale(
const Other& scalar )
const;
194 template<
typename PT
199 if( (~*
this).isRestricted() ) {
203 return (~*
this).get()[index];
221 template<
typename PT
226 if( (~*
this).isRestricted() ) {
230 return (~*
this).get().at( index );
240 template<
typename PT
244 return (~*
this).get().begin();
254 template<
typename PT
258 return (~*
this).get().cbegin();
268 template<
typename PT
272 return (~*
this).get().end();
282 template<
typename PT
286 return (~*
this).get().cend();
304 template<
typename PT
308 return (~*
this).get().size();
318 template<
typename PT
322 return (~*
this).get().capacity();
335 template<
typename PT
339 return (~*
this).get().nonZeros();
351 template<
typename PT
357 reset( (~*
this).
get() );
369 template<
typename PT
375 clear( (~*
this).
get() );
393 template<
typename PT
398 if( (~*
this).isRestricted() ) {
402 return (~*
this).get().set( index, value );
420 template<
typename PT
425 if( (~*
this).isRestricted() ) {
429 return (~*
this).get().insert( index, value );
459 template<
typename PT
463 if( (~*
this).isRestricted() ) {
467 (~*
this).
get().append( index, value, check );
487 template<
typename PT
491 if( (~*
this).isRestricted() ) {
495 (~*
this).
get().resize( n, preserve );
510 template<
typename PT
514 if( (~*
this).isRestricted() ) {
518 (~*
this).
get().reserve( n );
534 template<
typename PT
536 template<
typename Other >
539 if( (~*
this).isRestricted() ) {
543 (~*
this).
get().scale( scalar );
565 template<
typename PT
569 if( (~*
this).isRestricted() ) {
573 (~*
this).
get().erase( index );
587 template<
typename PT
591 if( (~*
this).isRestricted() ) {
595 return (~*
this).get().erase( pos );
610 template<
typename PT
615 if( (~*
this).isRestricted() ) {
619 return (~*
this).get().erase( first, last );
637 template<
typename PT
639 template<
typename Pred
643 if( (~*
this).isRestricted() ) {
647 (~*
this).
get().erase( predicate );
667 template<
typename PT
669 template<
typename Pred >
672 if( (~*
this).isRestricted() ) {
676 (~*
this).
get().erase( first, last, predicate );
702 template<
typename PT
707 return (~*
this).get().find( index );
724 template<
typename PT
729 return (~*
this).get().lowerBound( index );
746 template<
typename PT
751 return (~*
this).get().upperBound( index );
767 template<
typename PT,
typename VT >
771 template<
typename PT,
typename VT >
775 template<
typename PT,
typename VT >
779 template<
typename PT,
typename VT >
783 template<
typename PT,
typename VT >
786 template<
typename PT,
typename VT >
789 template<
typename PT,
typename VT >
792 template<
typename PT,
typename VT >
795 template<
typename PT,
typename VT >
798 template<
typename PT,
typename VT >
811 template<
typename PT
816 return proxy.begin();
828 template<
typename PT
833 return proxy.cbegin();
845 template<
typename PT
862 template<
typename PT
879 template<
typename PT
895 template<
typename PT
899 return proxy.capacity();
914 template<
typename PT
918 return proxy.nonZeros();
934 template<
typename PT
938 proxy.resize( n, preserve );
952 template<
typename PT
970 template<
typename PT
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
Header file for the SparseVector base class.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.The Reference_t alias declaration provides a ...
Definition: Aliases.h:330
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
Iterator end() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:270
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the IsRowVector type trait.
Header file for the IsIntegral type trait.
ConstIterator cbegin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:256
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the reset shim.
ElementType_t< VT > ElementType
Type of the sparse vector elements.
Definition: SparseVectorProxy.h:81
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition: SparseVectorProxy.h:489
ConstIterator_t< VT > ConstIterator
Iterator over constant elements.
Definition: SparseVectorProxy.h:87
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:482
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:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
ConstIterator cend() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:284
void append(size_t index, const ElementType &value, bool check=false) const
Appending an element to the represented sparse vector.
Definition: SparseVectorProxy.h:461
size_t nonZeros() const
Returns the number of non-zero elements in the represented vector.
Definition: SparseVectorProxy.h:337
Reference operator[](size_t index) const
Subscript operator for the direct access to vector elements.
Definition: SparseVectorProxy.h:197
Header file for the DisableIf class template.
Reference_t< VT > Reference
Reference to a non-constant vector value.
Definition: SparseVectorProxy.h:84
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SparseVectorProxy.h:749
void clear() const
Clearing the represented vector.
Definition: SparseVectorProxy.h:371
Iterator find(size_t index) const
Searches for a specific vector element.
Definition: SparseVectorProxy.h:705
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: SparseVectorProxy.h:82
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition: SparseVectorProxy.h:567
ResultType_t< VT > ResultType
Result type for expression template evaluations.
Definition: SparseVectorProxy.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
size_t capacity() const
Returns the maximum capacity of the represented vector.
Definition: SparseVectorProxy.h:320
Header file for the exception macros of the math module.
Iterator insert(size_t index, const ElementType &value) const
Inserting an element into the represented sparse vector.
Definition: SparseVectorProxy.h:423
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
Constraint on the data type.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
ConstReference_t< VT > ConstReference
Reference to a constant vector value.
Definition: SparseVectorProxy.h:85
void reset() const
Reset to the default initial value.
Definition: SparseVectorProxy.h:353
Iterator_t< VT > Iterator
Iterator over non-constant elements.
Definition: SparseVectorProxy.h:86
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.The Iterator_t alias declaration provides a co...
Definition: Aliases.h:190
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition: SparseVectorProxy.h:537
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
Iterator set(size_t index, const ElementType &value) const
Setting an element of the represented sparse vector.
Definition: SparseVectorProxy.h:396
Iterator begin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:242
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.The ConstReference_t alias declaration p...
Definition: Aliases.h:150
Proxy backend for sparse vector types.The SparseVectorProxy class serves as a backend for the Proxy c...
Definition: Forward.h:53
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
CompositeType_t< VT > CompositeType
Data type for composite expression templates.
Definition: SparseVectorProxy.h:83
void reserve(size_t n) const
Setting the minimum capacity of the represented vector.
Definition: SparseVectorProxy.h:512
size_t size() const
Returns the current size/dimension of the represented vector.
Definition: SparseVectorProxy.h:306
Iterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SparseVectorProxy.h:727
Reference at(size_t index) const
Checked access to the vector elements.
Definition: SparseVectorProxy.h:224
System settings for the inline keywords.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: SparseVectorProxy.h:92
Header file for the clear shim.
TransposeType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseVectorProxy.h:80