org.apache.sysml.udf

Class Matrix

    • Constructor Detail

      • Matrix

        public Matrix(long rows,
                      long cols,
                      Matrix.ValueType vType)
        This constructor invokes Matrix(String path, long rows, long cols, ValueType vType) with a default filename of ExternalFunctionProgramBlockCP and hence, should only be used by CP external functions.
        Parameters:
        rows - number of rows
        cols - number of columns
        vType - value type
      • Matrix

        public Matrix(String path,
                      long rows,
                      long cols,
                      Matrix.ValueType vType)
        Constructor that takes matrix file path, num rows, num cols, and matrix value type as parameters.
        Parameters:
        path - file path
        rows - number of rows
        cols - number of columns
        vType - value type
    • Method Detail

      • setMatrixObject

        public void setMatrixObject(org.apache.sysml.runtime.controlprogram.caching.MatrixObject mo)
      • getMatrixObject

        public org.apache.sysml.runtime.controlprogram.caching.MatrixObject getMatrixObject()
      • getFilePath

        public String getFilePath()
        Method to get file path for matrix.
        Returns:
        file path
      • getNumRows

        public long getNumRows()
        Method to get the number of rows in the matrix.
        Returns:
        number of rows
      • getNumCols

        public long getNumCols()
        Method to get the number of cols in the matrix.
        Returns:
        number of columns
      • getValueType

        public Matrix.ValueType getValueType()
        Method to get value type for this matrix.
        Returns:
        value type
      • getMatrixAsDoubleArray

        public double[][] getMatrixAsDoubleArray()
                                          throws DMLRuntimeException,
                                                 IOException
        Method to get matrix as double array. This should only be used if the user knows the matrix fits in memory. We are using the dense representation.
        Returns:
        matrix as two-dimensional double array
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
        IOException - if IOException occurs
      • setMatrixDoubleArray

        public void setMatrixDoubleArray(double[][] data)
                                  throws IOException,
                                         DMLRuntimeException
        Method to set matrix as double array. This should only be used if the user knows the matrix fits in memory. We are using the dense representation.
        Parameters:
        data - matrix as 2-dimensional double array
        Throws:
        IOException - if IOException occurs
        DMLRuntimeException - if DMLRuntimeException occurs
      • setMatrixDoubleArray

        public void setMatrixDoubleArray(double[] data)
                                  throws IOException,
                                         DMLRuntimeException
        Method to set matrix as double array. This should only be used if the user knows the matrix fits in memory. We are using the dense representation.
        Parameters:
        data - matrix as double array
        Throws:
        IOException - if IOException occurs
        DMLRuntimeException - if DMLRuntimeException occurs
      • setMatrixDoubleArray

        public void setMatrixDoubleArray(MatrixBlock mb,
                                         OutputInfo oinfo,
                                         InputInfo iinfo)
                                  throws IOException
        Method to set matrix as double array. This should only be used if the user knows the matrix fits in memory. We are using the dense representation.
        Parameters:
        mb - matrix block
        oinfo - output info
        iinfo - input info
        Throws:
        IOException - if IOException occurs

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