26
Multilinear algebra and different tensor formats with applications A. Litvinenko, , 12. Juni 2013 C C SC Scientifi omputing

Multi-linear algebra and different tensor formats with applications

Embed Size (px)

Citation preview

Page 1: Multi-linear algebra and different tensor formats with applications

Multilinear algebra and different tensorformats with applications

A. Litvinenko, [email protected], 12. Juni 2013

CC

SCScien

tifiomputing

Page 2: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Outline

MotivationNumerical Experiments

Examples

Definitions of different tensor formats

Applications

Kriging: Numerics

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 2

Page 3: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Used Literature and Slides

Book of W. Hackbusch 2012,

Dissertations of I. Oseledets and M. Espig

Articles of Tyrtyshnikov et al., De Lathauwer et al., L. Grasedyck,B. Khoromskij, M. Espig

Lecture courses and presentations of Boris and VeneraKhoromskij

Software T. Kolda, M. Espig et al.; D. Kressner, K. Tobler; I.Oseledets et al.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 3

Page 4: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: NumericsNumerical Experiments

Challenges of numerical computations

modelling of multi-particle interactions in large molecularsystems such as proteins, biomolecules,

modelling of large atomic (metallic) clusters,

stochastic and parametric equations,

machine learning, data mining and information technologies,

multidimensional dynamical systems,

data compression

financial mathematics,

analysis of multi-dimensional data.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 4

Page 5: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: NumericsNumerical Experiments

Example: Final discretized stochastic PDE

Au = f, where

A:=(∑s

l=1 Al ⊗⊗Mµ=1 ∆lµ

), Al ∈ RN×N , ∆lµ ∈ RRµ×Rµ ,

u:=(∑r

j=1 uj ⊗⊗Mµ=1 ujµ

), uj ∈ RN , ujµ ∈ RRµ ,

f:=∑R

k=1 f k ⊗⊗Mµ=1 gkµ, f k ∈ RN and gkµ ∈ RRµ .

And then solve iteratively with a tensor preconditioner [PhD of E.Zander, 2012]

[Wähnert, Espig, Hackbusch, Litvinenko, Matthies 05.2012]

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 5

Page 6: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: NumericsNumerical Experiments

Numerical example

2D L-shape domain, N = 557.Total stoch. dim. Mu = Mk + Mf = 20, |J| = 231Solve linear system above, obtain solution in a tensor format:u =

∑231j=1⊗21µ=1 ujµ ∈ R557 ⊗

⊗20µ=1 R3.

Tensor u has 320 ∗ 557 ≈ 2 · 1012 entries. Memory cost 16 TB.

Want to compute maximum element of u

Want to compute all elements of u from e.g. the interval[0.2,0.4] (did in 10 minutes).

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 6

Page 7: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Tensor of order 2

Let M := UΣV T ≈ UΣV T = Mk .(Truncated Singular Value Decomposition).Denote A := UΣ and B := V , then Mk = ABT .Storage of A and BT is k(n + m) in contrast to nm for M.

U VΣ∼ ∼ ∼ T=M

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 7

Page 8: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Example: Arithmetic operations

Let v ∈ Rn.Suppose Mk = ABT ∈ Rn×Z , A ∈ Rn×k , B ∈ RZ×k is given.Property 1: Mkv = ABT v = (A(BT v)). Cost O(kZ + kn).

Suppose M′= CDT , C ∈ Rn×k and D ∈ RZ×k .

Property 2: Mk + M′= AnewBT

new, Anew := [A C] ∈ Rn×2k andBnew = [B D] ∈ RZ×2k .

Cost O((n + Z )k2 + k3).

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 8

Page 9: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Aims

1. Represent/approximate multidimensional operators andfunctions in data sparse format

2. Perform linear algebra algorithms in tensor format

3. Truncate tensors to data-sparse format

4. Extract information from data-sparse solution

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 9

Page 10: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Definition of tensor of order d

Tensor of order d is a multidimensional array over a d-tuple indexset I = I1 × · · · × Id ,

A = [ai1...id : i` ∈ I`] ∈ RI, I` = {1, ...,n`}, ` = 1, ..,d .

A tensor A is an element of the linear space

Vn =

d⊗`=1

V`, V` = RI`

equipped with the Euclidean scalar product 〈·, ·〉 : Vn × Vn → R,defined as

〈A,B〉 :=∑

(i1...id)∈I

ai1...id bi1...id , for A, B ∈ Vn.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 10

Page 11: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Rank-k representation

Tensor product of vectors u(`) = {u(`)i`

}ni`=1 ∈ RI` forms thecanonical rank-1 tensor

A(1) ≡ [ui]i∈I = u(1) ⊗ ...⊗ u(d),

with entries ui = u(1)i1⊗ ...⊗ u(d)

id. The storage is dn in contrast to nd .

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 11

Page 12: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Tensor formats: CP, Tucker, TT

A(i1, i2, i3) ≈r∑α=1

u1(i1,α)u2(i2,α)u3(i3,α)

A(i1, i2, i3) ≈∑

α1,α2,α3

c(α1,α2,α3)u1(i1,α1)u2(i2,α2)u3(i3,α3)

A(i1, ..., id) ≈∑

α1,...,αd−1

G1(i1,α1)G2(α1, i2,α2)...Gd−1(αd−1, id)

Discrete: Gk(ik) is a rk−1 × rk matrix, r1 = rd = 1.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 12

Page 13: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Canonical and Tucker tensor formats

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 13

Page 14: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Tensor and Matrices

Tensor (A`)`∈I ∈ RI

where I = I1 × I2 × ...× Id , #Iµ = nµ, #I =∏dµ=1 nµ.

Rank-1 tensor

A = u1 ⊗ u2 ⊗ ...⊗ ud =:

d⊗µ=1

Ai1,...,id = (u1)i1 · ... · (ud)id

Rank-1 tensor A = u⊗ v , matrix A = uvT , A = vuT , u ∈ Rn, v ∈ Rm,Rank-k tensor A =

∑ki=1 ui ⊗ vi , matrix A =

∑ki=1 uivT

i .Kronecker product A⊗ B ∈ Rnm×nm is a block matrix whose ij-thblock is [AijB].

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 14

Page 15: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Two Examples of Tensor Train format

f (x1, ..., xd) = w1(x1) + w2(x2) + ...+ wd(xd)

= (w1(x1),1)(

1 0w2(x2) 1

)...

(1 0

wd−1(xd−1) 1

)(1

wd(xd)

)f = sin(x1 + x2 + ...+ xd)

= (sinx1, cosx1)

(cosx2 −sinx2

sinx2 cosx2

)...

(cosxd−1 −sinxd−1

sinxd−1 cosxd−1

)(cosxd

sinxd−1

)

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 15

Page 16: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

r-Terms, Tensor Rank, Canonical Tensor Format

The set Rr of tensors which can be represented in T with r-terms isdefined as

Rr (T) := Rr :=

r∑

i=1

d⊗µ=1

viµ ∈ T : viµ ∈ Rnµ

. (1)

Let v ∈ T. The tensor rank of v in T is

rank(v) := min {r ∈ N0 : v ∈ Rr } . (2)

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 16

Page 17: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Definitions of CP

The canonical tensor format is defined by the mapping

Ucp :d

×µ=1

Rnµ×r → Rr , (3)

v := (viµ : 1 6 i 6 r , 1 6 µ 6 d) 7→ Ucp(v) :=r∑

i=1

d⊗µ=1

viµ.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 17

Page 18: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Properties of CP

Lemma

Let r1, r2 ∈ N, u ∈ Rr1 and v ∈ Rr2 . We have

(i) 〈u, v〉T =∑r1

j1=1

∑r2j2=1

∏dµ=1

⟨uj1µ, vj2µ

⟩Rnµ . The computational

cost of 〈u, v〉T is O(

r1r2∑dµ=1 nµ

).

(ii) u + v ∈ Rr1+r2 .

(iii) u � v ∈ Rr1r2 , where � denotes the point wise Hadamardproduct. Further, u � v can be computed in the canonical tensorformat with r1r2

∑dµ=1 nµ arithmetic operations.

Let R1 = A1BT1 , R2 = A2BT

2 be rank-k matrices, thenR1 + R2 = [A1A2][B1B2]

T be rank-2k matrix. Rank truncation!

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 18

Page 19: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Properties of CP, Hadamard product and FT

Let u =∑k

j=1⊗d

i=1 uji , uji ∈ Rn.

F[d] (u) =k∑

j=1

d⊗i=1

(Fi(uji))

, where F[d] =

d⊗i=1

Fi . (4)

Let S = ABT =∑k1

i=0 aibTi ∈ Rn×m, T = CDT =

∑k2j=0 cidT

i ∈ Rn×m

where ai , ci ∈ Rn, bi , di ∈ Rm, k1, k2,n,m > 0. Then

F(2)(S ◦ T ) =

k1∑i=0

k2∑j=0

F(ai ◦ cj)F(bTi ◦ dT

j ).

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 19

Page 20: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Tucker Tensor Format

A =

k1∑i1=1

...

kd∑id=1

ci1,...,id · u1i1 ⊗ ...⊗ ud

id(5)

Core tensor c ∈ Rk1×...×kd , rank (k1, ..., kd ).Nonlinear fixed rank approximation problem:

X = argmin minX rank(k1,...,kd)‖A − X‖ (6)

Problem is well-posed but not solvedThere are many local minimaHOSVD (Lathauwer et al.) yields rank(k1, ..., kd)Y : ‖A − Y‖ 6

√d‖A − X‖

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 20

Page 21: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Advantages and disadvantages

Denote k - rank, d-dimension, n = # dofs in 1D:

1. CP: ill-posed approx. alg-m, O(dnk), hard to compute approx.

2. Tucker: reliable arithmetic based on SVD, O(dnk + kd)

3. Hierarchical Tucker: based on SVD, storage O(dnk + dk3),truncation O(dnk2 + dk4)

4. TT: based on SVD, O(dnk2) or O(dnk3), stable

5. Quantics-TT: O(nd)→ O(d logn)

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 21

Page 22: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Numerics

Domain: 20m × 20m × 20m, 25,000× 25,000× 25,000 dofs.4,000 measurements randomly distributed within the volume, withincreasing data density towards the lower left back corner of thedomain.The covariance model is anisotropic Gaussian with unit varianceand with 32 correlation lengths fitting into the domain in thehorizontal directions, and 64 correlation lengths fitting into thevertical direction.

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 22

Page 23: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Kriging: Numerics

The top left figure shows the entire domain at a sampling rate of 1:64 perdirection, and then a series of zooms into the respective lower left backcorner with zoom factors (sampling rates) of 4 (1:16), 16 (1:4), 64 (1:1) forthe top right, bottom left and bottom right plots, respectively. Color scale:showing the 95% confidence interval [µ− 2σ,µ+ 2σ].

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 23

Page 24: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Numerics on computer with 16GB RAM:

2D Kriging with 270 million estimation points and 100measurement values (0.25 sec.),

to compute the estimation variance (< 1 sec.),

to evaluate the spatial average of the estimation variance (theA-criterion of geostat. optimal design) for 2 · 1012 estim. points(30 sec.),

to compute the C-criterion of geostat. optimal design for 2 · 1015

estim. points (30 sec.),

solve 3D Kriging problem with 15 · 1012 estim. points and 4000measurement data values (20 sec.)

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 24

Page 25: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Conclusion

Today we discussed:

Why do we need tensors

How to compute a tensor decomposition

How to do arithmetics in a given tensor format

Computational costs and memory requirements

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 25

Page 26: Multi-linear algebra and different tensor formats with applications

Motivation Examples Definitions of different tensor formats Applications Kriging: Numerics

Tensor Software

D.Kressner, C. Tobler, Hierarchical Tucker Toolbox (Matlab),http://www.sam.math.ethz.ch/NLAgroup/htucker_toolbox.html

M. Espig, et alTensor Calculus library (C): http://gitorious.org/tensorcalculus

CC

SCScien

tifiomputing

Multilinear algebra and different tensor formats with applications Seite 26