sbrt.kernel.math.algebra
Class DoubleMatrixWrap<R,C>

java.lang.Object
  extended by sbrt.kernel.math.algebra.MatrixWrap<R,C,java.lang.Double>
      extended by sbrt.kernel.math.algebra.DoubleMatrixWrap<R,C>
Type Parameters:
R - the row type.
C - the column type.
All Implemented Interfaces:
DoubleMatrix<R,C>, Matrix<R,C,java.lang.Double>
Direct Known Subclasses:
SparseDoubleMatrixWrap

public class DoubleMatrixWrap<R,C>
extends MatrixWrap<R,C,java.lang.Double>
implements DoubleMatrix<R,C>

This class is used to wrap mutable matrices as an immutable DoubleMatrix. This type of wrapping eliminates the possibility of casting a mutable matrix back to its mutable type. This ensures that a mutable matrix can be viewed by others in a safe way, without fear of modification.

Instances of this class are immutable.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
DoubleMatrixWrap(DoubleMatrix<R,C> m)
          Constructs a new wrapper around the provided matrix.
 
Method Summary
 DoubleMatrix<R,C> getColumn(java.lang.Object columnIndex)
          Returns the column corresponding to the provided column index.
 java.lang.Double getElement(java.lang.Object rowIndex, java.lang.Object columnIndex)
          Returns the element of this matrix at the provided row and column indices.
 DoubleMatrix<R,C> getRow(java.lang.Object rowIndex)
          Returns the row corresponding to the provided row index.
 java.util.List<LinearComb<C>> toLinearCombs()
          Returns this matrix as a list of linear combinations.
 
Methods inherited from class sbrt.kernel.math.algebra.MatrixWrap
columns, equals, getColumnIndices, getRowIndices, hashCode, isColumnIndex, isEmpty, isRowIndex, rows, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sbrt.kernel.math.algebra.Matrix
columns, equals, getColumnIndices, getRowIndices, hashCode, isColumnIndex, isEmpty, isRowIndex, rows, toString
 

Constructor Detail

DoubleMatrixWrap

public DoubleMatrixWrap(DoubleMatrix<R,C> m)
Constructs a new wrapper around the provided matrix.

Parameters:
m - the matrix to be wrapped by this wrapper object.
Throws:
java.lang.NullPointerException - if the provided matrix is null.
Method Detail

getElement

public java.lang.Double getElement(java.lang.Object rowIndex,
                                   java.lang.Object columnIndex)
Returns the element of this matrix at the provided row and column indices.

Specified by:
getElement in interface DoubleMatrix<R,C>
Specified by:
getElement in interface Matrix<R,C,java.lang.Double>
Overrides:
getElement in class MatrixWrap<R,C,java.lang.Double>
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the element of this matrix at the provided row and column indices.

getRow

public DoubleMatrix<R,C> getRow(java.lang.Object rowIndex)
Returns the row corresponding to the provided row index. A row is itself a 1 x n matrix, where n is the number of columns in this matrix.

Specified by:
getRow in interface DoubleMatrix<R,C>
Specified by:
getRow in interface Matrix<R,C,java.lang.Double>
Overrides:
getRow in class MatrixWrap<R,C,java.lang.Double>
Parameters:
rowIndex - the index of the row to be returned.
Returns:
the row corresponding to the provided row index.

getColumn

public DoubleMatrix<R,C> getColumn(java.lang.Object columnIndex)
Returns the column corresponding to the provided column index. A column is itself an m x 1 matrix, where m is the number of rows in this matrix.

Specified by:
getColumn in interface DoubleMatrix<R,C>
Specified by:
getColumn in interface Matrix<R,C,java.lang.Double>
Overrides:
getColumn in class MatrixWrap<R,C,java.lang.Double>
Parameters:
columnIndex - the index of the column to be returned.
Returns:
the column corresponding to the provided column index.

toLinearCombs

public java.util.List<LinearComb<C>> toLinearCombs()
Returns this matrix as a list of linear combinations. In other words, this method returns the product of this matrix with a column vector of the column indices of this matrix.

Specified by:
toLinearCombs in interface DoubleMatrix<R,C>
Returns:
this matrix as a list of linear combinations.