MyMediaLite
3.07
|
Sparse representation of a boolean matrix, using HashSets. More...
Public Member Functions | |
IMatrix< bool > | CreateMatrix (int x, int y) |
Create a matrix with a given number of rows and columns. | |
IList< int > | GetEntriesByColumn (int column_id) |
IList< int > | GetEntriesByRow (int row_id) |
Get all true entries (column IDs) of a row. | |
int | NumEntriesByColumn (int column_id) |
Get all the number of entries in a column. | |
int | NumEntriesByRow (int row_id) |
Get all the number of entries in a row. | |
int | Overlap (IBooleanMatrix s) |
Get the overlap of two matrices, i.e. the number of true entries where they agree. | |
void | Resize (int num_rows, int num_cols) |
Grows or shrinks the matrix to the requested size, if necessary. | |
IMatrix< bool > | Transpose () |
Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged. | |
Protected Attributes | |
internal IList< ISet< int > > | row_list = new List<ISet<int>>() |
internal data representation: list of sets representing the rows | |
Properties | |
virtual bool | IsSymmetric [get] |
True if the matrix is stored in a symmetric manner, false otherwise. | |
IList< int > | NonEmptyColumnIDs [get] |
IList< int > | NonEmptyRowIDs [get] |
The IDs of the non-empty rows in the matrix (the ones that contain at least one true entry) | |
int | NumberOfColumns [get] |
The number of columns in the matrix. | |
int | NumberOfEntries [get] |
The number of (true) entries. | |
int | NumberOfRows [get] |
The number of rows in the matrix. | |
bool | this[int x, int y] [get, set] |
Indexer to access the elements of the matrix. | |
ICollection< int > | this[int x] [get] |
Indexer to access the rows of the matrix. |
Sparse representation of a boolean matrix, using HashSets.
Fast row-wise access is possible. Indexes are zero-based.
IMatrix<bool> CreateMatrix | ( | int | num_rows, |
int | num_columns | ||
) | [inline] |
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 >.
IList<int> GetEntriesByColumn | ( | int | column_id | ) | [inline] |
Takes O(N) worst-case time, where N is the number of rows, if the internal hash table can be queried in constant time.
Implements IBooleanMatrix.
IList<int> GetEntriesByRow | ( | int | row_id | ) | [inline] |
Get all true entries (column IDs) of a row.
row_id | the row ID |
Implements IBooleanMatrix.
int NumEntriesByColumn | ( | int | column_id | ) | [inline] |
Get all the number of entries in a column.
column_id | the column ID |
Implements IBooleanMatrix.
int NumEntriesByRow | ( | int | row_id | ) | [inline] |
Get all the number of entries in a row.
row_id | the row ID |
Implements IBooleanMatrix.
int Overlap | ( | IBooleanMatrix | s | ) | [inline] |
Get the overlap of two matrices, i.e. the number of true entries where they agree.
s | the SparseBooleanMatrix to compare to |
Implements IBooleanMatrix.
void Resize | ( | int | num_rows, |
int | num_cols | ||
) | [inline] |
Grows or shrinks the matrix to the requested size, if necessary.
The new entries are filled with zeros. Obsolete entries are removed.
num_rows | the number of rows |
num_cols | the number of columns |
Implements IMatrix< T >.
Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged.
Implements IMatrix< T >.
internal IList<ISet<int> > row_list = new List<ISet<int>>() [protected] |
internal data representation: list of sets representing the rows
virtual bool IsSymmetric [get] |
True if the matrix is stored in a symmetric manner, false otherwise.
Also true for skew symmetric matrices that exploit this property in order to save memory
Implements IMatrix< T >.
IList<int> NonEmptyColumnIDs [get] |
iterates over the complete data structure
Implements IBooleanMatrix.
IList<int> NonEmptyRowIDs [get] |
The IDs of the non-empty rows in the matrix (the ones that contain at least one true entry)
Implements IBooleanMatrix.
int NumberOfColumns [get] |
int NumberOfEntries [get] |
The number of (true) entries.
Implements IBooleanMatrix.
int NumberOfRows [get] |
bool this[int x, int y] [get, set] |
Indexer to access the elements of the matrix.
x | the row ID |
y | the column ID |
Implements IMatrix< T >.
ICollection<int> this[int x] [get] |