Class for storing sparse matrices. More...
Public Member Functions | |
virtual IMatrix< T > | CreateMatrix (int num_rows, int num_columns) |
Create a matrix with a given number of rows and columns. | |
SparseMatrix (int num_rows, int num_cols) | |
Create a sparse matrix with a given number of rows. | |
Protected Attributes | |
List< Dictionary< int, T > > | row_list = new List<Dictionary<int, T>>() |
List that stores the rows of the matrix. | |
Properties | |
virtual bool | IsSymmetric [get] |
True if the matrix is symmetric, false otherwise. | |
virtual IList< Pair< int, int > > | NonEmptyEntryIDs [get] |
The row and column IDs of non-empty entries in the matrix. | |
IList< KeyValuePair< int, Dictionary< int, T > > > | NonEmptyRows [get] |
The non-empty rows of the matrix (the ones that contain at least one non-zero entry), with their IDs. | |
int | NumberOfColumns [get, set] |
The number of columns of the matrix. | |
virtual int | NumberOfNonEmptyEntries [get] |
The number of non-empty entries in the matrix. | |
int | NumberOfRows [get] |
The number of rows of the matrix. | |
virtual T | this [int x, int y] [get, set] |
Access the elements of the sparse matrix. | |
Dictionary< int, T > | this [int x] [get] |
Get a row of the matrix. |
Class for storing sparse matrices.
The data is stored in row-major mode. Indexes are zero-based.
T | the matrix element type, must have a default constructor/value |
T | : | new() |
SparseMatrix | ( | int | num_rows, | |
int | num_cols | |||
) |
Create a sparse matrix with a given number of rows.
num_rows | the number of rows | |
num_cols | the number of columns |
virtual IMatrix<T> CreateMatrix | ( | int | num_rows, | |
int | num_columns | |||
) | [virtual] |
Create a matrix with a given number of rows and columns.
num_rows | the number of rows | |
num_columns | the number of columns |
Implements IMatrix< T >.
Reimplemented in SymmetricSparseMatrix< T >.
List<Dictionary<int, T> > row_list = new List<Dictionary<int, T>>() [protected] |
List that stores the rows of the matrix.
virtual bool IsSymmetric [get] |
True if the matrix is symmetric, false otherwise.
True if the matrix is symmetric, false otherwise
Implements IMatrix< T >.
Reimplemented in SymmetricSparseMatrix< T >.
virtual IList<Pair<int, int> > NonEmptyEntryIDs [get] |
The row and column IDs of non-empty entries in the matrix.
The row and column IDs of non-empty entries in the matrix
Reimplemented in SymmetricSparseMatrix< T >.
IList<KeyValuePair<int, Dictionary<int, T> > > NonEmptyRows [get] |
The non-empty rows of the matrix (the ones that contain at least one non-zero entry), with their IDs.
int NumberOfColumns [get, set] |
virtual int NumberOfNonEmptyEntries [get] |
The number of non-empty entries in the matrix.
The number of non-empty entries in the matrix
Reimplemented in SymmetricSparseMatrix< T >.
int NumberOfRows [get] |
virtual T this[int x, int y] [get, set] |
Access the elements of the sparse matrix.
x | the row ID | |
y | the column ID |
Implements IMatrix< T >.
Reimplemented in SymmetricSparseMatrix< T >.
Dictionary<int, T> this[int x] [get] |
Get a row of the matrix.
x | the row ID |
Implements IMatrix< T >.
Reimplemented in SymmetricSparseMatrix< T >.