Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::numeric::ublas::compressed_vector< T, IB, IA, TA > Class Template Reference

Compressed array based sparse vector. More...

#include <vector_sparse.hpp>

Inheritance diagram for boost::numeric::ublas::compressed_vector< T, IB, IA, TA >:
Collaboration diagram for boost::numeric::ublas::compressed_vector< T, IB, IA, TA >:

Classes

class  const_iterator
 
class  iterator
 

Public Types

typedef IA::value_type size_type
 
typedef IA::difference_type difference_type
 
typedef T value_type
 
typedef const Tconst_reference
 
typedef Treference
 
typedef IA index_array_type
 
typedef TA value_array_type
 
typedef const vector_reference
< const self_type
const_closure_type
 
typedef vector_reference
< self_type
closure_type
 
typedef self_type vector_temporary_type
 
typedef sparse_tag storage_category
 
typedef reverse_iterator_base
< const_iterator
const_reverse_iterator
 
typedef reverse_iterator_base
< iterator
reverse_iterator
 
typedef compressed_vector< T,
IB, IA, TA > 
container_type
 
typedef vector_tag type_category
 
typedef E expression_type
 

Public Member Functions

BOOST_UBLAS_INLINE compressed_vector ()
 
BOOST_UBLAS_INLINE compressed_vector (size_type size, size_type non_zeros=0)
 
BOOST_UBLAS_INLINE compressed_vector (const compressed_vector &v)
 
template<class AE >
BOOST_UBLAS_INLINE compressed_vector (const vector_expression< AE > &ae, size_type non_zeros=0)
 
BOOST_UBLAS_INLINE size_type size () const
 
BOOST_UBLAS_INLINE size_type nnz_capacity () const
 
BOOST_UBLAS_INLINE size_type nnz () const
 
BOOST_UBLAS_INLINE
index_array_type::size_type 
filled () const
 
BOOST_UBLAS_INLINE const
index_array_type
index_data () const
 
BOOST_UBLAS_INLINE const
value_array_type
value_data () const
 
BOOST_UBLAS_INLINE void set_filled (const typename index_array_type::size_type &filled)
 
BOOST_UBLAS_INLINE
index_array_type
index_data ()
 
BOOST_UBLAS_INLINE
value_array_type
value_data ()
 
BOOST_UBLAS_INLINE void resize (size_type size, bool preserve=true)
 
BOOST_UBLAS_INLINE void reserve (size_type non_zeros, bool preserve=true)
 
BOOST_UBLAS_INLINE pointer find_element (size_type i)
 
BOOST_UBLAS_INLINE const_pointer find_element (size_type i) const
 
BOOST_UBLAS_INLINE const_reference operator() (size_type i) const
 
BOOST_UBLAS_INLINE true_reference ref (size_type i)
 
BOOST_UBLAS_INLINE reference operator() (size_type i)
 
BOOST_UBLAS_INLINE const_reference operator[] (size_type i) const
 
BOOST_UBLAS_INLINE reference operator[] (size_type i)
 
BOOST_UBLAS_INLINE true_reference insert_element (size_type i, const_reference t)
 
BOOST_UBLAS_INLINE void erase_element (size_type i)
 
BOOST_UBLAS_INLINE void clear ()
 
BOOST_UBLAS_INLINE
compressed_vector
operator= (const compressed_vector &v)
 
template<class C >
BOOST_UBLAS_INLINE
compressed_vector
operator= (const vector_container< C > &v)
 
BOOST_UBLAS_INLINE
compressed_vector
assign_temporary (compressed_vector &v)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
operator= (const vector_expression< AE > &ae)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
assign (const vector_expression< AE > &ae)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
operator+= (const vector_expression< AE > &ae)
 
template<class C >
BOOST_UBLAS_INLINE
compressed_vector
operator+= (const vector_container< C > &v)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
plus_assign (const vector_expression< AE > &ae)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
operator-= (const vector_expression< AE > &ae)
 
template<class C >
BOOST_UBLAS_INLINE
compressed_vector
operator-= (const vector_container< C > &v)
 
template<class AE >
BOOST_UBLAS_INLINE
compressed_vector
minus_assign (const vector_expression< AE > &ae)
 
template<class AT >
BOOST_UBLAS_INLINE
compressed_vector
operator*= (const AT &at)
 
template<class AT >
BOOST_UBLAS_INLINE
compressed_vector
operator/= (const AT &at)
 
BOOST_UBLAS_INLINE void swap (compressed_vector &v)
 
BOOST_UBLAS_INLINE void push_back (size_type i, const_reference t)
 
BOOST_UBLAS_INLINE void pop_back ()
 
const_iterator find (size_type i) const
 
iterator find (size_type i)
 
BOOST_UBLAS_INLINE const_iterator begin () const
 
BOOST_UBLAS_INLINE const_iterator cbegin () const
 
BOOST_UBLAS_INLINE const_iterator end () const
 
BOOST_UBLAS_INLINE const_iterator cend () const
 
BOOST_UBLAS_INLINE iterator begin ()
 
BOOST_UBLAS_INLINE iterator end ()
 
BOOST_UBLAS_INLINE
const_reverse_iterator 
rbegin () const
 
BOOST_UBLAS_INLINE
const_reverse_iterator 
crbegin () const
 
BOOST_UBLAS_INLINE
const_reverse_iterator 
rend () const
 
BOOST_UBLAS_INLINE
const_reverse_iterator 
crend () const
 
BOOST_UBLAS_INLINE reverse_iterator rbegin ()
 
BOOST_UBLAS_INLINE reverse_iterator rend ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 
BOOST_UBLAS_INLINE const
container_type
operator() () const
 
BOOST_UBLAS_INLINE container_typeoperator() ()
 

Static Public Member Functions

static BOOST_UBLAS_INLINE size_type index_base ()
 

Static Public Attributes

static const unsigned complexity
 

Friends

class iterator
 
class const_iterator
 
BOOST_UBLAS_INLINE friend void swap (compressed_vector &v1, compressed_vector &v2)
 

Detailed Description

template<class T, std::size_t IB, class IA, class TA>
class boost::numeric::ublas::compressed_vector< T, IB, IA, TA >

Compressed array based sparse vector.

a sparse vector of values of type T of variable size. The non zero values are stored as two seperate arrays: an index array and a value array. The index array is always sorted and there is at most one entry for each index. Inserting an element can be time consuming. If the vector contains a few zero entries, then it is better to have a normal vector. If the vector has a very high dimension with a few non-zero values, then this vector is very memory efficient (at the cost of a few more computations).

For a $n$-dimensional compressed vector and $0 \leq i < n$ the non-zero elements $v_i$ are mapped to consecutive elements of the index and value container, i.e. for elements $k = v_{i_1}$ and $k + 1 = v_{i_2}$ of these containers holds $i_1 < i_2$.

Supported parameters for the adapted array (indices and values) are unbounded_array<> , bounded_array<> and std::vector<>.

Template Parameters
Tthe type of object stored in the vector (like double, float, complex, etc...)
IBthe index base of the compressed vector. Default is 0. Other supported value is 1
IAthe type of adapted array for indices. Default is unbounded_array<std::size_t>
TAthe type of adapted array for values. Default is unbounded_array<T>

Member Typedef Documentation

template<class T, std::size_t IB, class IA, class TA>
typedef vector_reference<self_type> boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::closure_type
template<class T, std::size_t IB, class IA, class TA>
typedef const vector_reference<const self_type> boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::const_closure_type
template<class T, std::size_t IB, class IA, class TA>
typedef const T& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::const_reference
template<class T, std::size_t IB, class IA, class TA>
typedef reverse_iterator_base<const_iterator> boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::const_reverse_iterator
template<class T, std::size_t IB, class IA, class TA>
typedef IA::difference_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::difference_type
template<class E>
typedef E boost::numeric::ublas::vector_expression< E >::expression_type
inherited
template<class T, std::size_t IB, class IA, class TA>
typedef IA boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::index_array_type
template<class T, std::size_t IB, class IA, class TA>
typedef T& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::reference
template<class T, std::size_t IB, class IA, class TA>
typedef reverse_iterator_base<iterator> boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::reverse_iterator
template<class T, std::size_t IB, class IA, class TA>
typedef IA::value_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::size_type
template<class T, std::size_t IB, class IA, class TA>
typedef sparse_tag boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::storage_category
template<class T, std::size_t IB, class IA, class TA>
typedef TA boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::value_array_type
template<class T, std::size_t IB, class IA, class TA>
typedef T boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::value_type
template<class T, std::size_t IB, class IA, class TA>
typedef self_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::vector_temporary_type

Constructor & Destructor Documentation

template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::compressed_vector ( )
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::compressed_vector ( size_type  size,
size_type  non_zeros = 0 
)
inlineexplicit
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::compressed_vector ( const compressed_vector< T, IB, IA, TA > &  v)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::compressed_vector ( const vector_expression< AE > &  ae,
size_type  non_zeros = 0 
)
inline

Member Function Documentation

template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::assign ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::begin ( void  )
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::cbegin ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::cend ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::clear ( void  )
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::crbegin ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::crend ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::end ( void  )
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::erase_element ( size_type  i)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE index_array_type::size_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::filled ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::find ( size_type  i)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE pointer boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::find_element ( size_type  i)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_pointer boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::find_element ( size_type  i) const
inline
template<class T, std::size_t IB, class IA, class TA>
static BOOST_UBLAS_INLINE size_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::index_base ( )
inlinestatic
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const index_array_type& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::index_data ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE index_array_type& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::index_data ( )
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::minus_assign ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE size_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::nnz ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE size_type boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::nnz_capacity ( ) const
inline
BOOST_UBLAS_INLINE const container_type& boost::numeric::ublas::vector_container< compressed_vector< T, IB, IA, TA > >::operator() ( ) const
inlineinherited
BOOST_UBLAS_INLINE container_type& boost::numeric::ublas::vector_container< compressed_vector< T, IB, IA, TA > >::operator() ( )
inlineinherited
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator() ( size_type  i) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE reference boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator() ( size_type  i)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AT >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator*= ( const AT &  at)
inline

References boost::xpressive::at.

template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator+= ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class C >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator+= ( const vector_container< C > &  v)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator-= ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class C >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator-= ( const vector_container< C > &  v)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AT >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator/= ( const AT &  at)
inline

References boost::xpressive::at.

template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator= ( const compressed_vector< T, IB, IA, TA > &  v)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator= ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator[] ( size_type  i) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE reference boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::operator[] ( size_type  i)
inline
template<class T, std::size_t IB, class IA, class TA>
template<class AE >
BOOST_UBLAS_INLINE compressed_vector& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::plus_assign ( const vector_expression< AE > &  ae)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::pop_back ( )
inline

References BOOST_UBLAS_CHECK.

template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::push_back ( size_type  i,
const_reference  t 
)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::rbegin ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::rbegin ( )
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::rend ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE reverse_iterator boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::rend ( )
inline
template<class T, std::size_t IB, class IA, class TA>
template<class Archive >
void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::serialize ( Archive &  ar,
const unsigned  int 
)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::set_filled ( const typename index_array_type::size_type &  filled)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE void boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::swap ( compressed_vector< T, IB, IA, TA > &  v)
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE const value_array_type& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::value_data ( ) const
inline
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE value_array_type& boost::numeric::ublas::compressed_vector< T, IB, IA, TA >::value_data ( )
inline

Friends And Related Function Documentation

template<class T, std::size_t IB, class IA, class TA>
friend class const_iterator
friend
template<class T, std::size_t IB, class IA, class TA>
friend class iterator
friend
template<class T, std::size_t IB, class IA, class TA>
BOOST_UBLAS_INLINE friend void swap ( compressed_vector< T, IB, IA, TA > &  v1,
compressed_vector< T, IB, IA, TA > &  v2 
)
friend

Member Data Documentation

const unsigned boost::numeric::ublas::vector_container< compressed_vector< T, IB, IA, TA > >::complexity
staticinherited

The documentation for this class was generated from the following files: