concepts::HashedSparseMatrix< T > Class Template Reference
A matrix in sparse storage using hashes. More...
#include <compositions.hh>
Classes | |
struct | Value |
Values of a matrix in sparse notation. More... | |
Public Types | |
typedef Cmplxtype< T >::type | c_type |
Complex type of data type. More... | |
typedef _HashedSMatrix_iterator< T, const T &, const T * > | const_iterator |
typedef std::conditional< std::is_same< typename Realtype< T >::type, T >::value, typename Realtype< T >::type, typename Cmplxtype< T >::type >::type | d_type |
Data type, depending if F is real or complex. More... | |
typedef _HashedSMatrix_iterator< T, T &, T * > | iterator |
typedef Realtype< T >::type | r_type |
Real type of data type. More... | |
typedef T | value_type |
Public Member Functions | |
iterator | begin (uint row=0) |
Returns iterator over the entrances. More... | |
const_iterator | begin (uint row=0) const |
Returns constant iterator over the entrances. More... | |
const uint | cols () const |
Number of columns. More... | |
void | compress (Real threshold=EPS) |
Compresses the matrix by dropping small entries. More... | |
uint | HashBits () const |
HashedSparseMatrix (uint r, uint c, uint h) | |
Constructor. More... | |
std::ostream & | info (std::ostream &os) const |
Value ** | Matrix () const |
float | memory () const |
void | multiply (const concepts::Matrix< T > *const fact, concepts::Matrix< T > &dest) const |
Multiplies this matrix and fact and adds the result to dest . More... | |
void | multiply (const HashedSparseMatrix< T > *const fact, concepts::Matrix< T > &dest) const |
Multiplies this matrix and fact and adds the result to dest . More... | |
template<typename F , typename G > | |
void | operator() (const F f[], G g[]) const |
Multiplies the matrix with f . The result is g . More... | |
T & | operator() (const uint r, const uint c) |
Returns the entry with index (r,c). More... | |
T | operator() (const uint r, const uint c) const |
HashedSparseMatrix< T > & | operator*= (const T factor) |
Multiplies all entrices with a certain constant. More... | |
void | outputMatlab (std::ostream &ofs) const |
void | outputSparseQR (std::ostream &ofs) const |
const uint | rows () const |
Number of rows. More... | |
template<typename F , typename G > | |
void | transpMult (const F f[], G g[]) const |
Multiplies the transpose of the matrix with f and adds the results to g . More... | |
uint | used () const |
Returns the number of used entries in the matrix. More... | |
void | write (std::ostream &ofs) const |
~HashedSparseMatrix () | |
Static Public Member Functions | |
static iterator | end () |
Last entrance of the particular order. More... | |
Private Member Functions | |
void | dropEntry_ (Value *&v, Value *&vPrev, const uint r, const uint c) |
Removes entry (r,c) from the matrix. More... | |
HashedSparseMatrix (const HashedSparseMatrix< T > &) | |
void | operator= (const HashedSparseMatrix< T > &) |
Private Attributes | |
uint | _used |
uint | hashBits |
uint | hashMsk |
Value ** | matrix |
uint | nofCols |
Number of columns. More... | |
uint | nofRows |
Number of rows. More... | |
Pool< Value > | pool |
Detailed Description
template<class T>
class concepts::HashedSparseMatrix< T >
A matrix in sparse storage using hashes.
Definition at line 34 of file compositions.hh.
Member Typedef Documentation
◆ c_type
typedef Cmplxtype<T>::type concepts::HashedSparseMatrix< T >::c_type |
Complex type of data type.
Definition at line 46 of file hashedSMatrix.hh.
◆ const_iterator
typedef _HashedSMatrix_iterator<T, const T&, const T*> concepts::HashedSparseMatrix< T >::const_iterator |
Definition at line 52 of file hashedSMatrix.hh.
◆ d_type
typedef std::conditional<std::is_same<typename Realtype<T>::type, T>::value , typename Realtype<T>::type, typename Cmplxtype<T>::type >::type concepts::HashedSparseMatrix< T >::d_type |
Data type, depending if F is real or complex.
Definition at line 49 of file hashedSMatrix.hh.
◆ iterator
typedef _HashedSMatrix_iterator<T, T&, T*> concepts::HashedSparseMatrix< T >::iterator |
Definition at line 51 of file hashedSMatrix.hh.
◆ r_type
typedef Realtype<T>::type concepts::HashedSparseMatrix< T >::r_type |
Real type of data type.
Definition at line 44 of file hashedSMatrix.hh.
◆ value_type
typedef T concepts::HashedSparseMatrix< T >::value_type |
Definition at line 42 of file hashedSMatrix.hh.
Constructor & Destructor Documentation
◆ HashedSparseMatrix() [1/2]
concepts::HashedSparseMatrix< T >::HashedSparseMatrix | ( | uint | r, |
uint | c, | ||
uint | h | ||
) |
Constructor.
- Parameters
-
r Number of rows c Number of columns h Number of hash bits
◆ ~HashedSparseMatrix()
concepts::HashedSparseMatrix< T >::~HashedSparseMatrix | ( | ) |
◆ HashedSparseMatrix() [2/2]
|
private |
Member Function Documentation
◆ begin() [1/2]
iterator concepts::HashedSparseMatrix< T >::begin | ( | uint | row = 0 | ) |
Returns iterator over the entrances.
The order is row-wise, but unsorted inside the row. The iterator stands at the first entrance in row
(in the particular order).
◆ begin() [2/2]
const_iterator concepts::HashedSparseMatrix< T >::begin | ( | uint | row = 0 | ) | const |
Returns constant iterator over the entrances.
The order is row-wise, but unsorted inside the row. The iterator stands at the first entrance in row
(in the particular order).
◆ cols()
|
inline |
Number of columns.
Definition at line 106 of file hashedSMatrix.hh.
◆ compress()
void concepts::HashedSparseMatrix< T >::compress | ( | Real | threshold = EPS | ) |
Compresses the matrix by dropping small entries.
All matrix entries which are smaller than a certain threshold
times the largest entry of the matrix are deleted from the matrix. To delete a small entry, dropEntry_
is used.
◆ dropEntry_()
|
private |
Removes entry (r,c) from the matrix.
The storage of the matrix entry is not released and will only be released on destruction of the whole matrix. Trying to remove a non-existing entry simply does nothing.
- Parameters
-
v Pointer to the entry which should be removed vPrev Pointer to the entry before the one to be removed r Row index c Column index
◆ end()
|
static |
Last entrance of the particular order.
◆ HashBits()
|
inline |
Definition at line 92 of file hashedSMatrix.hh.
◆ info()
std::ostream& concepts::HashedSparseMatrix< T >::info | ( | std::ostream & | os | ) | const |
◆ Matrix()
|
inline |
Definition at line 91 of file hashedSMatrix.hh.
◆ memory()
|
inline |
Definition at line 124 of file hashedSMatrix.hh.
◆ multiply() [1/2]
void concepts::HashedSparseMatrix< T >::multiply | ( | const concepts::Matrix< T > *const | fact, |
concepts::Matrix< T > & | dest | ||
) | const |
Multiplies this matrix and fact
and adds the result to dest
.
Definition at line 238 of file hashedSMatrix.hh.
◆ multiply() [2/2]
void concepts::HashedSparseMatrix< T >::multiply | ( | const HashedSparseMatrix< T > *const | fact, |
concepts::Matrix< T > & | dest | ||
) | const |
Multiplies this matrix and fact
and adds the result to dest
.
Definition at line 214 of file hashedSMatrix.hh.
◆ operator()() [1/3]
void concepts::HashedSparseMatrix< T >::operator() | ( | const F | f[], |
G | g[] | ||
) | const |
Multiplies the matrix with f
. The result is g
.
Definition at line 258 of file hashedSMatrix.hh.
◆ operator()() [2/3]
T& concepts::HashedSparseMatrix< T >::operator() | ( | const uint | r, |
const uint | c | ||
) |
Returns the entry with index (r,c).
If this entry does not yet exist, it is created.
- Parameters
-
r Row index c Column index
◆ operator()() [3/3]
T concepts::HashedSparseMatrix< T >::operator() | ( | const uint | r, |
const uint | c | ||
) | const |
◆ operator*=()
HashedSparseMatrix<T>& concepts::HashedSparseMatrix< T >::operator*= | ( | const T | factor | ) |
Multiplies all entrices with a certain constant.
◆ operator=()
|
private |
◆ outputMatlab()
void concepts::HashedSparseMatrix< T >::outputMatlab | ( | std::ostream & | ofs | ) | const |
◆ outputSparseQR()
void concepts::HashedSparseMatrix< T >::outputSparseQR | ( | std::ostream & | ofs | ) | const |
◆ rows()
|
inline |
Number of rows.
Definition at line 104 of file hashedSMatrix.hh.
◆ transpMult()
void concepts::HashedSparseMatrix< T >::transpMult | ( | const F | f[], |
G | g[] | ||
) | const |
Multiplies the transpose of the matrix with f
and adds the results to g
.
- Precondition
g
is set to 0
Definition at line 205 of file hashedSMatrix.hh.
◆ used()
|
inline |
Returns the number of used entries in the matrix.
Definition at line 123 of file hashedSMatrix.hh.
◆ write()
void concepts::HashedSparseMatrix< T >::write | ( | std::ostream & | ofs | ) | const |
Member Data Documentation
◆ _used
|
private |
Definition at line 168 of file hashedSMatrix.hh.
◆ hashBits
|
private |
Definition at line 176 of file hashedSMatrix.hh.
◆ hashMsk
|
private |
Definition at line 177 of file hashedSMatrix.hh.
◆ matrix
|
private |
Definition at line 167 of file hashedSMatrix.hh.
◆ nofCols
|
private |
Number of columns.
Definition at line 174 of file hashedSMatrix.hh.
◆ nofRows
|
private |
Number of rows.
Definition at line 171 of file hashedSMatrix.hh.
◆ pool
|
private |
Definition at line 166 of file hashedSMatrix.hh.
The documentation for this class was generated from the following files:
- operator/compositions.hh
- operator/hashedSMatrix.hh