Class MatrixWriter<R,​C>


  • public class MatrixWriter<R,​C>
    extends Object
    Class for writing matrices to disk
    Author:
    Raymond Lim, paul
    • Method Detail

      • setColNameMap

        public void setColNameMap​(Map<C,​String> colNameMap)
        Use to customize the labels instead of relying on the toString method of the column object
        Parameters:
        colNameMap -
      • setRowNameMap

        public void setRowNameMap​(Map<R,​String> rowNameMap)
        Use to customize the labels instead of relying on the toString method of the row object
        Parameters:
        rowNameMap -
      • setSep

        public void setSep​(String sep)
      • setSliceNameMap

        public void setSliceNameMap​(Map<?,​String> sliceNameMap)
      • setTopLeft

        public void setTopLeft​(String topLeft)
      • writeMatrix

        public <V> void writeMatrix​(Matrix2D<R,​C,​V> matrix,
                                    boolean printNames)
                             throws IOException
        Type Parameters:
        V -
        Parameters:
        matrix -
        printNames - Should the row and column names be included; FIXME this fails if names aren't provided
        Throws:
        IOException
      • writeMatrix

        public void writeMatrix​(cern.colt.matrix.DoubleMatrix2D coltMatrix)
                         throws IOException
        Write a bare matrix without row names or columns
        Parameters:
        coltMatrix -
        Throws:
        IOException
      • writeMatrix

        public void writeMatrix​(cern.colt.matrix.DoubleMatrix1D coltMatrix)
                         throws IOException
        Write a bare 1D matrix (one value per line)
        Parameters:
        coltMatrix -
        Throws:
        IOException
      • writeMatrix

        public <S,​V> void writeMatrix​(Matrix3D<R,​C,​S,​V> matrix,
                                            boolean printNames)
                                     throws IOException
        Writes a 3d matrix, collapsing the rows and columns
        Parameters:
        matrix -
        printNames -
        Throws:
        IOException