AbstractLinAlgPack::SparseVector< T_Element, T_Alloc > Class Template Reference

Sparse Vector class template. More...

#include <AbstractLinAlgPack_SparseVectorClassDecl.hpp>

Inheritance diagram for AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >:

[legend]
List of all members.

Public Types.

typedef T_Alloc allocator_type
 
typedef T_Element element_type
 
typedef AbstractLinAlgPack::size_type size_type
 
typedef ptrdiff_t difference_type
 
typedef element_typeiterator
 
typedef const element_typeconst_iterator
 
typedef std::reverse_iterator<
iterator
reverse_iterator
 
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
 
typedef SparseVectorUtilityPack::DoesNotExistException DoesNotExistException
 
typedef SparseVectorUtilityPack::NotSortedException NotSortedException
 
typedef SparseVectorUtilityPack::DuplicateIndexesException DuplicateIndexesException
 
typedef SparseVectorUtilityPack::OutOfRoomException OutOfRoomException
 
typedef SparseVectorUtilityPack::UnsizedException UnsizedException
 
typedef SparseVectorUtilityPack::NoNonZeroElementsException NoNonZeroElementsException
 

Constuctors

 SparseVector (const allocator_type &alloc=allocator_type())
 Constructs a sparse vector with no elements (nz() == dim() == 0#) and assumes the elements are not sorted.
 SparseVector (bool assume_sorted, const allocator_type &alloc=allocator_type())
 Constructs a sparse vector with no elements (nz() == dim() == 0#).
 SparseVector (size_type size, size_type max_nz, difference_type offset=0, bool assume_sorted=false, const allocator_type &alloc=allocator_type())
 Constructs a sparse vector of size #size# with storage for max_nz# elements (nz() == 0#).
 SparseVector (const SparseVector< T_Element, T_Alloc > &sp_vec)
 Constructs a sparse vector from another sparse vector.
 SparseVector (SparseVectorSlice< T_Element > sp_vec_slc, const allocator_type &alloc=allocator_type())
 Constructs a sparse vector of from a sparse vector slice.
 ~SparseVector ()
 Destructor (frees storage for elements).

SparseVectorTemplateInterface for linear algebra operations

size_type dim () const
 Return the number of elements in the full vector.
size_type nz () const
 Return the number of non-zero elements.
difference_type offset () const
 Return the offset for the indexes (ith real index = begin()[i-1]->index() + offset()# , for i = 1,,,nz()#).
bool is_sorted () const
 Return true if the sequence is sorted.

Iterator access to elements.

These functions return random access iterators that yield SparseElementTemplateInterface objects when dereferenced. This is required for the template argument.

iterator begin ()
 Returns iterator that iterates forward through the nonzero elements.
const_iterator begin () const
 
iterator end ()
const_iterator end () const
 
reverse_iterator rbegin ()
 Returns iterator that iterates backward through the nonzero elements.
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
const_reverse_iterator rend () const
 

Element setup and modification

void resize (size_type size, size_type max_nz, difference_type offset=0)
 Resize to #size# with a maximum of max_nz# non-zero elements.
void uninitialized_resize (size_type size, size_type nz, size_type max_nz, difference_type offset=0)
 Resize to #size# with a max_nz# uninitialized non-zero elements.
size_type max_nz () const
 Return the max number of elements that can be held without resizing.
void add_element (element_type ele)
 Add an unsorted element.
void insert_element (element_type ele)
 Add an element into a sorted sequence.
void assume_sorted (bool assume_is_sorted)
 Called by the client to inform this sparse vector object that the elements be assumed to be in sequence and it is the clients responcibiliy to make sure that it is.
void sort ()
 Sort the elements into assending order by index.
void assert_valid_and_sorted () const
 Assert that sparse vector is sorted.

Lookup an element.

If element v(i) exists, then a pointer to the element will be returned. If v(i) does not exist, then the NULL pointer will be returned.

If i is out of range then a std::out_of_range exception will be thrown.

If the elements are sored then this operation is O(log(nz)) for a binary search. Otherwise, it requries a O(nz) linear search.

element_typelookup_element (size_type i)
 
const element_typelookup_element (size_type i) const
 

Creating a slice (subregion) of the sparse vector.

If the vector is not sorted (#is_sorted() == false#) then all of these functions will throw an exception (#NotSortedException#).

** Say something about the cost of these operations! **

 operator SparseVectorSlice ()
 Allow an implicit conversion to a SparseVectorSlice<> object.
 operator const SparseVectorSlice () const
 
SparseVectorSlice< T_Element > operator() ()
 Returns a SparseVectorSlice representing the entire sparse vector.
const SparseVectorSlice< T_Element > operator() () const
 
SparseVectorSlice< T_Element > operator() (const Range1D &rng)
const SparseVectorSlice< T_Element > operator() (const Range1D &rng) const
 
SparseVectorSlice< T_Element > operator() (size_type lbound, size_type ubound)
const SparseVectorSlice< T_Element > operator() (size_type lbound, size_type ubound) const
 Same as above.

Public Member Functions

SparseVector< T_Element, T_Alloc > & operator= (const SparseVector< T_Element, T_Alloc > &sp_vec)
 Assignment operator.
SparseVector< T_Element, T_Alloc > & operator= (const SparseVectorSlice< T_Element > &sp_vec_slc)
 Assignment operator.
EOverLap overlap (const SparseVectorSlice< T_Element > &sv) const

Private Types

typedef SparseVectorUtilityPack::SpVecIndexLookup<
element_type
SpVecIndexLookup
 

Private Member Functions

void assert_is_sorted () const
void assert_space (size_type n) const
 Assert (#OutOfRoom#) that there is room for n elements.
void assert_sized_with_mem_set () const
 Assert dim() > 0# (UnsizedException#) and #index_lookup_.ele() != 0# (NoNonZeroElementsException#).
SparseVectorSlice< T_Element > get_whole_sp_vec ()
 Return the entire vector slice.
const SparseVectorSlice< T_Element > get_whole_sp_vec () const
 
SparseVectorSlice< T_Element > get_slice (const Range1D &rng) const
 Return a SparseVectorSlice (inplementation for indexing operators).

Private Attributes

allocator_type alloc_
size_type size_
size_type max_nz_
SpVecIndexLookup index_lookup_
bool assume_sorted_
bool know_is_sorted_

Detailed Description

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
class AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >

Sparse Vector class template.

This is a class for abstracting a sparse vector of a templated element type. All of the operations are based on the element type. Access to the elements is provided by iterators. It is also templated by an allocator that is that is used to allocate memory for the nonzero elements.

The templated type T_Element must support the following interface (SparseElementTemplateInterface): {description} [value_type] public typedef for the stored value of the element [index_type] public typedef for the stored index of the element [value_type& value()] function returning a lvalue for the value of the element [value_type value() const] const function returning a rvalue for the value of the element [index_type index() const] const function returning a rvalue for the index of the element. [T_Element& operator=(const T_Element&)] assignment operator [T_Element(const T_Element&)] copy constructor {description}

Definition at line 114 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.


Member Typedef Documentation

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef T_Alloc AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::allocator_type
 

Definition at line 120 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef T_Element AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::element_type
 

Definition at line 122 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef AbstractLinAlgPack::size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::size_type
 

Definition at line 124 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef ptrdiff_t AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::difference_type
 

Definition at line 126 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef element_type* AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::iterator
 

Definition at line 128 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef const element_type* AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::const_iterator
 

Definition at line 130 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef std::reverse_iterator<iterator> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::reverse_iterator
 

Definition at line 144 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef std::reverse_iterator<const_iterator> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::const_reverse_iterator
 

Definition at line 146 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::DoesNotExistException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::DoesNotExistException
 

Definition at line 151 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::NotSortedException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::NotSortedException
 

Definition at line 153 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::DuplicateIndexesException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::DuplicateIndexesException
 

Definition at line 155 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::OutOfRoomException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::OutOfRoomException
 

Definition at line 157 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::UnsizedException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::UnsizedException
 

Definition at line 159 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::NoNonZeroElementsException AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::NoNonZeroElementsException
 

Definition at line 161 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
typedef SparseVectorUtilityPack::SpVecIndexLookup<element_type> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SpVecIndexLookup [private]
 

Definition at line 462 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.


Constructor & Destructor Documentation

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SparseVector const allocator_type alloc = allocator_type()  )  [inline]
 

Constructs a sparse vector with no elements (nz() == dim() == 0#) and assumes the elements are not sorted.

Definition at line 825 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SparseVector bool  assume_sorted,
const allocator_type alloc = allocator_type()
[inline]
 

Constructs a sparse vector with no elements (nz() == dim() == 0#).

Definition at line 830 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SparseVector size_type  size,
size_type  max_nz,
difference_type  offset = 0,
bool  assume_sorted = false,
const allocator_type alloc = allocator_type()
[inline]
 

Constructs a sparse vector of size #size# with storage for max_nz# elements (nz() == 0#).

Definition at line 835 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SparseVector const SparseVector< T_Element, T_Alloc > &  sp_vec  ) 
 

Constructs a sparse vector from another sparse vector.

Copies the complete state including the same max_nz() but a fresh copy of the elements are made.

Definition at line 90 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::SparseVector SparseVectorSlice< T_Element >  sp_vec_slc,
const allocator_type alloc = allocator_type()
 

Constructs a sparse vector of from a sparse vector slice.

Definition at line 118 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::~SparseVector  )  [inline]
 

Destructor (frees storage for elements).

Definition at line 843 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.


Member Function Documentation

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc > & AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator= const SparseVector< T_Element, T_Alloc > &  sp_vec  ) 
 

Assignment operator.

If max_nz() > sp_vec.nz()# then no new allocation takes place otherwise #this# will will be resized to sp_vec.nz()#.

Definition at line 149 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc > & AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator= const SparseVectorSlice< T_Element > &  sp_vec_slc  ) 
 

Assignment operator.

If max_nz() > sp_vec_slc.nz()# then no new allocation takes place otherwise #this# will will be resized to sp_vec_slc.nz()#.

Definition at line 197 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
EOverLap AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::overlap const SparseVectorSlice< T_Element > &  sv  )  const
 

Returns the degree of memory overlap of this SparseVector and a SparseVectorSlice.

Returns:
{description} [NO_OVERLAP] There is no memory overlap between this and sv [SOME_OVERLAP] There is some memory locations that this and sv share [SAME_MEM] The DVectorSlice objects this and sv share the exact same memory locations. {description}

Definition at line 243 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::dim  )  const [inline]
 

Return the number of elements in the full vector.

Definition at line 850 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::nz  )  const [inline]
 

Return the number of non-zero elements.

Definition at line 855 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::difference_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::offset  )  const [inline]
 

Return the offset for the indexes (ith real index = begin()[i-1]->index() + offset()# , for i = 1,,,nz()#).

Definition at line 860 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
bool AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::is_sorted  )  const [inline]
 

Return true if the sequence is sorted.

If sorted() was called prior to this then it is garrented to be sorted and if assume_sorted(true) was called then a client is assumed to be responcible for it being sorted by it can not be garrented to be sorted.

Definition at line 865 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::begin  )  [inline]
 

Returns iterator that iterates forward through the nonzero elements.

If is_sorted() == true# then the elements will be forward iterated in accending indexes.

Definition at line 870 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::const_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::begin  )  const [inline]
 

Definition at line 875 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::end  )  [inline]
 

Definition at line 880 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::const_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::end  )  const [inline]
 

Definition at line 885 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::reverse_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::rbegin  )  [inline]
 

Returns iterator that iterates backward through the nonzero elements.

If is_sorted() == true# then the elements will be forward iterated in deaccending indexes.

Definition at line 890 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::const_reverse_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::rbegin  )  const [inline]
 

Definition at line 895 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::reverse_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::rend  )  [inline]
 

Definition at line 900 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::const_reverse_iterator AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::rend  )  const [inline]
 

Definition at line 905 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::resize size_type  size,
size_type  max_nz,
difference_type  offset = 0
 

Resize to #size# with a maximum of max_nz# non-zero elements.

This does not preserve the existing elements already in the sparse vector. If you pass in #size == 0# or max_nz == 0# then the storage will be deallocated and no storage will be reallocated.

Definition at line 265 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::uninitialized_resize size_type  size,
size_type  nz,
size_type  max_nz,
difference_type  offset = 0
 

Resize to #size# with a max_nz# uninitialized non-zero elements.

This function has the same basic behavior as resize(...)# accept on return nz()# will equal nz#. The elements are initialized to garbage so it is imparative that the client initialize the elements before the sparse vector is used.

Definition at line 305 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::max_nz  )  const [inline]
 

Return the max number of elements that can be held without resizing.

Definition at line 912 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::add_element element_type  ele  )  [inline]
 

Add an unsorted element.

If nz() = max_nz()#) then the exception OutOfRoomException will be thrown.

If you want to add more elements than you have reserved space for in the construction or resize operation then you have to mannually copy the elements in the sparse vector, resize the sparse vector, and then readd the elements including the extra ones you want to add.

Definition at line 917 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::insert_element element_type  ele  ) 
 

Add an element into a sorted sequence.

If nz() = max_nz()#) then the exception OutOfRoomException will be thrown.

If you want to add more elements than you have reserved space for in the construction or resize operation then you have to mannually copy the elements in the sparse vector, resize the sparse vector, and then readd the elements including the extra ones you want to add.

Definition at line 319 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assume_sorted bool  assume_is_sorted  )  [inline]
 

Called by the client to inform this sparse vector object that the elements be assumed to be in sequence and it is the clients responcibiliy to make sure that it is.

Definition at line 929 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::sort  ) 
 

Sort the elements into assending order by index.

Definition at line 356 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assert_valid_and_sorted  )  const
 

Assert that sparse vector is sorted.

This function will throw an exception if any of the following are not true: {enumerate} The sequence is not sorted by index (NotSortedException#) There are duplicate indexes (DuplicateIndexesException#) The indexes are out of range (#std::out_of_range#) {enumerate}

This function will throw an exception for the first error it finds.

Definition at line 363 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.

template<class T_Element, class T_Alloc>
SparseVector< T_Element, T_Alloc >::element_type * AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::lookup_element size_type  i  )  [inline]
 

Definition at line 938 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
const SparseVector< T_Element, T_Alloc >::element_type * AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::lookup_element size_type  i  )  const [inline]
 

Definition at line 946 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator SparseVectorSlice< T_Element >  )  [inline]
 

Allow an implicit conversion to a SparseVectorSlice<> object.

This is a very cheap operation.

Definition at line 954 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator const SparseVectorSlice< T_Element >  )  const [inline]
 

Definition at line 959 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator()  )  [inline]
 

Returns a SparseVectorSlice representing the entire sparse vector.

It is used to provide a quick, explicit conversion so that the SparseVector object can be used in functions that expect a SparseVectorSlice object.

Definition at line 964 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
const SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator()  )  const [inline]
 

Definition at line 969 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator() const Range1D rng  )  [inline]
 

Returns a continous subregion of the SparseVector object.

The returned SparseVectorSlice object represents the range of the rng argument.

Preconditions:

Postconditions:

  • returned#.dim() == rng.ubound() - rng.lbound() + 1#
  • contains all of the elements in the range.

Parameters:
rng Index range [lbound,ubound] of the region being returned.

Definition at line 974 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
const SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator() const Range1D rng  )  const [inline]
 

Definition at line 979 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator() size_type  lbound,
size_type  ubound
[inline]
 

Returns a SparseVectorSlice object for the continous subregion [ubound, lbound].

Preconditions:

  • #lbound > 1# (throw #out_of_range#)
  • #lbound < ubound# (throw #out_of_range#)
  • #ubound <= this->dim()# (throw #out_of_range#)

Postconditions:

  • returned#.dim() == ubound() - lbound() + 1#
  • contains all of the elements in the range.

Parameters:
lbound Lower bound of range [lbound,ubound] of the region being returned.
ubound Upper bound of range [lbound,ubound] of the region being returned.

Definition at line 984 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc>
const SparseVectorSlice< T_Element > AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::operator() size_type  lbound,
size_type  ubound
const [inline]
 

Same as above.

Definition at line 989 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assert_is_sorted  )  const [inline, private]
 

Definition at line 480 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assert_space size_type  n  )  const [inline, private]
 

Assert (#OutOfRoom#) that there is room for n elements.

Definition at line 485 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
void AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assert_sized_with_mem_set  )  const [inline, private]
 

Assert dim() > 0# (UnsizedException#) and #index_lookup_.ele() != 0# (NoNonZeroElementsException#).

Definition at line 493 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
SparseVectorSlice<T_Element> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::get_whole_sp_vec  )  [inline, private]
 

Return the entire vector slice.

Definition at line 504 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
const SparseVectorSlice<T_Element> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::get_whole_sp_vec  )  const [inline, private]
 

Definition at line 510 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
SparseVectorSlice<T_Element> AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::get_slice const Range1D rng  )  const [inline, private]
 

Return a SparseVectorSlice (inplementation for indexing operators).

Definition at line 516 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.


Member Data Documentation

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
allocator_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::alloc_ [private]
 

Definition at line 467 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::size_ [private]
 

Definition at line 468 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
size_type AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::max_nz_ [private]
 

Definition at line 469 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
SpVecIndexLookup AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::index_lookup_ [private]
 

Definition at line 472 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
bool AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::assume_sorted_ [private]
 

Definition at line 473 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.

template<class T_Element, class T_Alloc = std::allocator<T_Element>>
bool AbstractLinAlgPack::SparseVector< T_Element, T_Alloc >::know_is_sorted_ [private]
 

Definition at line 474 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:36:08 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1