Computes the singular value decomposition.

linalg_svd(x, s, u = NULL, vt = NULL)

Arguments

x

Input data. The input values are overwritten.

s

Singular values.

u, vt

The left/right singular vectors. Should both be NULL or matrices of the same backend and fundamental type as x.

Details

You will need to initialize the return objects s and/or u and vt. manually. See the example.

Examples

suppressMessages(library(fmlr)) x = cpumat(3, 2) x$fill_linspace(1, 6) s = cpuvec() linalg_svd(x, s) s$info()
#> # cpuvec 2 type=d
s$print()
#> 9.5080 0.7729 #>