#include <OrderedSparseMatrix.h>
Public Member Functions | |
virtual const int * | a_to_r () const |
void | append_new_cols (int num) |
void | import_rows_ordered (int num_rows, int num_cols, SparseVector_p *rows, int *r_to_a) |
const OrderedSparseMatrix & | operator= (const OrderedSparseMatrix &mat) |
OrderedSparseMatrix (int num_rows, int num_cols) | |
OrderedSparseMatrix (const OrderedSparseMatrix &mat) | |
OrderedSparseMatrix (const OrderedSparseMatrix &mat, int num_rows, int num_cols, int first_row=0, int first_col=0) | |
OrderedSparseMatrix (int num_rows, int num_cols, SparseVector_p *rows) | |
virtual const int * | r_to_a () const |
void | set_row (int row, const SparseVector &new_row) |
virtual | ~OrderedSparseMatrix () |
Private Member Functions | |
void | _allocate_OrderedSparseMatrix (bool init_order=true) |
void | _calc_reverse_order (int num, const int *order, int *reverse_order) const |
void | _copy_from_OrderedSparseMatrix (const OrderedSparseMatrix &mat) |
void | _dealloc_OrderedSparseMatrix () |
void | _set_order (const int *r_to_a) |
Private Attributes | |
int * | _a_to_r |
int * | _r_to_a |
Definition at line 39 of file OrderedSparseMatrix.h.
isam::OrderedSparseMatrix::OrderedSparseMatrix | ( | int | num_rows, |
int | num_cols | ||
) |
Constructor.
num_rows | Initial number of rows. |
num_cols | Initial number of columns. |
Definition at line 78 of file OrderedSparseMatrix.cpp.
Copy constructor.
mat | Matrix to copy. |
Definition at line 82 of file OrderedSparseMatrix.cpp.
isam::OrderedSparseMatrix::OrderedSparseMatrix | ( | const OrderedSparseMatrix & | mat, |
int | num_rows, | ||
int | num_cols, | ||
int | first_row = 0 , |
||
int | first_col = 0 |
||
) |
Submatrix copy constructor.
mat | Matrix to copy. |
num_rows | Number of rows to copy. |
num_cols | Number of columns to copy. |
first_row | Row offset. |
first_col | Column offset. |
Definition at line 86 of file OrderedSparseMatrix.cpp.
isam::OrderedSparseMatrix::OrderedSparseMatrix | ( | int | num_rows, |
int | num_cols, | ||
SparseVector_p * | rows | ||
) |
Definition at line 93 of file OrderedSparseMatrix.cpp.
isam::OrderedSparseMatrix::~OrderedSparseMatrix | ( | ) | [virtual] |
Destructor.
Definition at line 99 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::_allocate_OrderedSparseMatrix | ( | bool | init_order = true | ) | [private] |
Allocate memory - private.
init_table | Determines if index table is initialized with identity. |
Definition at line 42 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::_calc_reverse_order | ( | int | num, |
const int * | order, | ||
int * | reverse_order | ||
) | const [private] |
Calculate reverse ordering for O(1) access.
num | Number of entries in ordering |
order | Input order. |
reverse_order | Output reverse order. |
Definition at line 67 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::_copy_from_OrderedSparseMatrix | ( | const OrderedSparseMatrix & | mat | ) | [private] |
Copy data from one sparse matrix to a new one - private.
vec | Existing sparse vector to copy from. |
Definition at line 54 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::_dealloc_OrderedSparseMatrix | ( | ) | [private] |
Deallocate memory - private.
Definition at line 60 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::_set_order | ( | const int * | r_to_a | ) | [private] |
Sets the variable order, for example after batch reordering.
order | Pointer to list of integer IDs as used by CSparse. |
Definition at line 73 of file OrderedSparseMatrix.cpp.
const int * isam::OrderedSparseMatrix::a_to_r | ( | ) | const [virtual] |
Return variable ordering
Definition at line 158 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::append_new_cols | ( | int | num | ) | [virtual] |
Expand matrix to include new columns.
num | Number of columns to add. |
Reimplemented from isam::SparseMatrix.
Definition at line 134 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::import_rows_ordered | ( | int | num_rows, |
int | num_cols, | ||
SparseVector_p * | rows, | ||
int * | r_to_a | ||
) |
Import externally allocated rows, and also set the ordering.
num_rows | Number of rows of new matrix. |
num_cols | Number of columns of new matrix. |
rows | Array of SparseVector of length num_rows. |
r_to_a | Variable ordering. |
Definition at line 127 of file OrderedSparseMatrix.cpp.
const OrderedSparseMatrix & isam::OrderedSparseMatrix::operator= | ( | const OrderedSparseMatrix & | mat | ) |
Assignment operator.
mat | Right-hand-side matrix in assignment |
Definition at line 103 of file OrderedSparseMatrix.cpp.
const int * isam::OrderedSparseMatrix::r_to_a | ( | ) | const [virtual] |
Return inverse variable ordering
Definition at line 162 of file OrderedSparseMatrix.cpp.
void isam::OrderedSparseMatrix::set_row | ( | int | row, |
const SparseVector & | new_row | ||
) | [virtual] |
Replace the given row. Also reorders the new vector according to internal ordering.
row | Number of row to replace. |
new_row | New row vector. |
Reimplemented from isam::SparseMatrix.
Definition at line 115 of file OrderedSparseMatrix.cpp.
int* isam::OrderedSparseMatrix::_a_to_r [private] |
Definition at line 41 of file OrderedSparseMatrix.h.
int* isam::OrderedSparseMatrix::_r_to_a [private] |
Definition at line 40 of file OrderedSparseMatrix.h.