public class DistributedRowMatrix extends Object implements DistributedMatrix
param: data DataSet
which contains IndexedRow
s
param: numRows Number of rows
param: numCols Number of columns
Constructor and Description |
---|
DistributedRowMatrix(DataSet<IndexedRow> data,
int numRows,
int numCols) |
Modifier and Type | Method and Description |
---|---|
DistributedRowMatrix |
add(DistributedRowMatrix other)
Adds this matrix to another matrix.
|
DistributedRowMatrix |
byRowOperation(scala.Function2<Vector,Vector,Vector> func,
DistributedRowMatrix other)
Applies a high-order function to couple of rows.
|
DataSet<IndexedRow> |
data() |
static DistributedRowMatrix |
fromCOO(DataSet<scala.Tuple3<Object,Object,Object>> data,
int numRows,
int numCols,
boolean isSorted)
Builds a
DistributedRowMatrix from a DataSet in COO. |
int |
numCols()
Returns number of columns in matrix.
|
int |
numRows()
Returns number of rows in matrix.
|
DistributedRowMatrix |
subtract(DistributedRowMatrix other)
Subtracts another matrix from this matrix.
|
scala.collection.Seq<scala.Tuple3<Object,Object,Object>> |
toCOO()
Collects the data in the form of a sequence of coordinates associated with their values.
|
DenseMatrix |
toLocalDenseMatrix()
Collects the data in the form of a DenseMatrix.
|
SparseMatrix |
toLocalSparseMatrix()
Collects the data in the form of a SparseMatrix.
|
public DistributedRowMatrix(DataSet<IndexedRow> data, int numRows, int numCols)
public static DistributedRowMatrix fromCOO(DataSet<scala.Tuple3<Object,Object,Object>> data, int numRows, int numCols, boolean isSorted)
DistributedRowMatrix
from a DataSet
in COO.
data
- DataSet
which contains matrix elements in the form of
(row index, column index, value)numRows
- Number of rowsnumCols
- Number of columnsisSorted
- If false, sorts the row to properly build the matrix representation.
If already sorted, set this parameter to true to skip sorting.DistributedRowMatrix
build from the original coordinate matrixpublic DataSet<IndexedRow> data()
public int numRows()
DistributedMatrix
numRows
in interface DistributedMatrix
public int numCols()
DistributedMatrix
numCols
in interface DistributedMatrix
public scala.collection.Seq<scala.Tuple3<Object,Object,Object>> toCOO()
public SparseMatrix toLocalSparseMatrix()
SparseMatrix
public DenseMatrix toLocalDenseMatrix()
DenseMatrix
public DistributedRowMatrix byRowOperation(scala.Function2<Vector,Vector,Vector> func, DistributedRowMatrix other)
func
- a function to be appliedother
- a DistributedRowMatrix
to apply the function togetherDistributedRowMatrix
public DistributedRowMatrix add(DistributedRowMatrix other)
other
- a DistributedRowMatrix
to be addedDistributedRowMatrix
representing the two matrices added.public DistributedRowMatrix subtract(DistributedRowMatrix other)
other
- a DistributedRowMatrix
to be subtracted from this matrixDistributedRowMatrix
representing the original matrix subtracted by the supplied
matrix.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.