|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
Sparse Vector Slice class template. More...
#include <AbstractLinAlgPack_SparseVectorClassDecl.hpp>

Public Member Functions | |
| void | bind (SparseVectorSlice svs) |
| Constructs a sparse vector slice view from another sparse vector slice. More... | |
| EOverLap | overlap (const SparseVectorSlice< T_Element > &sv) const |
Public types. | |
| typedef T_Element | element_type |
| typedef AbstractLinAlgPack::size_type | size_type |
| typedef ptrdiff_t | difference_type |
| typedef element_type * | iterator |
| typedef const element_type * | const_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 |
Constuctors | |
The default copy constructor is allowed since it has the proper semantics. | |
| SparseVectorSlice (element_type ele[], size_type nz, difference_type offset, size_type size, bool assume_sorted=false) | |
| Constructs a sparse vector slice from an array of elements. More... | |
Sparse Vector Templated interface for linear algebra operations | |
| size_type | dim () const |
| Return the number of elements in the full vector. More... | |
| size_type | nz () const |
| Return the number of non-zero elements. More... | |
| difference_type | offset () const |
| Return the offset for the indexes (ith real index = begin()[i-1]->index() + offset()# , for i = 1,,,nz()#) More... | |
| bool | is_sorted () const |
| Return true if the sequence is assumed sorted. More... | |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
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_type * | lookup_element (size_type i) |
| const element_type * | lookup_element (size_type i) const |
Creating a slice (subregion) of the sparse vector | |
| SparseVectorSlice< T_Element > & | operator() () |
| const SparseVectorSlice < T_Element > & | operator() () const |
| SparseVectorSlice * | operator& () |
| Allow address to be taken of an rvalue of this object. More... | |
| const SparseVectorSlice * | 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 |
Sparse Vector Slice class template.
This is a class for abstracting a region of a sparse vector stored as an array of elements of a templated type. The required inteface for the type of these elements is given in the SparseVector documentation.
Here if nz() == 0 then begin() == end() so it is safe to set up loops in the form of:
for(SparseVectorSlice<T>::const_iterator itr = sv.begin(); itr != sv.end(); ++itr) // some access of *itr.
Note that if nz()==0 then begin() may not point to a valid object so don't do it.
The default copy constructor is allowed but the default constructor and assignment operator functions are not.
Definition at line 102 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef T_Element AbstractLinAlgPack::SparseVectorSlice< T_Element >::element_type |
Definition at line 561 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef AbstractLinAlgPack::size_type AbstractLinAlgPack::SparseVectorSlice< T_Element >::size_type |
Definition at line 563 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef ptrdiff_t AbstractLinAlgPack::SparseVectorSlice< T_Element >::difference_type |
Definition at line 565 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef element_type* AbstractLinAlgPack::SparseVectorSlice< T_Element >::iterator |
Definition at line 567 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef const element_type* AbstractLinAlgPack::SparseVectorSlice< T_Element >::const_iterator |
Definition at line 569 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef std::reverse_iterator<iterator> AbstractLinAlgPack::SparseVectorSlice< T_Element >::reverse_iterator |
Definition at line 583 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef std::reverse_iterator<const_iterator> AbstractLinAlgPack::SparseVectorSlice< T_Element >::const_reverse_iterator |
Definition at line 585 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef SparseVectorUtilityPack::DoesNotExistException AbstractLinAlgPack::SparseVectorSlice< T_Element >::DoesNotExistException |
Definition at line 590 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| typedef SparseVectorUtilityPack::NotSortedException AbstractLinAlgPack::SparseVectorSlice< T_Element >::NotSortedException |
Definition at line 592 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Constructs a sparse vector slice from an array of elements.
Here a pointer to an array of elements is used instead of a pointer to std::vector<T_Ele,T_Alloc> in order to insulated this class from the type of allocator used since this information is not needed.
A sparse vector slice with no nonzero elements can be constructed by setting nz == 0;
Preconditions:
| ele | pointer to array of elements (length nz#) |
| offset | offset for the indexes of the elements. index = ele[i].index() + offset |
| size | number of elements in the full vector |
| nz | number of non-zero elements in vector |
Definition at line 1012 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Constructs a sparse vector slice view from another sparse vector slice.
Definition at line 1018 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
| EOverLap AbstractLinAlgPack::SparseVectorSlice< T_Element >::overlap | ( | const SparseVectorSlice< T_Element > & | sv | ) | const |
Returns the degree of memory overlap of this SparseVector and a SparseVectorSlice.
Definition at line 422 of file AbstractLinAlgPack_SparseVectorClassDef.hpp.
|
inline |
Return the number of elements in the full vector.
Definition at line 1028 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Return the number of non-zero elements.
Definition at line 1033 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Return the offset for the indexes (ith real index = begin()[i-1]->index() + offset()# , for i = 1,,,nz()#)
Definition at line 1038 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Return true if the sequence is assumed sorted.
Definition at line 1043 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1048 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1053 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1063 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1068 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1073 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1083 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1092 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1100 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Returns a SparseVectorSlice<> reference to this object.
It is included for uniformity with SparseVector.
Definition at line 1108 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1113 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Allow address to be taken of an rvalue of this object.
Definition at line 723 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Returns a continous subregion of the SparseVector object.
The returned SparseVectorSlice object represents the range of the rng argument.
Preconditions:
Postconditions:
| rng | Index range [lbound,ubound] of the region being returned. |
Definition at line 1118 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1123 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Returns a SparseVectorSlice object for the continous subregion [ubound, lbound].
Preconditions:
Postconditions:
| 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 1128 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
|
inline |
Definition at line 1133 of file AbstractLinAlgPack_SparseVectorClassDecl.hpp.
1.8.6