Loading...
Searching...
No Matches
svectorbase.h
Go to the documentation of this file.
43/** SVectorBase keeps its nonzeros in an array of Nonzero%s providing members for saving the index and value.
92 * Class SVectorBase provides packed sparse vectors. Such are a sparse vectors, with a storage scheme that keeps all
93 * data in one contiguous block of memory. This is best suited for using them for parallel computing on a distributed
96 * SVectorBase does not provide any memory management (this will be done by class DSVectorBase). This means, that the
97 * constructor of SVectorBase expects memory where to save the nonzeros. Further, adding nonzeros to an SVectorBase may
100 * When nonzeros are added to an SVectorBase, they are appended to the set of nonzeros, i.e., they recieve numbers
101 * size(), size()+1 ... . An SVectorBase can hold atmost max() nonzeros, where max() is given in the constructor. When
102 * removing nonzeros, the remaining nonzeros are renumbered. However, only the numbers greater than the number of the
105 * The following mathematical operations are provided by class SVectorBase (SVectorBase \p a, \p b, \p c; R \p x):
122 * Operators \c += and \c -= should be used with caution, since no efficient implementation is available. One should
123 * think of assigning the left handside vector to a dense VectorBase first and perform the addition on it. The same
126 * There are two numberings of the nonzeros of an SVectorBase. First, an SVectorBase is supposed to act like a linear
127 * algebra VectorBase. An \em index refers to this view of an SVectorBase: operator[]() is provided which returns the
128 * value at the given index of the vector, i.e., 0 for all indices which are not in the set of nonzeros. The other view
129 * of SVectorBase%s is that of a set of nonzeros. The nonzeros are numbered from 0 to size()-1. The methods index(int
130 * n) and value(int n) allow to access the index and value of the \p n 'th nonzero. \p n is referred to as the \em
133 * @todo SVectorBase should get a new implementation. There maybe a lot of memory lost due to padding the Nonzero
134 * structure. A better idea seems to be class SVectorBase { int size; int used; int* idx; R* val; }; which for
135 * several reasons could be faster or slower. If SVectorBase is changed, also DSVectorBase and SVSet have to be
145 // ------------------------------------------------------------------------------------------------------------------
159 // ------------------------------------------------------------------------------------------------------------------
194 /** @return Finds the position of the first index \p i in the index set. If no such index \p i is found,
482 // ------------------------------------------------------------------------------------------------------------------
615 // ------------------------------------------------------------------------------------------------------------------
620 /** The constructor expects one memory block where to store the nonzero elements. This must be passed to the
621 * constructor, where the \em number of Nonzero%s needs that fit into the memory must be given and a pointer to the
622 * beginning of the memory block. Once this memory has been passed, it shall not be modified until the SVectorBase
788 // ------------------------------------------------------------------------------------------------------------------
825 // ------------------------------------------------------------------------------------------------------------------
Nonzero< R > & operator=(const Nonzero< S > &vec) Definition svectorbase.h:54 SVectorBase< R > & operator=(const SVectorBase< S > &sv) Assignment operator. Definition svectorbase.h:682 SVectorBase(const SVectorBase< R > &sv)=default R length() const Floating point approximation of euclidian norm (without any approximation guarantee). Definition svectorbase.h:519 R operator*(const SVectorBase< S > &w) const inner product for sparse vectors Definition svectorbase.h:562 SVectorBase< R > & operator=(const SVectorBase< R > &sv) Assignment operator. Definition svectorbase.h:637 void setMem(int n, Nonzero< R > *elmem) Set the memory area where the nonzeros will be stored. Definition svectorbase.h:813 SVectorBase< Real > & scaleAssign(const int *scaleExp, const SVectorBase< Real > &sv, bool negateExp=false) scale and assign Definition svectorbase.h:732 SVectorBase< R > & operator=(const SVectorBase< R > &&sv) move assignement operator. Definition svectorbase.h:668 SVectorBase< R > & assignArray(const S *rowValues, const int *rowIndices, int rowSize) Assignment operator. Definition svectorbase.h:765 SVectorBase< Real > & scaleAssign(int scaleExp, const SVectorBase< Real > &sv) scale and assign Definition svectorbase.h:713 SVectorBase< R > & operator=(const VectorBase< S > &vec) Assignment operator. Definition basevectors.h:951 Definition stablesum.h:36 Everything should be within this namespace.
|