Module: Numo::Linalg
- Defined in:
- lib/numo/linalg/randsvd.rb
Overview
Numo::Linalg : Linear Algebra library with BLAS/LAPACK binding to Numo::NArray
Class Method Summary collapse
-
.randsvd(a, k, t = 0, driver: 'svd', job: 'A', seed: nil) ⇒ Object
Compute the randomized singular value decompostion.
Class Method Details
.randsvd(a, k, t = 0, driver: 'svd', job: 'A', seed: nil) ⇒ Object
Compute the randomized singular value decompostion.
20 21 22 23 24 25 26 27 |
# File 'lib/numo/linalg/randsvd.rb', line 20 def randsvd(a, k, t = 0, driver: 'svd', job: 'A', seed: nil) n = a.shape[1] q = _orthonormal_mat(a, [k + 10, n].min, t, seed) b = a.dot(q) s, u, vt = Numo::Linalg.svd(b, driver: driver, job: job) vtqt = vt.dot(q.transpose) _truncated_mat(s, u, vtqt, k) end |