org.mymedialite.datatype
Interface IMatrix<T>

All Known Subinterfaces:
IBooleanMatrix
All Known Implementing Classes:
BinaryCosine, BinaryDataCorrelationMatrix, CorrelationMatrix, Jaccard, Matrix, Pearson, RatingCorrelationMatrix, SkewSymmetricSparseMatrix, SparseBooleanMatrix, SparseBooleanMatrixBinarySearch, SparseBooleanMatrixStatic, SparseMatrix, SymmetricMatrix, SymmetricSparseMatrix, WeightedBinaryCosine

public interface IMatrix<T>

Generic interface for matrix data types


Method Summary
 IMatrix<T> createMatrix(int num_rows, int num_columns)
          Create a matrix with a given number of rows and columns.
 T get(int x, int y)
          Get the value at (i,j)
 void grow(int numRows, int numCols)
          Grows the matrix to the requested size, if necessary.
 boolean isSymmetric()
          True if the matrix is symmetric, false otherwise.
 int numberOfColumns()
          Get the number of columns of the matrix.
 int numberOfRows()
          Get the number of rows of the matrix.
 void set(int x, int y, T value)
          Set the value at (i,j)
 IMatrix<T> transpose()
          Get the transpose of the matrix, i.e.
 

Method Detail

get

T get(int x,
      int y)
Get the value at (i,j)

Parameters:
x - the row ID
y - the column ID
Returns:
the value at (i,j)

set

void set(int x,
         int y,
         T value)
Set the value at (i,j)

Parameters:
x - the row ID
y - the column ID
value - the value

numberOfRows

int numberOfRows()
Get the number of rows of the matrix.

Returns:
the number of rows of the matrix

numberOfColumns

int numberOfColumns()
Get the number of columns of the matrix.

Returns:
rhe number of columns of the matrix

isSymmetric

boolean isSymmetric()
True if the matrix is symmetric, false otherwise.

Returns:
true if the matrix is symmetric, false otherwise

transpose

IMatrix<T> transpose()
Get the transpose of the matrix, i.e. a matrix where rows and columns are interchanged.

Returns:
the transpose of the matrix (copy)

createMatrix

IMatrix<T> createMatrix(int num_rows,
                        int num_columns)
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

grow

void grow(int numRows,
          int numCols)
Grows the matrix to the requested size, if necessary. The new entries are filled with zeros.

Parameters:
numRows - the minimum number of rows
numCols - the minimum number of columns