35 #ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
36 #define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
73 class SparseVectorProxy :
public SparseVector< PT, IsRowVector<VT>::value >
90 enum :
bool { smpAssignable = VT::smpAssignable };
96 inline Reference
operator[](
size_t index )
const;
97 inline Reference
at(
size_t index )
const;
99 inline Iterator
begin ()
const;
100 inline ConstIterator
cbegin()
const;
101 inline Iterator
end ()
const;
102 inline ConstIterator
cend ()
const;
109 inline size_t size()
const;
112 inline void reset()
const;
113 inline void clear()
const;
114 inline Iterator
set(
size_t index,
const ElementType& value )
const;
115 inline Iterator
insert(
size_t index,
const ElementType& value )
const;
116 inline void append(
size_t index,
const ElementType& value,
bool check=
false )
const;
117 inline void erase(
size_t index )
const;
118 inline Iterator
erase( Iterator pos )
const;
119 inline Iterator
erase( Iterator first, Iterator last )
const;
120 inline void resize(
size_t n,
bool preserve=
true )
const;
121 inline void reserve(
size_t n )
const;
123 template<
typename Other >
inline void scale(
const Other& scalar )
const;
130 inline Iterator
find (
size_t index )
const;
131 inline Iterator
find (
size_t i,
size_t j )
const;
132 inline Iterator
lowerBound(
size_t index )
const;
133 inline Iterator
lowerBound(
size_t i,
size_t j )
const;
134 inline Iterator
upperBound(
size_t index )
const;
135 inline Iterator
upperBound(
size_t i,
size_t j )
const;
169 template<
typename PT
174 if( (~*
this).isRestricted() ) {
178 return (~*
this).get()[index];
196 template<
typename PT
201 if( (~*
this).isRestricted() ) {
205 return (~*
this).get().at( index );
215 template<
typename PT
219 return (~*
this).get().begin();
229 template<
typename PT
233 return (~*
this).get().cbegin();
243 template<
typename PT
247 return (~*
this).get().end();
257 template<
typename PT
261 return (~*
this).get().cend();
279 template<
typename PT
283 return (~*
this).get().size();
293 template<
typename PT
297 return (~*
this).get().capacity();
310 template<
typename PT
314 return (~*
this).get().nonZeros();
326 template<
typename PT
332 reset( (~*
this).
get() );
344 template<
typename PT
350 clear( (~*
this).
get() );
368 template<
typename PT
373 if( (~*
this).isRestricted() ) {
377 return (~*
this).get().set( index, value );
395 template<
typename PT
400 if( (~*
this).isRestricted() ) {
404 return (~*
this).get().insert( index, value );
434 template<
typename PT
438 if( (~*
this).isRestricted() ) {
442 (~*
this).
get().append( index, value, check );
456 template<
typename PT
460 if( (~*
this).isRestricted() ) {
464 (~*
this).
get().erase( index );
478 template<
typename PT
482 if( (~*
this).isRestricted() ) {
486 return (~*
this).get().erase( pos );
501 template<
typename PT
506 if( (~*
this).isRestricted() ) {
510 return (~*
this).get().erase( first, last );
530 template<
typename PT
534 if( (~*
this).isRestricted() ) {
538 (~*
this).
get().resize( n, preserve );
553 template<
typename PT
557 if( (~*
this).isRestricted() ) {
561 (~*
this).
get().reserve( n );
573 template<
typename PT
575 template<
typename Other >
578 if( (~*
this).isRestricted() ) {
582 (~*
this).
get().scale( scalar );
608 template<
typename PT
613 return (~*
this).get().find( index );
630 template<
typename PT
635 return (~*
this).get().lowerBound( index );
652 template<
typename PT
657 return (~*
this).get().upperBound( index );
673 template<
typename PT,
typename VT >
677 template<
typename PT,
typename VT >
681 template<
typename PT,
typename VT >
685 template<
typename PT,
typename VT >
689 template<
typename PT,
typename VT >
692 template<
typename PT,
typename VT >
695 template<
typename PT,
typename VT >
698 template<
typename PT,
typename VT >
701 template<
typename PT,
typename VT >
704 template<
typename PT,
typename VT >
717 template<
typename PT
722 return proxy.begin();
734 template<
typename PT
739 return proxy.cbegin();
751 template<
typename PT
768 template<
typename PT
785 template<
typename PT
801 template<
typename PT
805 return proxy.capacity();
820 template<
typename PT
824 return proxy.nonZeros();
840 template<
typename PT
844 proxy.resize( n, preserve );
858 template<
typename PT
876 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:82
Header file for auxiliary alias declarations.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
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:81
void append(size_t index, const ElementType &value, bool check=false) const
Appending an element to the represented sparse vector.
Definition: SparseVectorProxy.h:436
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
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.
Iterator_< VT > Iterator
Iterator over non-constant elements.
Definition: SparseVectorProxy.h:84
TransposeType_< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseVectorProxy.h:78
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
BLAZE_ALWAYS_INLINE 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:298
BLAZE_ALWAYS_INLINE 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:232
void reset() const
Reset to the default initial value.
Definition: SparseVectorProxy.h:328
Iterator end() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:245
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:80
Iterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SparseVectorProxy.h:633
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Reference at(size_t index) const
Checked access to the vector elements.
Definition: SparseVectorProxy.h:199
size_t capacity() const
Returns the maximum capacity of the represented vector.
Definition: SparseVectorProxy.h:295
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SparseVectorProxy.h:655
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
ConstReference_< VT > ConstReference
Reference to a constant vector value.
Definition: SparseVectorProxy.h:83
ConstIterator_< VT > ConstIterator
Iterator over constant elements.
Definition: SparseVectorProxy.h:85
Iterator set(size_t index, const ElementType &value) const
Setting an element of the represented sparse vector.
Definition: SparseVectorProxy.h:371
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition: SparseVectorProxy.h:458
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
ConstIterator cend() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:259
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition: SparseVectorProxy.h:532
#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
Reference operator[](size_t index) const
Subscript operator for the direct access to vector elements.
Definition: SparseVectorProxy.h:172
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE 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:254
ResultType_< VT > ResultType
Result type for expression template evaluations.
Definition: SparseVectorProxy.h:77
Constraint on the data type.
size_t nonZeros() const
Returns the number of non-zero elements in the represented vector.
Definition: SparseVectorProxy.h:312
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
Iterator begin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:217
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition: SparseVectorProxy.h:576
Iterator find(size_t index) const
Searches for a specific vector element.
Definition: SparseVectorProxy.h:611
Iterator insert(size_t index, const ElementType &value) const
Inserting an element into the represented sparse vector.
Definition: SparseVectorProxy.h:398
void clear() const
Clearing the represented vector.
Definition: SparseVectorProxy.h:346
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
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:79
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
size_t size() const
Returns the current size/dimension of the represented vector.
Definition: SparseVectorProxy.h:281
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
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.
ConstIterator cbegin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:231
void reserve(size_t n) const
Setting the minimum capacity of the represented vector.
Definition: SparseVectorProxy.h:555