org.apache.sysml.runtime.matrix.data

Class LibMatrixReorg



  • public class LibMatrixReorg
    extends Object
    MB: Library for selected matrix reorg operations including special cases and all combinations of dense and sparse representations. Current list of supported operations: - reshape, - r' (transpose), - rdiag (diagV2M/diagM2V), - rsort (sorting data/indexes) - rmempty (remove empty) - rexpand (outer/table-seq expansion)
    • Field Detail

      • SHALLOW_DENSE_VECTOR_TRANSPOSE

        public static final boolean SHALLOW_DENSE_VECTOR_TRANSPOSE
        See Also:
        Constant Field Values
      • SHALLOW_DENSE_ROWWISE_RESHAPE

        public static final boolean SHALLOW_DENSE_ROWWISE_RESHAPE
        See Also:
        Constant Field Values
    • Method Detail

      • isSupportedReorgOperator

        public static boolean isSupportedReorgOperator(org.apache.sysml.runtime.matrix.operators.ReorgOperator op)
      • rev

        public static void rev(org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue in,
                               long rlen,
                               int brlen,
                               ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> out)
                        throws DMLRuntimeException
        Throws:
        DMLRuntimeException
      • reshape

        public static MatrixBlock reshape(MatrixBlock in,
                                          MatrixBlock out,
                                          int rows,
                                          int cols,
                                          boolean rowwise)
                                   throws DMLRuntimeException
        CP reshape operation (single input, single output matrix)
        Parameters:
        in - input matrix
        out - output matrix
        rows - number of rows
        cols - number of columns
        rowwise - if true, reshape by row
        Returns:
        output matrix
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • reshape

        public static ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> reshape(org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue in,
                                                                                                   long rows1,
                                                                                                   long cols1,
                                                                                                   int brlen1,
                                                                                                   int bclen1,
                                                                                                   ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> out,
                                                                                                   long rows2,
                                                                                                   long cols2,
                                                                                                   int brlen2,
                                                                                                   int bclen2,
                                                                                                   boolean rowwise)
                                                                                            throws DMLRuntimeException
        MR reshape interface - for reshape we cannot view blocks independently, and hence, there are different CP and MR interfaces.
        Parameters:
        in - indexed matrix value
        rows1 - number of rows 1
        cols1 - number of columns 1
        brlen1 - number of rows in a block 1
        bclen1 - number of columns in a block 1
        out - list of indexed matrix values
        rows2 - number of rows 2
        cols2 - number of columns 2
        brlen2 - number of rows in a block 2
        bclen2 - number of columns in a block 2
        rowwise - if true, reshape by row
        Returns:
        list of indexed matrix values
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • rmempty

        public static void rmempty(org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue data,
                                   org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue offset,
                                   boolean rmRows,
                                   long len,
                                   long brlen,
                                   long bclen,
                                   ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outList)
                            throws DMLRuntimeException
        MR rmempty interface - for rmempty we cannot view blocks independently, and hence, there are different CP and MR interfaces.
        Parameters:
        data - ?
        offset - ?
        rmRows - ?
        len - ?
        brlen - number of rows in a block
        bclen - number of columns in a block
        outList - list of indexed matrix values
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • rexpand

        public static MatrixBlock rexpand(MatrixBlock in,
                                          MatrixBlock ret,
                                          double max,
                                          boolean rows,
                                          boolean cast,
                                          boolean ignore)
                                   throws DMLRuntimeException
        CP rexpand operation (single input, single output)
        Parameters:
        in - input matrix
        ret - output matrix
        max - ?
        rows - ?
        cast - ?
        ignore - ?
        Returns:
        output matrix
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • rexpand

        public static void rexpand(org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue data,
                                   double max,
                                   boolean rows,
                                   boolean cast,
                                   boolean ignore,
                                   long brlen,
                                   long bclen,
                                   ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outList)
                            throws DMLRuntimeException
        MR/Spark rexpand operation (single input, multiple outputs incl empty blocks)
        Parameters:
        data - indexed matrix value
        max - ?
        rows - ?
        cast - ?
        ignore - ?
        brlen - number of rows in a block
        bclen - number of columns in a block
        outList - list of indexed matrix values
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs

Copyright © 2017 The Apache Software Foundation. All rights reserved.