INMOST
Mathematical Modelling Toolkit
|
#include <inmost_sparse.h>
Classes | |
class | iterator |
Static Public Attributes | |
static const INMOST_DATA_ENUM_TYPE | EOL = ENUMUNDEF-1 |
End of linked list. More... | |
static const INMOST_DATA_ENUM_TYPE | UNDEF = ENUMUNDEF |
Value not defined in linked list. More... | |
This class may be used to sum multiple sparse rows.
Or even better implement mapping that will remap nonlocal entries to the end of current linked list when added and put them back in correct places when retrived. May use algorithm from class OrderInfo.
Definition at line 332 of file inmost_sparse.h.
INMOST::Sparse::RowMerger::RowMerger | ( | ) |
Default constructor without size specified.
INMOST::Sparse::RowMerger::RowMerger | ( | INMOST_DATA_ENUM_TYPE | interval_begin, |
INMOST_DATA_ENUM_TYPE | interval_end, | ||
bool | Sorted = true |
||
) |
Constructor with size specified.
interval_begin | First index in linked list. |
interval_end | Last index in linked list. |
Sorted | Result should be sorted or not. |
Constructor that gets sizes from the matrix.
A | Matrix to get sizes from. |
Sorted | Result should be sorted. |
INMOST::Sparse::RowMerger::~RowMerger | ( | ) |
Destructor.
void INMOST::Sparse::RowMerger::AddRow | ( | INMOST_DATA_REAL_TYPE | coef, |
Row & | r, | ||
bool | PreSortRow = false |
||
) |
Add a row with a coefficient into non-empty linked list. Use RowMerger::PushRow for empty linked list.
coef | Coefficient to multiply row values. |
r | A row to be added. |
PreSortRow | Sort values of the row before adding. Will be activated only for sorted linked lists. |
|
inline |
Definition at line 446 of file inmost_sparse.h.
void INMOST::Sparse::RowMerger::Clear | ( | ) |
Clear linked list.
|
inline |
Definition at line 447 of file inmost_sparse.h.
|
inline |
Operation of the form c = alpha a + beta b
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 439 of file inmost_sparse.h.
void INMOST::Sparse::RowMerger::Multiply | ( | INMOST_DATA_REAL_TYPE | coef | ) |
Multiply all entries of linked list by a coefficient.
coef | A coefficient for multiplication. |
INMOST_DATA_REAL_TYPE& INMOST::Sparse::RowMerger::operator[] | ( | INMOST_DATA_ENUM_TYPE | pos | ) |
Retrive/add an entry from/to linked list.
pos | Position in the list. |
INMOST_DATA_REAL_TYPE INMOST::Sparse::RowMerger::operator[] | ( | INMOST_DATA_ENUM_TYPE | pos | ) | const |
Retrive an entry from linked list.
pos | Position in the list. |
void INMOST::Sparse::RowMerger::PushRow | ( | INMOST_DATA_REAL_TYPE | coef, |
Row & | r, | ||
bool | PreSortRow = false |
||
) |
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.
coef | Coefficient to multiply row values. |
r | A row to be added. |
PreSortRow | Sort values of the row before adding. Will be activated only for sorted linked lists. |
void INMOST::Sparse::RowMerger::Resize | ( | INMOST_DATA_ENUM_TYPE | interval_begin, |
INMOST_DATA_ENUM_TYPE | interval_end, | ||
bool | Sorted = true |
||
) |
Resize linked list for new interval.
interval_begin | First index in linked list. |
interval_end | Last index in linked list. |
Sorted | Result should be sorted or not. |
Resize linked list for new matrix.
A | Matrix to get sizes from. |
Sorted | Result should be sorted or not. |
void INMOST::Sparse::RowMerger::RetriveRow | ( | Row & | r | ) |
Place entries from linked list into row.
r | A row to be filled. |
|
inline |
Get current number of nonzeros from linked list.
Definition at line 422 of file inmost_sparse.h.
|
static |
End of linked list.
Definition at line 335 of file inmost_sparse.h.
|
static |
Value not defined in linked list.
Definition at line 336 of file inmost_sparse.h.