lib/randsvd.rb
# Compute the randomized singular value decompostion
# using NMatrix::LAPACK.gesdd method.
#
# @param mat  [NMatrix] The m-by-n input matrix to be decomposed.
# @param k    [Integer] The number of singular values.
# @param t    [Integer] The number of iterations for orthogonalization.
# @param seed [Integer] The random seed used to generate the random matrix.
#
# @return [Array<NMatrix>]
#   Returns array containing the m-by-k matrix of left-singular vectors,
#   the k-by-1 matrix containing the singular values in decreasing order,
#   and the k-by-n transposed matrix of right-singular vectors.
Compute the randomized singular value decompostion
using NMatrix::LAPACK.gesdd method.
Compute the randomized singular value decompostion using NMatrix :: LAPACK . gesdd method .
def gesdd(mat, k, t = 0, seed = nil)
      seed ||= srand
      @seed = seed
      rsvd(mat, k, t, 1)
    end
def gesdd ( mat , k , t = 0 , seed = nil ) seed ||= srand @seed = seed rsvd ( mat , k , t , 1 ) end
Compute the randomized singular value decompostion
using NMatrix::LAPACK.gesdd method.
Compute the randomized singular value decompostion using NMatrix :: LAPACK . gesdd method .
Returns array containing the m-by-k matrix of left-singular vectors, the k-by-1 matrix containing the singular values in decreasing order, and the k-by-n transposed matrix of right-singular vectors.
Returns array containing the m - by - k matrix of left - singular vectors the k - by - 1 matrix containing the singular values in decreasing order and the k - by - n transposed matrix of right - singular vectors .
Array<NMatrix>
mat
The m-by-n input matrix to be decomposed.
The m - by - n input matrix to be decomposed .
k
The number of singular values.
The number of singular values .
t
The number of iterations for orthogonalization.
The number of iterations for orthogonalization .
seed
The random seed used to generate the random matrix.
The random seed used to generate the random matrix .