Implementation of svds for a sparse matrix.
Implementation of svds for a sparse matrix. The caller provides two operations: mul - matrix multiplies a DenseVector, and trans - matrix transpose.
Type of the input matrix of size n*m.
Type of the transpose of input matrix of size m*n.
Operation that multiples a matrix with a DenseVector. Example:
implicit object Op_Mul_Mat_V extends OpMulMatrixDenseVector[UserMatrixType] { def apply(mt: UserMatrixType, iv: DenseVector[Double]) = { // return another DenseVector[Double] = mt * iv } }
Operator for transposing the matrix. Example:
implicit object Op_Mat_Trans extends CanTranspose[UserMatrixType, UserMatrixTypeTranspose] { def apply(mt: UserMatrixType) = { // return a UserMatrixTypeTranspose which is the transpose of mt } }
Operation that multiples a transposed matrix with a DenseVector. Example:
// if UserMatrixType and UserMatrixTypeTranspose are actually the same type, you do not need this implicit object Op_Mul_Mat_V extends OpMulMatrixDenseVector[UserMatrixTypeTranspose] { def apply(mtTrans: UserMatrixTypeTranspose, iv: DenseVector[Double]) = { // return another DenseVector[Double] = mtTrans * iv } }
Left singular vectors matrix of size n*k, singular value vector of length k, and transpose of right singular vectors matrix of size k*m.
Computes the SVD of a m by n matrix Returns an m*m matrix U, a vector of singular values, and a n*n matrix V'