This class may be used to sum multiple sparse rows.
More...
#include <inmost_sparse.h>
|
| RowMerger () |
| Default constructor without size specified.
|
|
| ~RowMerger () |
| Constructor with size specified. More...
|
|
void | Resize (INMOST_DATA_ENUM_TYPE size) |
| Resize linked list for new interval. More...
|
|
| RowMerger (const Matrix &A) |
| Constructor that gets sizes from the matrix, including non-local mapping. More...
|
|
void | Resize (const Matrix &A) |
| Resize linked list for new matrix, including non-local mapping. More...
|
|
void | Clear () |
| Clear linked list.
|
|
void | PushRow (INMOST_DATA_REAL_TYPE coef, const Row &r) |
| Add a row with a coefficient into empty linked list. More...
|
|
void | AddRow (INMOST_DATA_REAL_TYPE coef, const Row &r) |
| Add a row with a coefficient into non-empty linked list. More...
|
|
void | Multiply (INMOST_DATA_REAL_TYPE coef) |
| Multiply all entries of linked list by a coefficient. More...
|
|
void | RetrieveRow (Row &r) const |
| Place entries from linked list into row. More...
|
|
INMOST_DATA_ENUM_TYPE | Size () const |
| Get current number of nonzeros from linked list.
|
|
bool | Empty () const |
| Check if linked list is empty.
|
|
INMOST_DATA_REAL_TYPE & | operator[] (INMOST_DATA_ENUM_TYPE pos) |
| Retrive/add an entry from/to linked list. More...
|
|
INMOST_DATA_REAL_TYPE | operator[] (INMOST_DATA_ENUM_TYPE pos) const |
| Retrive an entry from linked list. More...
|
|
void | Merge (Row &c, INMOST_DATA_REAL_TYPE alpha, const Row &a, INMOST_DATA_REAL_TYPE beta, const Row &b) |
| Operation of the form c = alpha a + beta b. More...
|
|
iterator | Begin () |
| Retrive iterator for the first element.
|
|
iterator | End () |
| Retrive iterator for the position beyond the last element.
|
|
|
const INMOST_DATA_ENUM_TYPE | EOL = ENUMUNDEF-1 |
| End of linked list.
|
|
This class may be used to sum multiple sparse rows.
- Warning
- In parallel column indices of the matrix may span wider then local row indices, to prevent any problem you can safely set total size of the matrix as interval of the RowMerger.
Definition at line 637 of file inmost_sparse.h.
◆ ~RowMerger()
INMOST::Sparse::RowMerger::~RowMerger |
( |
| ) |
|
Constructor with size specified.
- Parameters
-
interval_begin | First index in linked list. |
interval_end | Last index in linked list. |
Sorted | Result should be sorted or not. Destructor. |
◆ RowMerger()
INMOST::Sparse::RowMerger::RowMerger |
( |
const Matrix & |
A | ) |
|
Constructor that gets sizes from the matrix, including non-local mapping.
- Parameters
-
A | Matrix to get sizes from. |
Sorted | Result should be sorted. |
◆ AddRow()
void INMOST::Sparse::RowMerger::AddRow |
( |
INMOST_DATA_REAL_TYPE |
coef, |
|
|
const Row & |
r |
|
) |
| |
Add a row with a coefficient into non-empty linked list.
Use RowMerger::PushRow for empty linked list.
- Parameters
-
coef | Coefficient to multiply row values. |
r | A row to be added. |
◆ Merge()
void INMOST::Sparse::RowMerger::Merge |
( |
Row & |
c, |
|
|
INMOST_DATA_REAL_TYPE |
alpha, |
|
|
const Row & |
a, |
|
|
INMOST_DATA_REAL_TYPE |
beta, |
|
|
const Row & |
b |
|
) |
| |
|
inline |
Operation of the form c = alpha a + beta b.
- Warning
- Linked list must be clear before operation.
- Parameters
-
c | Row c. This will be overwritten. |
alpha | Multiplier for row a. |
a | Row a. |
beta | Multiplier for row b. |
b | Row b. |
Definition at line 773 of file inmost_sparse.h.
◆ Multiply()
void INMOST::Sparse::RowMerger::Multiply |
( |
INMOST_DATA_REAL_TYPE |
coef | ) |
|
Multiply all entries of linked list by a coefficient.
- Parameters
-
coef | A coefficient for multiplication. |
◆ operator[]() [1/2]
INMOST_DATA_REAL_TYPE& INMOST::Sparse::RowMerger::operator[] |
( |
INMOST_DATA_ENUM_TYPE |
pos | ) |
|
|
inline |
Retrive/add an entry from/to linked list.
- Parameters
-
Definition at line 759 of file inmost_sparse.h.
◆ operator[]() [2/2]
INMOST_DATA_REAL_TYPE INMOST::Sparse::RowMerger::operator[] |
( |
INMOST_DATA_ENUM_TYPE |
pos | ) |
const |
|
inline |
Retrive an entry from linked list.
- Warning
- Will fire an exception if there is no entry.
- Parameters
-
Definition at line 764 of file inmost_sparse.h.
◆ PushRow()
void INMOST::Sparse::RowMerger::PushRow |
( |
INMOST_DATA_REAL_TYPE |
coef, |
|
|
const Row & |
r |
|
) |
| |
Add a row with a coefficient into empty linked list.
This routine should be a bit faster then RowMerger::AddRow for empty linked list. It may result in an unexpected behavior for non-empty linked list, asserts will fire in debug mode.
- Parameters
-
coef | Coefficient to multiply row values. |
r | A row to be added. |
◆ Resize() [1/2]
void INMOST::Sparse::RowMerger::Resize |
( |
const Matrix & |
A | ) |
|
Resize linked list for new matrix, including non-local mapping.
- Warning
- All contents of linked list will be lost after resize.
- Parameters
-
A | Matrix to get sizes from. |
Sorted | Result should be sorted or not. |
◆ Resize() [2/2]
void INMOST::Sparse::RowMerger::Resize |
( |
INMOST_DATA_ENUM_TYPE |
size | ) |
|
Resize linked list for new interval.
- Warning
- All contents of linked list will be lost after resize.
- Parameters
-
interval_begin | First index in linked list. |
interval_end | Last index in linked list. |
Sorted | Result should be sorted or not. |
◆ RetrieveRow()
void INMOST::Sparse::RowMerger::RetrieveRow |
( |
Row & |
r | ) |
const |
Place entries from linked list into row.
- Warning
- All contents of the row will be overwritten. If you want contents of the row to be added use AddRow with this row in advance.
- Parameters
-
The documentation for this class was generated from the following file: