Class CoordinateMatrix
Object
org.apache.spark.mllib.linalg.distributed.CoordinateMatrix
- All Implemented Interfaces:
Serializable
,DistributedMatrix
Represents a matrix in coordinate format.
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.
- See Also:
-
Constructor Summary
ConstructorDescriptionCoordinateMatrix
(RDD<MatrixEntry> entries) Alternative constructor leaving matrix dimensions to be determined automatically.CoordinateMatrix
(RDD<MatrixEntry> entries, long nRows, long nCols) -
Method Summary
Modifier and TypeMethodDescriptionentries()
long
numCols()
Gets or computes the number of columns.long
numRows()
Gets or computes the number of rows.Converts to BlockMatrix.toBlockMatrix
(int rowsPerBlock, int colsPerBlock) Converts to BlockMatrix.Converts to IndexedRowMatrix.Converts to RowMatrix, dropping row indices after grouping by row index.Transposes this CoordinateMatrix.
-
Constructor Details
-
CoordinateMatrix
-
CoordinateMatrix
Alternative constructor leaving matrix dimensions to be determined automatically.
-
-
Method Details
-
entries
-
numCols
public long numCols()Gets or computes the number of columns.- Specified by:
numCols
in interfaceDistributedMatrix
-
numRows
public long numRows()Gets or computes the number of rows.- Specified by:
numRows
in interfaceDistributedMatrix
-
toBlockMatrix
Converts to BlockMatrix. Creates blocks ofSparseMatrix
with size 1024 x 1024.- Returns:
- (undocumented)
-
toBlockMatrix
Converts to BlockMatrix. Creates blocks ofSparseMatrix
.- Parameters:
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.- Returns:
- a
BlockMatrix
-
toIndexedRowMatrix
Converts to IndexedRowMatrix. The number of columns must be within the integer range. -
toRowMatrix
Converts to RowMatrix, dropping row indices after grouping by row index. The number of columns must be within the integer range.- Returns:
- (undocumented)
-
transpose
Transposes this CoordinateMatrix.
-