hogsvd: Compute the Higher-order generalised singular value...

Description Usage Arguments Value Examples

Description

Compute the Higher-order generalised singular value decomposition (HOGSVD) of a list of matrices

Usage

1
hogsvd(D, method = "arma")

Arguments

D

a list of matrices to compute the GSVD decomposition on

method

specification of internal function to use to compute HOGSVD, 'arma' or 'rsimple'

Value

A list of U, Sigma and V. U and Sigma are lists of matrices

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Generate 3 matrices to run example on
N <- 3
nrow <- c(10,10,10)
ncol <- 10
s <- 1:N
D <- lapply(s, function(x) {matrix(rnorm(n=nrow[x]*ncol,mean = 0, sd =10),nrow[x],ncol)})

# Perform HO GSVD on the example
res <- hogsvd(D)

# Inspect result
str(res)

# The first U matrix corresponding to D[[1]]
res$U[[1]]

# The first S diagonal matrix correspoinding to D[[1]]
res$S[[1]]

# The shared V matrix
res$V

# Reconstruct the original matrices
D.reconstruct <- lapply(1:N, function(n) { 
   res$U[[n]] %*% diag(res$Sigma[[n]]) %*% t(res$V) 
})

# Now repeat with the slow algorithm
res.slow <- hogsvd(D, method = 'rsimple')
D.reconstruct.slow <- lapply(1:N, function(n) { 
  res.slow$U[[n]] %*% diag(res.slow$Sigma[[n]]) %*% t(res.slow$V) 
})

hogsvdR documentation built on May 2, 2019, 7:49 a.m.