35 #ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 36 #define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 75 class SparseVectorProxy
76 :
public SparseVector< PT, IsRowVector<VT>::value >
93 enum :
bool { smpAssignable = VT::smpAssignable };
112 inline size_t size()
const;
115 inline void reset()
const;
116 inline void clear()
const;
117 inline void resize(
size_t n,
bool preserve=
true )
const;
118 inline void reserve(
size_t n )
const;
127 inline void append(
size_t index,
const ElementType& value,
bool check=
false )
const;
134 inline void erase(
size_t index )
const;
138 template<
typename Pred,
typename = DisableIf_< IsIntegral<Pred> > >
139 inline void erase( Pred predicate );
141 template<
typename Pred >
161 template<
typename Other >
inline void scale(
const Other& scalar )
const;
195 template<
typename PT
200 if( (~*
this).isRestricted() ) {
204 return (~*
this).get()[index];
222 template<
typename PT
227 if( (~*
this).isRestricted() ) {
231 return (~*
this).get().at( index );
241 template<
typename PT
245 return (~*
this).get().begin();
255 template<
typename PT
259 return (~*
this).get().cbegin();
269 template<
typename PT
273 return (~*
this).get().end();
283 template<
typename PT
287 return (~*
this).get().cend();
305 template<
typename PT
309 return (~*
this).get().size();
319 template<
typename PT
323 return (~*
this).get().capacity();
336 template<
typename PT
340 return (~*
this).get().nonZeros();
352 template<
typename PT
358 reset( (~*
this).
get() );
370 template<
typename PT
376 clear( (~*
this).
get() );
394 template<
typename PT
399 if( (~*
this).isRestricted() ) {
403 return (~*
this).get().set( index, value );
421 template<
typename PT
426 if( (~*
this).isRestricted() ) {
430 return (~*
this).get().insert( index, value );
460 template<
typename PT
464 if( (~*
this).isRestricted() ) {
468 (~*
this).
get().append( index, value, check );
488 template<
typename PT
492 if( (~*
this).isRestricted() ) {
496 (~*
this).
get().resize( n, preserve );
511 template<
typename PT
515 if( (~*
this).isRestricted() ) {
519 (~*
this).
get().reserve( n );
535 template<
typename PT
537 template<
typename Other >
540 if( (~*
this).isRestricted() ) {
544 (~*
this).
get().scale( scalar );
566 template<
typename PT
570 if( (~*
this).isRestricted() ) {
574 (~*
this).
get().erase( index );
588 template<
typename PT
592 if( (~*
this).isRestricted() ) {
596 return (~*
this).get().erase( pos );
611 template<
typename PT
616 if( (~*
this).isRestricted() ) {
620 return (~*
this).get().erase( first, last );
638 template<
typename PT
640 template<
typename Pred
644 if( (~*
this).isRestricted() ) {
648 (~*
this).
get().erase( predicate );
668 template<
typename PT
670 template<
typename Pred >
673 if( (~*
this).isRestricted() ) {
677 (~*
this).
get().erase( first, last, predicate );
703 template<
typename PT
708 return (~*
this).get().find( index );
725 template<
typename PT
730 return (~*
this).get().lowerBound( index );
747 template<
typename PT
752 return (~*
this).get().upperBound( index );
768 template<
typename PT,
typename VT >
772 template<
typename PT,
typename VT >
776 template<
typename PT,
typename VT >
780 template<
typename PT,
typename VT >
784 template<
typename PT,
typename VT >
787 template<
typename PT,
typename VT >
790 template<
typename PT,
typename VT >
793 template<
typename PT,
typename VT >
796 template<
typename PT,
typename VT >
799 template<
typename PT,
typename VT >
812 template<
typename PT
817 return proxy.begin();
829 template<
typename PT
834 return proxy.cbegin();
846 template<
typename PT
863 template<
typename PT
880 template<
typename PT
896 template<
typename PT
900 return proxy.capacity();
915 template<
typename PT
919 return proxy.nonZeros();
935 template<
typename PT
939 proxy.resize( n, preserve );
953 template<
typename PT
971 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.
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
Header file for the SparseVector base class.
Iterator end() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:271
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
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:257
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition: SparseVectorProxy.h:490
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
TransposeType_< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseVectorProxy.h:81
ConstIterator cend() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:285
void append(size_t index, const ElementType &value, bool check=false) const
Appending an element to the represented sparse vector.
Definition: SparseVectorProxy.h:462
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
size_t nonZeros() const
Returns the number of non-zero elements in the represented vector.
Definition: SparseVectorProxy.h:338
Reference operator[](size_t index) const
Subscript operator for the direct access to vector elements.
Definition: SparseVectorProxy.h:198
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
ReturnType_< VT > ReturnType
Return type for expression template evaluations.
Definition: SparseVectorProxy.h:83
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SparseVectorProxy.h:750
void clear() const
Clearing the represented vector.
Definition: SparseVectorProxy.h:372
Iterator find(size_t index) const
Searches for a specific vector element.
Definition: SparseVectorProxy.h:706
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition: SparseVectorProxy.h:568
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
ConstReference_< VT > ConstReference
Reference to a constant vector value.
Definition: SparseVectorProxy.h:86
#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:321
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:424
Constraint on the data type.
typename T::Reference Reference_
Alias declaration for nested Reference type definitions.The Reference_ alias declaration provides a c...
Definition: Aliases.h:303
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
void reset() const
Reset to the default initial value.
Definition: SparseVectorProxy.h:354
ConstIterator_< VT > ConstIterator
Iterator over constant elements.
Definition: SparseVectorProxy.h:88
Iterator_< VT > Iterator
Iterator over non-constant elements.
Definition: SparseVectorProxy.h:87
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition: SparseVectorProxy.h:538
Iterator set(size_t index, const ElementType &value) const
Setting an element of the represented sparse vector.
Definition: SparseVectorProxy.h:397
ElementType_< VT > ElementType
Type of the sparse vector elements.
Definition: SparseVectorProxy.h:82
Iterator begin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:243
Header file for the reset shim.
CompositeType_< VT > CompositeType
Data type for composite expression templates.
Definition: SparseVectorProxy.h:84
Proxy backend for sparse vector types.The SparseVectorProxy class serves as a backend for the Proxy c...
Definition: Forward.h:53
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
void reserve(size_t n) const
Setting the minimum capacity of the represented vector.
Definition: SparseVectorProxy.h:513
size_t size() const
Returns the current size/dimension of the represented vector.
Definition: SparseVectorProxy.h:307
ResultType_< VT > ResultType
Result type for expression template evaluations.
Definition: SparseVectorProxy.h:80
Iterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SparseVectorProxy.h:728
Reference at(size_t index) const
Checked access to the vector elements.
Definition: SparseVectorProxy.h:225
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
Reference_< VT > Reference
Reference to a non-constant vector value.
Definition: SparseVectorProxy.h:85
System settings for the inline keywords.