HermesCommon
2.0
|
General (abstract) sparse matrix representation in Hermes. More...
#include <matrix.h>
Classes | |
struct | Page |
Structure for storing indices in sparse matrix. More... | |
Public Member Functions | |
SparseMatrix (unsigned int size) | |
virtual void | prealloc (unsigned int n) |
virtual void | pre_add_ij (unsigned int row, unsigned int col) |
virtual void | finish () |
Finish manipulation with matrix (called before solving) | |
virtual unsigned int | get_size () |
virtual void | add_sparse_matrix (SparseMatrix *mat) |
virtual void | add_sparse_to_diagonal_blocks (int num_stages, SparseMatrix< Scalar > *mat) |
virtual int | get_num_row_entries (unsigned int row) |
virtual void | extract_row_copy (unsigned int row, unsigned int len, unsigned int &n_entries, double *vals, unsigned int *idxs) |
virtual int | get_num_col_entries (unsigned int col) |
virtual void | extract_col_copy (unsigned int col, unsigned int len, unsigned int &n_entries, double *vals, unsigned int *idxs) |
virtual void | multiply_with_vector (Scalar *vector_in, Scalar *vector_out) |
Multiply with a vector. | |
virtual void | multiply_with_Scalar (Scalar value) |
Multiply with a Scalar. | |
virtual SparseMatrix * | duplicate () |
Duplicate sparse matrix (including allocation). | |
virtual double | get_fill_in () const =0 |
Get fill-in. | |
virtual unsigned int | get_nnz () const |
Public Member Functions inherited from Hermes::Algebra::Matrix< Scalar > | |
unsigned int | get_size () |
Matrix (unsigned int size) | |
virtual void | alloc ()=0 |
allocate the memory for stiffness matrix and right-hand side | |
virtual void | free ()=0 |
free the memory associated with stiffness matrix and right-hand side | |
virtual Scalar | get (unsigned int m, unsigned int n)=0 |
virtual void | zero ()=0 |
Zero the matrix. | |
virtual void | add_to_diagonal (Scalar v)=0 |
Add a number to each diagonal entry. | |
virtual void | add (unsigned int m, unsigned int n, Scalar v)=0 |
virtual void | add (unsigned int m, unsigned int n, Scalar **mat, int *rows, int *cols)=0 |
virtual bool | dump (FILE *file, const char *var_name, EMatrixDumpFormat fmt=DF_MATLAB_SPARSE, char *number_format="%lf")=0 |
virtual unsigned int | get_matrix_size () const =0 |
Public Member Functions inherited from Hermes::Mixins::Loggable | |
void | set_verbose_output (bool to_set) |
Sets the attribute verbose_output to the paramater option passed. | |
bool | get_verbose_output () const |
Returns the current value of verbose_output;. | |
void | set_verbose_callback (callbackFn callback) |
callbackFn | get_verbose_callback () const |
Returns the current value of verbose_callback;. | |
Public Attributes | |
unsigned | row_storage:1 |
unsigned | col_storage:1 |
Protected Member Functions | |
int | sort_and_store_indices (Page *page, int *buffer, int *max) |
int | get_num_indices () |
Protected Attributes | |
Page ** | pages |
array of pages with indices array. Each field of arra contains pages for one column | |
int | mem_size |
mem stat | |
Protected Attributes inherited from Hermes::Algebra::Matrix< Scalar > | |
unsigned int | size |
matrix size | |
Static Protected Attributes | |
static const int | PAGE_SIZE = 62 |
Size of page (max number of indices stored in one page). | |
General (abstract) sparse matrix representation in Hermes.
Hermes::Algebra::SparseMatrix< Scalar >::SparseMatrix | ( | unsigned int | size | ) |
Constructor of sparse matrix
[in] | size | size of matrix |
Definition at line 131 of file matrix.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Extract the copy of a column
[in] | col | - global column to extract |
[in] | len | - length of 'vals' and 'idxs' arrays. |
[out] | n_entries | - number of nonzero entries extracted. |
[out] | vals | - extracted values for this column. |
[out] | idxs | - extracted global row indices for the corresponding values. |
|
inlinevirtual |
Extract the copy of a row
[in] | row | - global row to extract |
[in] | len | - length of 'vals' and 'idxs' arrays. |
[out] | n_entries | - number of nonzero entries extracted. |
[out] | vals | - extracted values for this row. |
[out] | idxs | - extracted global column indices for the corresponding values. |
|
inlinevirtual |
|
inlinevirtual |
|
protected |
get number of indices in all pages
Definition at line 197 of file matrix.cpp.
|
inlinevirtual |
|
virtual |
add indices of nonzero matrix element
[in] | row | - row index |
[in] | col | - column index |
Definition at line 162 of file matrix.cpp.
|
virtual |
|
protected |
gather all pages in the buffer, delete them, sort buffer and remove duplicities
[in] | page | first page with indices |
[out] | buffer | buffer to which indices will be copied |
[in] | max | maximum indices to be stored (probably) |
Definition at line 175 of file matrix.cpp.
unsigned Hermes::Algebra::SparseMatrix< Scalar >::col_storage |
unsigned Hermes::Algebra::SparseMatrix< Scalar >::row_storage |