Skip to contents

A low rank matrix factorization of a matrix X is parameterized by X ~= u %*% diag(d) %*% t(v). The object is "svd-like" because the middle matrix in the decomposition must be strictly diagonal.

Usage

svd_like(u, d, v, subclasses = NULL, ...)

Arguments

u

A matrix "left singular-ish" vectors.

d

A vector of "singular-ish" values.

v

A matrix of "right singular-ish" vectors.

subclasses

A character vector of subclasses. Optional, defaults to NULL.

...

Optional additional items to pass to the constructor.

Examples


s <- svd(as.matrix(trees))

# using the constructor directly
svd_like(s$u, s$d, s$v)
#> Low Rank Matrix Factorization
#> -----------------------------
#> 
#> Rank: 3
#> Rows: 31
#> Cols: 3
#> d[rank]: 5.90691893513068
#> Components
#> 
#> u: 31 x 3 [matrix] 
#> d: 3      [numeric] 
#> v: 3 x 3 [matrix] 

# coercing svd-like lists
as_svd_like(s)
#> Low Rank Matrix Factorization
#> -----------------------------
#> 
#> Rank: 3
#> Rows: 31
#> Cols: 3
#> d[rank]: 5.90691893513068
#> Components
#> 
#> u: 31 x 3 [matrix] 
#> d: 3      [numeric] 
#> v: 3 x 3 [matrix]