hosvd: Calculate the (truncated) higher-order SVD (HOSVD).

Description Usage Arguments Details Value Author(s) References Examples

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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)))

Example output

, , 1

     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0

, , 2

     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0

, , 3

     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0

, , 4

     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0

         [,1]     [,2]
[1,] 12.50138 0.000000
[2,]  0.00000 7.510044
         [,1]     [,2]     [,3]
[1,] 9.400672 0.000000 0.000000
[2,] 0.000000 6.730014 0.000000
[3,] 0.000000 0.000000 3.880738
         [,1]     [,2]     [,3]    [,4]
[1,] 9.769635 0.000000 0.000000 0.00000
[2,] 0.000000 5.538185 0.000000 0.00000
[3,] 0.000000 0.000000 3.078894 0.00000
[4,] 0.000000 0.000000 0.000000 1.62471

tensr documentation built on May 2, 2019, 2:32 p.m.