hosvd {tensr} | R Documentation |
Calculate the (truncated) higher-order SVD (HOSVD).
Description
Calculates the left singular vectors of each matrix unfolding of an array, then calculates the core array. The resulting output is a Tucker decomposition.
Usage
hosvd(Y, r = NULL)
Arguments
Y |
An array of numerics. |
r |
A vector of integers. The rank of the truncated HOSVD. |
Details
If r
is equal to the rank of Y
, then Y
is equal to
atrans(S, U)
, up to numerical accuracy.
More details on the HOSVD can be found in De Lathauwer et. al. (2000).
Value
U
A list of matrices with orthonormal columns. Each matrix
contains the mode-specific singular vectors of its mode.
S
An all-orthogonal array. This is the core array from the HOSVD.
Author(s)
Peter Hoff.
References
De Lathauwer, L., De Moor, B., & Vandewalle, J. (2000). A multilinear singular value decomposition. SIAM journal on Matrix Analysis and Applications, 21(4), 1253-1278.
Examples
#Generate random data.
p <- c(2, 3, 4)
X <- array(stats::rnorm(prod(p)), dim = p)
#Calculate HOSVD.
hosvd_x <- hosvd(X)
S <- hosvd_x$S
U <- hosvd_x$U
#Recover X.
trim(X - atrans(S, U))
#S is all-orthogonal.
trim(mat(S, 1) %*% t(mat(S, 1)))
trim(mat(S, 2) %*% t(mat(S, 2)))
trim(mat(S, 3) %*% t(mat(S, 3)))