Class IndexedRowMatrix
- All Implemented Interfaces:
- Serializable,- DistributedMatrix
DistributedMatrix with
 indexed rows.
 param: rows indexed rows of this matrix 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 size of the first row.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionIndexedRowMatrix(RDD<IndexedRow> rows) Alternative constructor leaving matrix dimensions to be determined automatically.IndexedRowMatrix(RDD<IndexedRow> rows, long nRows, int nCols) 
- 
Method SummaryModifier and TypeMethodDescriptionCompute all cosine similarities between columns of this matrix using the brute-force approach of computing normalized dot products.Computes the Gramian matrixA^T A.computeSVD(int k, boolean computeU, double rCond) Computes the singular value decomposition of this IndexedRowMatrix.Multiply this matrix by a local matrix on the right.longnumCols()Gets or computes the number of columns.longnumRows()Gets or computes the number of rows.rows()Converts to BlockMatrix.toBlockMatrix(int rowsPerBlock, int colsPerBlock) Converts to BlockMatrix.Converts this matrix to aCoordinateMatrix.Drops row indices and converts this matrix to aRowMatrix.
- 
Constructor Details- 
IndexedRowMatrix
- 
IndexedRowMatrixAlternative constructor leaving matrix dimensions to be determined automatically.
 
- 
- 
Method Details- 
columnSimilaritiesCompute all cosine similarities between columns of this matrix using the brute-force approach of computing normalized dot products.- Returns:
- An n x n sparse upper-triangular matrix of cosine similarities between columns of this matrix.
 
- 
computeGramianMatrixComputes the Gramian matrixA^T A.- Returns:
- (undocumented)
- Note:
- This cannot be computed on matrices with more than 65535 columns.
 
- 
computeSVDpublic SingularValueDecomposition<IndexedRowMatrix,Matrix> computeSVD(int k, boolean computeU, double rCond) Computes the singular value decomposition of this IndexedRowMatrix. Denote this matrix by A (m x n), this will compute matrices U, S, V such that A = U * S * V'.The cost and implementation of this method is identical to that in RowMatrixWith the addition of indices.At most k largest non-zero singular values and associated vectors are returned. If there are k such values, then the dimensions of the return will be: U is an IndexedRowMatrixof size m x k that satisfies U'U = eye(k), s is a Vector of size k, holding the singular values in descending order, and V is a local Matrix of size n x k that satisfies V'V = eye(k).- Parameters:
- k- number of singular values to keep. We might return less than k if there are numerically zero singular values. See rCond.
- computeU- whether to compute U
- rCond- the reciprocal condition number. All singular values smaller than rCond * sigma(0) are treated as zero, where sigma(0) is the largest singular value.
- Returns:
- SingularValueDecomposition(U, s, V)
 
- 
multiplyMultiply this matrix by a local matrix on the right.- Parameters:
- B- a local matrix whose number of rows must match the number of columns of this matrix
- Returns:
- an IndexedRowMatrix representing the product, which preserves partitioning
 
- 
numColspublic long numCols()Description copied from interface:DistributedMatrixGets or computes the number of columns.- Specified by:
- numColsin interface- DistributedMatrix
 
- 
numRowspublic long numRows()Description copied from interface:DistributedMatrixGets or computes the number of rows.- Specified by:
- numRowsin interface- DistributedMatrix
 
- 
rows
- 
toBlockMatrixConverts to BlockMatrix. Creates blocks with size 1024 x 1024.- Returns:
- (undocumented)
 
- 
toBlockMatrixConverts to BlockMatrix. Blocks may be sparse or dense depending on the sparsity of the rows.- 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
 
- 
toCoordinateMatrixConverts this matrix to aCoordinateMatrix.- Returns:
- (undocumented)
 
- 
toRowMatrixDrops row indices and converts this matrix to aRowMatrix.- Returns:
- (undocumented)
 
 
-