Class DoubleMatrix<R,C>

java.lang.Object
ubic.basecode.dataStructure.matrix.AbstractMatrix<R,C,Double>
ubic.basecode.dataStructure.matrix.DoubleMatrix<R,C>
All Implemented Interfaces:
Serializable, Matrix2D<R,C,Double>, PrimitiveMatrix<R,C,Double>
Direct Known Subclasses:
CompressedSparseDoubleMatrix, DenseDoubleMatrix, FastRowAccessDoubleMatrix, SparseDoubleMatrix, SparseRaggedDoubleMatrix

public abstract class DoubleMatrix<R,C> extends AbstractMatrix<R,C,Double> implements PrimitiveMatrix<R,C,Double>
Abstract base class for 2D matrices of double values with named columns and rows.
Author:
pavlidis
See Also:
  • Constructor Details

    • DoubleMatrix

      public DoubleMatrix()
  • Method Details

    • asArray

      public abstract double[][] asArray()
    • copy

      public abstract DoubleMatrix<R,C> copy()
      Create a deep copy of this
      Returns:
      a deep copy of this
    • get

      public abstract double get(int j, int i)
      Parameters:
      j -
      i -
      Returns:
    • getByKeys

      public Double getByKeys(R r, C c)
      Specified by:
      getByKeys in interface Matrix2D<R,C,Double>
      Parameters:
      r -
      c -
    • getColRange

      public abstract DoubleMatrix<R,C> getColRange(int startCol, int endCol)
      Parameters:
      startCol - inclusive, numbered from zero
      endCol - inclusive, numbered from zero
      Returns:
      new matrix with just the requested range of columns from this
    • getColumn

      public abstract double[] getColumn(int j)
    • getColumnByName

      public double[] getColumnByName(C s)
      Parameters:
      s - String
      Returns:
      double[]
    • getEntry

      public Double getEntry(int row, int column)
      Specified by:
      getEntry in interface Matrix2D<R,C,Double>
      Parameters:
      row -
      column -
      Returns:
    • getRawMatrix

      public double[][] getRawMatrix()
    • getRow

      public abstract double[] getRow(int i)
    • getRowArrayList

      public abstract DoubleArrayList getRowArrayList(int i)
    • getRowByName

      public double[] getRowByName(R s)
      Parameters:
      s - String
      Returns:
      double[]
    • getRowRange

      public abstract DoubleMatrix<R,C> getRowRange(int startRow, int endRow)
      Parameters:
      startRow - inclusive, numbered from zero
      endRow - inclusive
      Returns:
    • setByKeys

      public void setByKeys(R r, C c, Double v)
      Specified by:
      setByKeys in interface Matrix2D<R,C,Double>
      Parameters:
      r -
      c -
      v -
    • sortByColumnAbsoluteValues

      public List<R> sortByColumnAbsoluteValues(int i, boolean descending)
      Parameters:
      i -
      descending -
    • subsetColumns

      public abstract DoubleMatrix<R,C> subsetColumns(List<C> columns)
      Create a copy of this matrix with only the selected columns, in the selected order.
      Parameters:
      columns -
      Returns:
    • subsetRows

      public abstract DoubleMatrix<R,C> subsetRows(List<R> rowNames)
      Create a copy of this matrix with only the selected rows, in the selected order.
      Parameters:
      rowNames -
      Returns:
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • transpose

      public abstract DoubleMatrix<C,R> transpose()
    • viewColumn

      public abstract DoubleMatrix1D viewColumn(int column)
    • viewRow

      public abstract DoubleMatrix1D viewRow(int j)
      Parameters:
      j -
      Returns: