35 #ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 36 #define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_ 75 class SparseVectorProxy :
public SparseVector< PT, IsRowVector<VT>::value >
92 enum :
bool { smpAssignable = VT::smpAssignable };
98 inline Reference
operator[](
size_t index )
const;
99 inline Reference
at(
size_t index )
const;
101 inline Iterator
begin ()
const;
102 inline ConstIterator
cbegin()
const;
103 inline Iterator
end ()
const;
104 inline ConstIterator
cend ()
const;
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;
124 inline Iterator
set (
size_t index,
const ElementType& value )
const;
125 inline Iterator
insert(
size_t index,
const ElementType& value )
const;
126 inline void append(
size_t index,
const ElementType& value,
bool check=
false )
const;
133 inline void erase(
size_t index )
const;
134 inline Iterator
erase( Iterator pos )
const;
135 inline Iterator
erase( Iterator first, Iterator last )
const;
137 template<
typename Pred,
typename = DisableIf_< IsIntegral<Pred> > >
138 inline void erase( Pred predicate );
140 template<
typename Pred >
141 inline void erase( Iterator first, Iterator last, Pred predicate );
148 inline Iterator
find (
size_t index )
const;
149 inline Iterator
find (
size_t i,
size_t j )
const;
150 inline Iterator
lowerBound(
size_t index )
const;
151 inline Iterator
lowerBound(
size_t i,
size_t j )
const;
152 inline Iterator
upperBound(
size_t index )
const;
153 inline Iterator
upperBound(
size_t i,
size_t j )
const;
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 );
530 template<
typename PT
532 template<
typename Other >
535 if( (~*
this).isRestricted() ) {
539 (~*
this).
get().scale( scalar );
561 template<
typename PT
565 if( (~*
this).isRestricted() ) {
569 (~*
this).
get().erase( index );
583 template<
typename PT
587 if( (~*
this).isRestricted() ) {
591 return (~*
this).get().erase( pos );
606 template<
typename PT
611 if( (~*
this).isRestricted() ) {
615 return (~*
this).get().erase( first, last );
633 template<
typename PT
635 template<
typename Pred
639 if( (~*
this).isRestricted() ) {
643 (~*
this).
get().erase( predicate );
663 template<
typename PT
665 template<
typename Pred >
668 if( (~*
this).isRestricted() ) {
672 (~*
this).
get().erase( first, last, predicate );
698 template<
typename PT
703 return (~*
this).get().find( index );
720 template<
typename PT
725 return (~*
this).get().lowerBound( index );
742 template<
typename PT
747 return (~*
this).get().upperBound( index );
763 template<
typename PT,
typename VT >
767 template<
typename PT,
typename VT >
771 template<
typename PT,
typename VT >
775 template<
typename PT,
typename VT >
779 template<
typename PT,
typename VT >
782 template<
typename PT,
typename VT >
785 template<
typename PT,
typename VT >
788 template<
typename PT,
typename VT >
791 template<
typename PT,
typename VT >
794 template<
typename PT,
typename VT >
807 template<
typename PT
812 return proxy.begin();
824 template<
typename PT
829 return proxy.cbegin();
841 template<
typename PT
858 template<
typename PT
875 template<
typename PT
891 template<
typename PT
895 return proxy.capacity();
910 template<
typename PT
914 return proxy.nonZeros();
930 template<
typename PT
934 proxy.resize( n, preserve );
948 template<
typename PT
966 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
Reference_< VT > Reference
Reference to a non-constant vector value.
Definition: SparseVectorProxy.h:84
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.
CompositeType_< VT > CompositeType
Data type for composite expression templates.
Definition: SparseVectorProxy.h:83
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:533
Header file for the IsRowVector type trait.
Header file for the IsIntegral type trait.
Iterator_< VT > Iterator
Iterator over non-constant elements.
Definition: SparseVectorProxy.h:86
ConstIterator cbegin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:256
TransposeType_< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseVectorProxy.h:80
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition: SparseVectorProxy.h:489
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
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
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
ReturnType_< VT > ReturnType
Return type for expression template evaluations.
Definition: SparseVectorProxy.h:82
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
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
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SparseVectorProxy.h:745
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:701
ConstReference_< VT > ConstReference
Reference to a constant vector value.
Definition: SparseVectorProxy.h:85
ConstIterator_< VT > ConstIterator
Iterator over constant elements.
Definition: SparseVectorProxy.h:87
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition: SparseVectorProxy.h:563
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
#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
ResultType_< VT > ResultType
Result type for expression template evaluations.
Definition: SparseVectorProxy.h:79
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:283
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
void reset() const
Reset to the default initial value.
Definition: SparseVectorProxy.h:353
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition: SparseVectorProxy.h:533
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
Header file for the reset shim.
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
ElementType_< VT > ElementType
Type of the sparse vector elements.
Definition: SparseVectorProxy.h:81
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: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:723
Reference at(size_t index) const
Checked access to the vector elements.
Definition: SparseVectorProxy.h:224
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
System settings for the inline keywords.