public class Matrix extends Object
| Constructor and Description |
|---|
Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame)
Convert a Spark DataFrame to a SystemDS binary-block representation.
|
Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame,
long numRows,
long numCols)
Convert a Spark DataFrame to a SystemDS binary-block representation,
specifying the number of rows and columns.
|
Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame,
MatrixMetadata matrixMetadata)
Convert a Spark DataFrame to a SystemDS binary-block representation.
|
Matrix(org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> binaryBlocks,
MatrixMetadata matrixMetadata)
Create a Matrix, specifying the SystemDS binary-block matrix and its
metadata.
|
Matrix(MatrixObject matrixObject,
SparkExecutionContext sparkExecutionContext) |
| Modifier and Type | Method and Description |
|---|---|
MatrixMetadata |
getMatrixMetadata()
Obtain the matrix metadata
|
boolean |
hasBinaryBlocks()
Whether or not this matrix contains data as binary blocks
|
boolean |
hasMatrixObject()
Whether or not this matrix contains data as a MatrixObject
|
double[][] |
to2DDoubleArray()
Obtain the matrix as a two-dimensional double array
|
org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> |
toBinaryBlocks()
Obtain the matrix as a
JavaPairRDD<MatrixIndexes, MatrixBlock> |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDF()
Obtain the matrix as a
DataFrame of doubles with an ID column |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDFDoubleNoIDColumn()
Obtain the matrix as a
DataFrame of doubles with no ID column |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDFDoubleWithIDColumn()
Obtain the matrix as a
DataFrame of doubles with an ID column |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDFVectorNoIDColumn()
Obtain the matrix as a
DataFrame of vectors with no ID column |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDFVectorWithIDColumn()
Obtain the matrix as a
DataFrame of vectors with an ID column |
org.apache.spark.api.java.JavaRDD<String> |
toJavaRDDStringCSV()
Obtain the matrix as a
JavaRDD<String> in CSV format |
org.apache.spark.api.java.JavaRDD<String> |
toJavaRDDStringIJV()
Obtain the matrix as a
JavaRDD<String> in IJV format |
MatrixBlock |
toMatrixBlock()
Obtain the matrix as a
MatrixBlock |
MatrixObject |
toMatrixObject()
Obtain the matrix as a SystemDS MatrixObject.
|
org.apache.spark.rdd.RDD<String> |
toRDDStringCSV()
Obtain the matrix as a
RDD<String> in CSV format |
org.apache.spark.rdd.RDD<String> |
toRDDStringIJV()
Obtain the matrix as a
RDD<String> in IJV format |
String |
toString()
If
MatrixObject is available, output
MatrixObject.toString(). |
public Matrix(MatrixObject matrixObject, SparkExecutionContext sparkExecutionContext)
public Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame,
MatrixMetadata matrixMetadata)
dataFrame - the Spark DataFramematrixMetadata - matrix metadata, such as number of rows and columnspublic Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame,
long numRows,
long numCols)
dataFrame - the Spark DataFramenumRows - the number of rowsnumCols - the number of columnspublic Matrix(org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> binaryBlocks, MatrixMetadata matrixMetadata)
binaryBlocks - the JavaPairRDD<MatrixIndexes, MatrixBlock> matrixmatrixMetadata - matrix metadata, such as number of rows and columnspublic Matrix(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame)
dataFrame - the Spark DataFramepublic MatrixObject toMatrixObject()
public double[][] to2DDoubleArray()
public org.apache.spark.api.java.JavaRDD<String> toJavaRDDStringIJV()
JavaRDD<String> in IJV formatJavaRDD<String> in IJV formatpublic org.apache.spark.api.java.JavaRDD<String> toJavaRDDStringCSV()
JavaRDD<String> in CSV formatJavaRDD<String> in CSV formatpublic org.apache.spark.rdd.RDD<String> toRDDStringCSV()
RDD<String> in CSV formatRDD<String> in CSV formatpublic org.apache.spark.rdd.RDD<String> toRDDStringIJV()
RDD<String> in IJV formatRDD<String> in IJV formatpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDF()
DataFrame of doubles with an ID columnDataFrame of doubles with an ID columnpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFDoubleWithIDColumn()
DataFrame of doubles with an ID columnDataFrame of doubles with an ID columnpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFDoubleNoIDColumn()
DataFrame of doubles with no ID columnDataFrame of doubles with no ID columnpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFVectorWithIDColumn()
DataFrame of vectors with an ID columnDataFrame of vectors with an ID columnpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDFVectorNoIDColumn()
DataFrame of vectors with no ID columnDataFrame of vectors with no ID columnpublic org.apache.spark.api.java.JavaPairRDD<MatrixIndexes,MatrixBlock> toBinaryBlocks()
JavaPairRDD<MatrixIndexes, MatrixBlock>JavaPairRDD<MatrixIndexes, MatrixBlock>public MatrixBlock toMatrixBlock()
MatrixBlockMatrixBlockpublic MatrixMetadata getMatrixMetadata()
public String toString()
MatrixObject is available, output
MatrixObject.toString(). If MatrixObject is not available
but MatrixMetadata is available, output
MatrixMetadata.toString(). Otherwise output
Object.toString().public boolean hasBinaryBlocks()
true if data as binary blocks are present, false
otherwise.public boolean hasMatrixObject()
true if data as binary blocks are present, false
otherwise.Copyright © 2020 The Apache Software Foundation. All rights reserved.