public class CoordinateMatrix extends Object implements DistributedMatrix
param: entries matrix entries param: nRows number of rows. A non-positive value means unknown, and then the number of rows will be determined by the max row index plus one. param: nCols number of columns. A non-positive value means unknown, and then the number of columns will be determined by the max column index plus one.
Constructor and Description |
---|
CoordinateMatrix(RDD<MatrixEntry> entries)
Alternative constructor leaving matrix dimensions to be determined automatically.
|
CoordinateMatrix(RDD<MatrixEntry> entries,
long nRows,
long nCols) |
Modifier and Type | Method and Description |
---|---|
RDD<MatrixEntry> |
entries() |
long |
numCols()
Gets or computes the number of columns.
|
long |
numRows()
Gets or computes the number of rows.
|
BlockMatrix |
toBlockMatrix()
Converts to BlockMatrix.
|
BlockMatrix |
toBlockMatrix(int rowsPerBlock,
int colsPerBlock)
Converts to BlockMatrix.
|
IndexedRowMatrix |
toIndexedRowMatrix()
Converts to IndexedRowMatrix.
|
RowMatrix |
toRowMatrix()
Converts to RowMatrix, dropping row indices after grouping by row index.
|
CoordinateMatrix |
transpose()
Transposes this CoordinateMatrix.
|
public CoordinateMatrix(RDD<MatrixEntry> entries, long nRows, long nCols)
public CoordinateMatrix(RDD<MatrixEntry> entries)
public RDD<MatrixEntry> entries()
public long numCols()
numCols
in interface DistributedMatrix
public long numRows()
numRows
in interface DistributedMatrix
public BlockMatrix toBlockMatrix()
SparseMatrix
with size 1024 x 1024.public BlockMatrix toBlockMatrix(int rowsPerBlock, int colsPerBlock)
SparseMatrix
.rowsPerBlock
- The number of rows of each block. The blocks at the bottom edge may have
a smaller value. Must be an integer value greater than 0.colsPerBlock
- The number of columns of each block. The blocks at the right edge may have
a smaller value. Must be an integer value greater than 0.BlockMatrix
public IndexedRowMatrix toIndexedRowMatrix()
public RowMatrix toRowMatrix()
public CoordinateMatrix transpose()