SparseMatrix< T > Class Template Reference

Class for storing sparse matrices. More...

Inheritance diagram for SparseMatrix< T >:
IMatrix< T > SymmetricSparseMatrix< T >

List of all members.

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.
virtual IMatrix< T > Transpose ()
 Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged.

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.

Detailed Description

template<T>
class MyMediaLite::DataType::SparseMatrix< T >

Class for storing sparse matrices.

The data is stored in row-major mode. Indexes are zero-based.

Template Parameters:
T the matrix element type, must have a default constructor/value
Type Constraints
T :new() 

Constructor & Destructor Documentation

SparseMatrix ( int  num_rows,
int  num_cols 
)

Create a sparse matrix with a given number of rows.

Parameters:
num_rows the number of rows
num_cols the number of columns

Member Function Documentation

virtual IMatrix<T> CreateMatrix ( int  num_rows,
int  num_columns 
) [virtual]

Create a matrix with a given number of rows and columns.

Parameters:
num_rows the number of rows
num_columns the number of columns
Returns:
A matrix with num_rows rows and num_column columns

Implements IMatrix< T >.

Reimplemented in SymmetricSparseMatrix< T >.

virtual IMatrix<T> Transpose (  )  [virtual]

Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged.

Returns:
the transpose of the matrix (copy)

Implements IMatrix< T >.


Member Data Documentation

List<Dictionary<int, T> > row_list = new List<Dictionary<int, T>>() [protected]

List that stores the rows of the matrix.


Property Documentation

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]

The number of columns of the matrix.

The number of columns of the matrix

Implements IMatrix< T >.

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]

The number of rows of the matrix.

The number of rows of the matrix

Implements IMatrix< T >.

virtual T this[int x, int y] [get, set]

Access the elements of the sparse matrix.

Parameters:
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.

Parameters:
x the row ID

Implements IMatrix< T >.

Reimplemented in SymmetricSparseMatrix< T >.


The documentation for this class was generated from the following file:
Generated on Thu Sep 1 19:35:57 2011 for MyMediaLite by  doxygen 1.6.3