Class MatrixWriter

  • Direct Known Subclasses:
    WriterBinaryBlock, WriterHDF5, WriterMatrixMarket, WriterTextCell, WriterTextCSV, WriterTextLIBSVM

    public abstract class MatrixWriter
    extends Object
    Base class for all format-specific matrix writers. Every writer is required to implement the basic write functionality but might provide additional custom functionality. Any non-default parameters (e.g., CSV read properties) should be passed into custom constructors. There is also a factory for creating format-specific writers.
    • Constructor Detail

      • MatrixWriter

        public MatrixWriter()
    • Method Detail

      • writeMatrixToHDFS

        public abstract void writeMatrixToHDFS​(MatrixBlock src,
                                               String fname,
                                               long rlen,
                                               long clen,
                                               int blen,
                                               long nnz,
                                               boolean diag)
                                        throws IOException
        Throws:
        IOException
      • writeEmptyMatrixToHDFS

        public abstract void writeEmptyMatrixToHDFS​(String fname,
                                                    long rlen,
                                                    long clen,
                                                    int blen)
                                             throws IOException
        Writes a minimal entry to represent an empty matrix on hdfs.
        Parameters:
        fname - file name
        rlen - number of rows
        clen - number of columns
        blen - number of rows/cols in block
        Throws:
        IOException - if IOException occurs
      • createMatrixBlocksForReuse

        public static MatrixBlock[] createMatrixBlocksForReuse​(long rlen,
                                                               long clen,
                                                               int blen,
                                                               boolean sparse,
                                                               long nonZeros)
      • getMatrixBlockForReuse

        public static MatrixBlock getMatrixBlockForReuse​(MatrixBlock[] blocks,
                                                         int rows,
                                                         int cols,
                                                         int blen)