org.apache.sysml.api.mlcontext

Class Matrix



  • public class Matrix
    extends Object
    Matrix encapsulates a SystemML matrix. It allows for easy conversion to various other formats, such as RDDs, JavaRDDs, DataFrames, BinaryBlockMatrices, and double[][]s. After script execution, it offers a convenient format for obtaining SystemML matrix data in Scala tuples.
    • Constructor Detail

      • Matrix

        public Matrix(org.apache.sysml.runtime.controlprogram.caching.MatrixObject matrixObject,
                      org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext sparkExecutionContext)
    • Method Detail

      • toMatrixObject

        public org.apache.sysml.runtime.controlprogram.caching.MatrixObject toMatrixObject()
        Obtain the matrix as a SystemML MatrixObject.
        Returns:
        the matrix as a SystemML MatrixObject
      • to2DDoubleArray

        public double[][] to2DDoubleArray()
        Obtain the matrix as a two-dimensional double array
        Returns:
        the matrix as a two-dimensional double array
      • toJavaRDDStringIJV

        public org.apache.spark.api.java.JavaRDD<String> toJavaRDDStringIJV()
        Obtain the matrix as a JavaRDD<String> in IJV format
        Returns:
        the matrix as a JavaRDD<String> in IJV format
      • toJavaRDDStringCSV

        public org.apache.spark.api.java.JavaRDD<String> toJavaRDDStringCSV()
        Obtain the matrix as a JavaRDD<String> in CSV format
        Returns:
        the matrix as a JavaRDD<String> in CSV format
      • toRDDStringCSV

        public org.apache.spark.rdd.RDD<String> toRDDStringCSV()
        Obtain the matrix as a RDD<String> in CSV format
        Returns:
        the matrix as a RDD<String> in CSV format
      • toRDDStringIJV

        public org.apache.spark.rdd.RDD<String> toRDDStringIJV()
        Obtain the matrix as a RDD<String> in IJV format
        Returns:
        the matrix as a RDD<String> in IJV format
      • toDF

        public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDF()
        Obtain the matrix as a DataFrame of doubles with an ID column
        Returns:
        the matrix as a DataFrame of doubles with an ID column
      • toDFDoubleWithIDColumn

        public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFDoubleWithIDColumn()
        Obtain the matrix as a DataFrame of doubles with an ID column
        Returns:
        the matrix as a DataFrame of doubles with an ID column
      • toDFDoubleNoIDColumn

        public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFDoubleNoIDColumn()
        Obtain the matrix as a DataFrame of doubles with no ID column
        Returns:
        the matrix as a DataFrame of doubles with no ID column
      • toDFVectorWithIDColumn

        public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFVectorWithIDColumn()
        Obtain the matrix as a DataFrame of vectors with an ID column
        Returns:
        the matrix as a DataFrame of vectors with an ID column
      • toDFVectorNoIDColumn

        public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFVectorNoIDColumn()
        Obtain the matrix as a DataFrame of vectors with no ID column
        Returns:
        the matrix as a DataFrame of vectors with no ID column
      • toBinaryBlockMatrix

        public BinaryBlockMatrix toBinaryBlockMatrix()
        Obtain the matrix as a BinaryBlockMatrix
        Returns:
        the matrix as a BinaryBlockMatrix
      • getMatrixMetadata

        public MatrixMetadata getMatrixMetadata()
        Obtain the matrix metadata
        Returns:
        the matrix metadata

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