MyMediaLite  3.11
Public Member Functions | Properties | List of all members
SparseBooleanMatrix Class Reference

Sparse representation of a boolean matrix, using HashSets More...

Inheritance diagram for SparseBooleanMatrix:
IBooleanMatrix IMatrix< bool >

Public Member Functions

IMatrix< bool > CreateMatrix (int x, int y)
 
IList< int > GetEntriesByColumn (int column_id)
 
IList< int > GetEntriesByRow (int row_id)
 Get all true entries (column IDs) of a row More...
 
int NumEntriesByColumn (int column_id)
 Get all the number of entries in a column More...
 
int NumEntriesByRow (int row_id)
 Get all the number of entries in a row More...
 
int Overlap (IBooleanMatrix s)
 Get the overlap of two matrices, i.e. the number of true entries where they agree More...
 
void Resize (int num_rows, int num_cols)
 
IMatrix< bool > Transpose ()
 Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged More...
 

Properties

virtual bool IsSymmetric [get]
 
IList< int > NonEmptyColumnIDs [get]
 
IList< int > NonEmptyRowIDs [get]
 
int NumberOfColumns [get]
 The number of columns in the matrix More...
 
int NumberOfEntries [get]
 
int NumberOfRows [get]
 The number of rows in the matrix More...
 
bool this[int x, int y] [get, set]
 Indexer to access the elements of the matrix More...
 
ICollection< int > this[int x] [get]
 

Detailed Description

Sparse representation of a boolean matrix, using HashSets

Fast row-wise access is possible. Indexes are zero-based.

Member Function Documentation

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

Parameters
row_idthe row ID
Returns
a list of column IDs

Implements IBooleanMatrix.

int NumEntriesByColumn ( int  column_id)
inline

Get all the number of entries in a column

Parameters
column_idthe column ID
Returns
the number of entries in column column_id

Implements IBooleanMatrix.

int NumEntriesByRow ( int  row_id)
inline

Get all the number of entries in a row

Parameters
row_idthe row ID
Returns
the number of entries in row 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

Parameters
sthe SparseBooleanMatrix to compare to
Returns
the number of entries that are true in both matrices

Implements IBooleanMatrix.

IMatrix<bool> Transpose ( )
inline

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

Returns
the transpose of the matrix (copy)

Property Documentation

IList<int> NonEmptyColumnIDs
get

iterates over the complete data structure

int NumberOfColumns
get

The number of columns in the matrix

The number of columns in the matrix

int NumberOfRows
get

The number of rows in the matrix

The number of rows in the matrix

bool this[int x, int y]
getset

Indexer to access the elements of the matrix

Parameters
xthe row ID
ythe column ID

The documentation for this class was generated from the following file: