35 #ifndef _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
36 #define _BLAZE_MATH_PROXY_SPARSEVECTORPROXY_H_
72 class SparseVectorProxy :
public SparseVector< PT, IsRowVector<VT>::value >
89 enum { smpAssignable = VT::smpAssignable };
95 inline Reference
operator[](
size_t index )
const;
97 inline Iterator
begin ()
const;
98 inline ConstIterator
cbegin()
const;
99 inline Iterator
end ()
const;
100 inline ConstIterator
cend ()
const;
107 inline size_t size()
const;
110 inline void reset()
const;
111 inline void clear()
const;
112 inline Iterator
set(
size_t index,
const ElementType& value )
const;
113 inline Iterator
insert(
size_t index,
const ElementType& value )
const;
114 inline void append(
size_t index,
const ElementType& value,
bool check=
false )
const;
115 inline void erase(
size_t index )
const;
116 inline Iterator
erase( Iterator pos )
const;
117 inline Iterator
erase( Iterator first, Iterator last )
const;
118 inline void resize(
size_t n,
bool preserve=
true )
const;
119 inline void reserve(
size_t n )
const;
121 template<
typename Other >
inline void scale(
const Other& scalar )
const;
128 inline Iterator
find (
size_t index )
const;
129 inline Iterator
find (
size_t i,
size_t j )
const;
130 inline Iterator
lowerBound(
size_t index )
const;
131 inline Iterator
lowerBound(
size_t i,
size_t j )
const;
132 inline Iterator
upperBound(
size_t index )
const;
133 inline Iterator
upperBound(
size_t i,
size_t j )
const;
166 template<
typename PT
171 if( (~*
this).isRestricted() ) {
175 return (~*
this).get()[index];
185 template<
typename PT
189 return (~*
this).get().begin();
199 template<
typename PT
203 return (~*
this).get().cbegin();
213 template<
typename PT
217 return (~*
this).get().end();
227 template<
typename PT
231 return (~*
this).get().cend();
249 template<
typename PT
253 return (~*
this).get().size();
263 template<
typename PT
267 return (~*
this).get().capacity();
280 template<
typename PT
284 return (~*
this).get().nonZeros();
296 template<
typename PT
302 reset( (~*
this).
get() );
314 template<
typename PT
320 clear( (~*
this).
get() );
337 template<
typename PT
342 if( (~*
this).isRestricted() ) {
346 return (~*
this).get().set( index, value );
363 template<
typename PT
368 if( (~*
this).isRestricted() ) {
372 return (~*
this).get().insert( index, value );
401 template<
typename PT
405 if( (~*
this).isRestricted() ) {
409 (~*
this).
get().append( index, value, check );
422 template<
typename PT
426 if( (~*
this).isRestricted() ) {
430 (~*
this).
get().erase( index );
443 template<
typename PT
447 if( (~*
this).isRestricted() ) {
451 return (~*
this).get().erase( pos );
465 template<
typename PT
470 if( (~*
this).isRestricted() ) {
474 return (~*
this).get().erase( first, last );
493 template<
typename PT
497 if( (~*
this).isRestricted() ) {
501 (~*
this).
get().resize( n, preserve );
515 template<
typename PT
519 if( (~*
this).isRestricted() ) {
523 (~*
this).
get().reserve( n );
534 template<
typename PT
536 template<
typename Other >
539 if( (~*
this).isRestricted() ) {
543 (~*
this).
get().scale( scalar );
569 template<
typename PT
574 return (~*
this).get().find( index );
591 template<
typename PT
596 return (~*
this).get().lowerBound( index );
613 template<
typename PT
618 return (~*
this).get().upperBound( index );
634 template<
typename PT,
typename VT >
638 template<
typename PT,
typename VT >
642 template<
typename PT,
typename VT >
646 template<
typename PT,
typename VT >
650 template<
typename PT,
typename VT >
653 template<
typename PT,
typename VT >
656 template<
typename PT,
typename VT >
659 template<
typename PT,
typename VT >
662 template<
typename PT,
typename VT >
665 template<
typename PT,
typename VT >
678 template<
typename PT
683 return proxy.begin();
695 template<
typename PT
700 return proxy.cbegin();
712 template<
typename PT
729 template<
typename PT
746 template<
typename PT
762 template<
typename PT
766 return proxy.capacity();
781 template<
typename PT
785 return proxy.nonZeros();
801 template<
typename PT
805 proxy.resize( n, preserve );
819 template<
typename PT
837 template<
typename PT
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
Header file for the SparseVector base class.
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:229
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
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:292
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:250
void append(size_t index, const ElementType &value, bool check=false) const
Appending an element to the represented sparse vector.
Definition: SparseVectorProxy.h:403
VT::Iterator Iterator
Iterator over non-constant elements.
Definition: SparseVectorProxy.h:83
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
Header file for the IsRowVector type trait.
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:378
void reset() const
Reset to the default initial value.
Definition: SparseVectorProxy.h:298
Iterator end() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:215
Iterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SparseVectorProxy.h:594
size_t capacity() const
Returns the maximum capacity of the represented vector.
Definition: SparseVectorProxy.h:265
Iterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SparseVectorProxy.h:616
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
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseVectorProxy.h:79
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
Iterator set(size_t index, const ElementType &value) const
Setting an element of the represented sparse vector.
Definition: SparseVectorProxy.h:340
void erase(size_t index) const
Erasing an element from the sparse vector.
Definition: SparseVectorProxy.h:424
VT::Reference Reference
Reference to a non-constant vector value.
Definition: SparseVectorProxy.h:81
VT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseVectorProxy.h:77
ConstIterator cend() const
Returns an iterator just past the last element of the represented vector.
Definition: SparseVectorProxy.h:229
void resize(size_t n, bool preserve=true) const
Changing the size of the represented vector.
Definition: SparseVectorProxy.h:495
#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:79
VT::ResultType ResultType
Result type for expression template evaluations.
Definition: SparseVectorProxy.h:76
Reference operator[](size_t index) const
Subscript operator for the direct access to vector elements.
Definition: SparseVectorProxy.h:169
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
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:187
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:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
size_t nonZeros() const
Returns the number of non-zero elements in the represented vector.
Definition: SparseVectorProxy.h:282
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Iterator begin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:187
void scale(const Other &scalar) const
Scaling of the sparse vector by the scalar value scalar ( ).
Definition: SparseVectorProxy.h:537
VT::ElementType ElementType
Type of the sparse vector elements.
Definition: SparseVectorProxy.h:78
Iterator find(size_t index) const
Searches for a specific vector element.
Definition: SparseVectorProxy.h:572
Iterator insert(size_t index, const ElementType &value) const
Inserting an element into the represented sparse vector.
Definition: SparseVectorProxy.h:366
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
void clear() const
Clearing the represented vector.
Definition: SparseVectorProxy.h:316
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Proxy backend for sparse vector types.The SparseVectorProxy class serves as a backend for the Proxy c...
Definition: Forward.h:53
VT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseVectorProxy.h:84
VT::ConstReference ConstReference
Reference to a constant vector value.
Definition: SparseVectorProxy.h:82
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
size_t size() const
Returns the current size/dimension of the represented vector.
Definition: SparseVectorProxy.h:251
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Header file for exception macros.
System settings for the inline keywords.
ConstIterator cbegin() const
Returns an iterator to the first element of the represented vector.
Definition: SparseVectorProxy.h:201
VT::CompositeType CompositeType
Data type for composite expression templates.
Definition: SparseVectorProxy.h:80
void reserve(size_t n) const
Setting the minimum capacity of the represented vector.
Definition: SparseVectorProxy.h:517