Computes the reduced ("economy") singular value decomposition of a
matrix operand of shape (m, n):
$$A = u \, \mathrm{diag}(d) \, vt,$$
where u has orthonormal columns, vt has orthonormal rows, and d
is the length-k (k = min(m, n)) vector of non-negative singular
values in descending order.
Note: unlike base::svd(), which returns the right singular vectors
as v of shape (n, k) (so that a = u %*% diag(d) %*% t(v)), this
primitive returns them already transposed as vt of shape (k, n)
(matching the underlying LAPACK / cuSOLVER output and avoiding an
extra transpose).
Supports any matrix shape on both the host (LAPACK gesdd) and CUDA
(cuSOLVER gesvd) backends. cuSOLVER's m >= n requirement is handled
transparently via a layout flip for wide matrices.
Arguments
- operand
(
arrayish)
Matrix of data type floating-point with exactly 2 dimensions.
Value
Named list with elements d (length k), u (shape
(m, k)), and vt (shape (k, n)). All have the same dtype as
the input.