1 #ifndef _utl_SparseVector_h_
2 #define _utl_SparseVector_h_
7 #include <boost/lambda/lambda.hpp>
35 template<
typename T =
double>
47 template<
class IteratorType,
typename ValueType>
79 (*
this)(
it.GetIndex()) =
it();
126 unsigned int erased = 0;
209 (*
this)(it.GetIndex()) +=
it();
220 (*
this)(it.GetIndex()) -=
it();
234 template<
typename T,
typename U>
235 typename boost::lambda::return_type_2<
236 boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
242 typedef typename boost::lambda::return_type_2<
243 boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
278 template<
class Stream,
typename T>
281 const unsigned int size,
const char separator =
' ')
291 for (
unsigned int i = 1; i < size; ++i)
293 s << separator <<
'.';
295 s << separator << v[i];
308 template<
typename T,
typename U>
309 class plain_return_type_2<
310 arithmetic_action<multiply_action>,
311 utl::SparseVector<T>,
318 arithmetic_action<multiply_action>,
332 #include <utl/SparseMatrixVectorOp.h>
ConstIterator Find(const IndexType index) const
return_type_2< arithmetic_action< multiply_action >, T, U >::type res_type
bool operator!=(const SparseVector< T > &v) const
bool operator==(const SparseVector< U > &v) const
Sparse container class for vectorial data.
ConstIterator SparseBegin() const
MapType::const_iterator MapConstIterator
void Erase(const MapIterator it)
SparseVector & operator-=(const SparseVector< U > &m)
vector subtraction
IteratorTransformer< MapIterator, T > Iterator
T & operator()(const IndexType index)
creating element access
MapType::iterator MapIterator
IteratorTransformer< MapConstIterator, const T > ConstIterator
unsigned int Reclaim()
remove "empty" elements (that are equal to the initializer)
Iterator Find(const IndexType index)
unsigned int GetNonEmptySize() const
SparseVector & operator*=(const U &value)
multiplication with scalar
ConstIterator SparseEnd() const
Vector operator*(const double d, const Vector &v)
const T & GetInitializer() const
bool operator==(const SparseVector< T > &v) const
const T & operator()(const IndexType index) const
const T & operator[](const IndexType index) const
noncreating element access
bool operator!=(const SparseVector< U > &v) const
std::map< IndexType, T > MapType
Stream & Output(Stream &s, const SparseMatrix< T > &m, const typename SparseMatrix< T >::IndexType rows, const typename SparseMatrix< T >::IndexType columns, const char separator= ' ')
SparseVector & operator+=(const SparseVector< U > &m)
vector addition
MapType::value_type MapValueType