View source: R/tensor_decompositions.R
hosvd | R Documentation |
Calculates the left singular vectors of each matrix unfolding of an array, then calculates the core array. The resulting output is a Tucker decomposition.
hosvd(Y, r = NULL)
Y |
An array of numerics. |
r |
A vector of integers. The rank of the truncated HOSVD. |
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).
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.
Peter Hoff.
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.
#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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.