multi-dimensional pdes 15 lectures on tensor numerical ... 6.pdf · institute of natural sciences,...

15
15 Lectures on Tensor Numerical Methods for Multi-dimensional PDEs Lect. 6. Tucker tensor decomposition algorithm. Canonical-to-Tucker decomposition. Tensor operations Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in the Sciences, Leipzig, Germany Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University Tensor numerical methods 6 1 / 30 Outline of the lecture 1 Why Tucker was important Tucker tensor format Higher order singular value decomposition Tucker decomposition algorithm Tucker decomposition algorithm in Matlab Functional Tucker Canonical to Tucker tensor approximation Multigrid Tucker decomposition Multigrid Tucker for canonical tensors Basic tensor operations Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University Tensor numerical methods 6 2 / 30

Upload: others

Post on 12-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

15 Lectures on Tensor Numerical Methods forMulti-dimensional PDEs

Lect. 6. Tucker tensor decomposition algorithm. Canonical-to-Tucker decomposition.

Tensor operations

Boris N. Khoromskij and Venera KhoromskaiaInstitute of Natural Sciences, Shanghai Jiaotong University

April 2017

Max-Planck-Institute for Mathematics in the Sciences, Leipzig, Germany

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 1 / 30

Outline of the lecture

1 Why Tucker was important

Tucker tensor format

Higher order singular value decomposition

Tucker decomposition algorithm

Tucker decomposition algorithm in Matlab

Functional Tucker

Canonical to Tucker tensor approximation

Multigrid Tucker decomposition

Multigrid Tucker for canonical tensors

Basic tensor operations

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 2 / 30

Page 2: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Canonical tensor format

Rank-structured tensor formats:1. The R-term canonical format is defined as

A =∑R

k=1cku

(1)k ⊗ . . .⊗ u

(d)k , ck ∈ R

where u(`)k ∈ Rn` are normalized vectors. Storage: dRn << nd .

Analogue: a separable function f (x1, x2, . . . , xd ) =R∑

k=1f1,k (x1)f2,k (x2) . . . fd,k (x2).

Alternative (contracted product) notation:

A = C×1U(1)×2U

(2)×3U(3), C = diag{c1, ..., cd} ∈ RR⊗d

, U(`) = [u(`)1 . . . u

(`)R ] ∈ Rn`×R .

R

(3)

1

(2)2

(1)1

(3)R

(2)R

(1)

R

.

.

b

c1

u

u

u u

u

u

c+ . . . +A

n3

n1

n2

There are no stable algorithms for computation of the nearly optimal rank-R approximation of a

full size tensor (it is an ill-posed problem).

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 3 / 30

Tucker tensor format

2. Given the rank parameter r = (r1, . . . , rd ) we define a tensor in the Tucker format [Tucker, 1966]

A(r) =∑r1

k1=1. . .∑rd

kd=1βk1,...,kd v

(1)k1⊗ . . .⊗ v

(d)kd, (1)

with orthonormal v(`)k`∈ Rn` (1 ≤ k` ≤ r`), and core tensor β = [βk1,...,kd ] ∈ Rr1×...×rd .

Alternative notation: using side matrices V (`) = [v(`)1 . . . v

(`)r` ] and contracted products

A(r) = β ×1 V (1) ×2 V (2) ×3 . . .×d V (d).r3

3

2

r

1

r

r

r1

B

1

32

r2

A

V

(1)

V(2)

V

(3)

n

n

n

n1

n3

n2

Storage: rd + drn� nd .

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 4 / 30

Page 3: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Mixed Tucker-canonical (TC) tensor format

A(r) =

(R∑

k=1

bku(1)k ⊗ . . .⊗ u

(d)k

)×1 V (1) ×2 V (2) ×3 . . .×d V (d).

A

r3

I3

I2

r2

(3)

(2)

I1

I

I

I

2

3

1r2

r3

r1

+ . . . +

1

(3) (3)

r

1

1(2)

(1)r2

r3

r1

+ d r nr1 rdnd

(1)

u

u

u u

b1 b

R (2)r

u

u(1)r

2R < = r

V

V

β β

Advantages of the Tucker tensor decomposition:

1. Robust algorithm for approximating full format tensors of size nd .2. Rank reduction of the rank-R canonical tensors with large R.

3. Efficient for 3D tensors since r3 is small.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 5 / 30

Tensor unfolding

The unfolding of a tensor along mode ` is a matrix

A(`) = [aij ] ∈ Rn`×(n`+1···ndn1···n`−1)

whose columns are the respective fibers along `-mode.

I

I

I2

3

1

I3A

I2

A(1)I1

Matlab commands: B= reshape(A,n1,n2*n3);

Or permute(A,[3,2,1]); B3= reshape(A,n3,n1*n2);

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 6 / 30

Page 4: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Contracted product of tensors

n3

n1

n2

r3

n2

n1

n3

3

A

A3

r3

3M

r3

n2

n1

n2

2

r2

r3

n1

A3 A

2

r2

2M

r2

r3

r1

A1

r2

n1

A 2

n1

1

r3

r1

1M

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 7 / 30

Tucker tensor approximation

Multilinear algebra for the problems of chemometrics, psychometrics, data processing, etc.[Tucker ’66, De Lathauwer et al, 2000]

A0 ∈ Vn : f (A) := ‖A(r) − A0‖2 → min over A ∈ T r. (2)

The minimisation problem is equivalent to the maximisation problem

g(V (1), ...,V (d)) :=∥∥∥A0 ×1 V (1)T × ...×d V (d)T

∥∥∥2→ max (3)

over the set of orthogonal matrices V (`) ∈ Rn`×r` .

For given maximizer V (`), the core β that minimises (2) is

β = A0 ×1 V (1)T ×2 . . .×d V (d)T ∈ Rr1×...×rd , A(r) = β ×1 V (1) ×2 . . .×d V (d). (4)

Algorithm BTA (Vn → T r,n). Complexity for full format tensors for d = 3:WF→T = O(n4 + n3r + n2r2 + nr3).

For function related tensors, [B. Khoromskij 2006]:

‖A(r) − A0‖ ≤ Ce−αr , with r = max`

r`.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 8 / 30

Page 5: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Full format tensor to Tucker

Theorem 1. (dth order SVD, higher order SVD (HOSVD), [De Lathauwer et al,

2000]).Every real n1 × n2 × ...× nd -tensor A can be written as the product

A = S×1 U(1) ×2 U

(2)...×d U(d),

1. U(`) = [bfu(`)1 bfu

(`)2 ...bfu(`)

n` ], U(`)TU(`) = In`×n` ,2. Subtensors of S, Si`=α, for fixed `th index, have the properties of(i) all-orthogonality: 〈Si`=α,Si`=β〉 = 0 when α 6= β,(ii) ordering: ‖Si`=1‖ ≥ ‖Si`=2‖ ≥ ... ≥ ‖Si`=n`‖ ≥ 0 for all positive values of `.

The Frobenius norms ‖Si`=i‖, σ(`)i , are `-mode singular values of A(`) and the

vector bfu(`)i is an ith `-mode left singular vector of A(`).

n

n

n

r

rr

3

32 2

1

1

i

i

1

1= α

= βS

S

U(2)

U(3)

U(1)

U U(l) (l)

T= I n n

l lx

r1

r2

r3

S

β

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 9 / 30

Truncated HOSVD

Theorem 2.(Approximation by HOSVD,[De Lathauwer et al, 2000] ).Let the HOSVD of A be given as in Theorem 1 and let the `-mode rank of A,rank(A(`)), be equal to R` (` = 1, ..., d).

Define a tensor A by discarding the smallest `-mode singular values

σ(`)r`+1, σ

(`)r`+2, ..., σ

(`)R`

for given values of r` (` = 1, ..., d), i.e., set the correspondingparts of S equal to zero. Then we have

‖A− A‖2 ≤R1∑

i1=r1+1

σ(1)i1

2+

R2∑i2=r2+1

σ(2)i2

2+ · · ·+

Rd∑id=rd+1

σ(d)id

2.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 10 / 30

Page 6: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Full-size tensor to Tucker

Algorithm ALS Tucker (Vn → T r,n). Given the input tensor A ∈ Vn.

1 Compute an initial guess V(`)0 (` = 1, ..., d) for the `-mode side-matrices by

truncated SVD applied to matrix unfolding A(`) (cost O(nd+1)).2 For k = 1 : kmax do: for each q = 1, ..., d , and with fixed side-matrices

V (`) ∈ Rn×r` , ` 6= q, optimise the side matrix V (q) via computing thedominating rq-dimensional subspace (truncated SVD) for the respectivematrix unfolding B(q) ∈ Rn×rq , rq = r1...rq−1rq+1...rd , corresponding to theq-mode contracted product

B(q) = A×1 V(1)T × ...×q−1 V

(q−1)T ×q+1 V(q+1)T ...×d V (d)T .

Each iteration costs O(drd−1nmin{rd−1, n}), since rq = O(rd−1).3 Compute the core β as the representation coefficients of the orthogonal

projection of A onto Tn = ⊗d`=1T` with T` = span{vk

` }r`k=1,

β = A×1 V(1)T × ...×d V (d)T ∈ Rr1×···×rd ,

at the cost O(rdn).

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 11 / 30

Full-size tensor to Tucker

First step in the Tucker decomposition algorithm :1. Matrix unfoldings of a tensor and calculation of the initial guess for Tuckerside-matrices,

SVD

SVD

SVD

V

V

V

r

r

r

n

n

n

n

n . n

n

n

3

n n.

1

n1

2

1

3

n . n2 3

n 2

n3

2 1

2

3

1

1

2

3

(2)

(3)

(1)

B

B

B [1]

[2]

[3]

Matlab commands: B= reshape(A,n1,n2*n3);Or permute(A,[3,2,1]); B3= reshape(A,n3,n1*n2);

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 12 / 30

Page 7: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

“Single-hole” tensor

Second step in the Tucker decomposition algorithm for full size tensors:2. Compute “single-hole” tensors for ALS by using contracted product of the initial 3D full-sizetensor and orthogonal matrices V (`), ` = 1, 2, 3 for all dimensions except one.

n3

n1

n2

r3

n2

n1

n3

3

A

A3

r3

3M

r3

n2

n1

n2

2

r2

r3

n1

A3 A

2

r2

2M

n1 n

1n1

B[1]

r3

r2

...

r3

r2

r1

.

Update V (`) by SVD of unfolding matrix of the “single hole tensor”.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 13 / 30

Tucker in matlab

clear; nstep=12; b=10.0;

T_error=zeros(1,nstep); nd=3; kmax =3; gam=1; R=5.0;

n= 32; b2=b/2; Hunif = b/n;

xcol=-b2:Hunif:b2; [~,n1]=size(xcol); disp(n1); n2= n1; n3= n1;

A3=zeros(n1,n2,n3); A3F=zeros(n1,n2,n3); ycol=xcol; zcol=xcol;

for i=1:n1

for j=1:n2

for k=1:n3

A3(i,j,k)=EXP_GAM_1204(xcol(1,i),ycol(1,j),zcol(1,k),R,gam);

end

end

end

for ir=1:nstep

NR=[ir ir ir]; disp(ir);

[U1,U2,U3,LAM3F] = Tucker_full_3D(A3,NR,kmax);

A3F=Tuck_2_F(LAM3F,U1,U2,U3);

err=Tnorm(A3F - A3)/Tnorm(A3); disp(err);

T_error(1,ir)=abs(err);

end

figure(1); semilogy(T_error);

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 14 / 30

Page 8: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Tucker in matlab

function [U1,U2,U3,LAM3F] = Tucker_full_3D(A3,NR,kmax)

[n1 n2 n3]=size(A3);

R1=NR(1); R2=NR(2); R3=NR(3); nd=3;

%_______________ Fase I - Initial Guess __________________________

D= permute(A3,[1,3,2]); B1= reshape(D,n1,n2*n3);

[Us, ~, Vs]= svd(double(B1),0); U1=Us(:,1:R1);

D= permute(A3,[2,1,3]); B2= reshape(D,n2,n1*n3);

[Us, ~, Vs]= svd(double(B2),0); U2=Us(:,1:R2);

D= permute(A3,[3,2,1]); B3= reshape(D,n3,n1*n2);

[Us, ~, Vs]= svd(double(B3),0); U3=Us(:,1:R3);

%_______________ Fase II - ALS Iteration ___________________________

for k1=1:kmax

Y1= B1*kron(U2,U3); C1=reshape(Y1,n1,R2*R3);

[W, S1, V] = svd(double(C1), 0); U1= W(:,1:R1);

Y2= B2*kron(U3,U1); C2=reshape(Y2,n2,R1*R3);

[W, S1, V] = svd(double(C2), 0); U2= W(:,1:R2);

Y3= B3*kron(U1,U2); C3=reshape(Y3,n3,R2*R1);

[W, S1, V] = svd(double(C3), 0); U3= W(:,1:R3);

end

Y1= B1*kron(U2,U3); LAM3 = U1’*Y1 ; LLL=reshape(LAM3,R1,R3,R2);

LAM3F=permute(LLL,[1,3,2]);

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 15 / 30

Functional Tucker approximation [B.N. Khoromskij, V. Khoromskaia ’07]

f (x(1), x(2), x(3)) ∈ R3 is discretized in [a, b]3. Sampling points:

x(`)i`

= a` + (i` − 12

)( b−an`

), i` = 1, 2, . . . n`.

⇒ We generate a tensor A ∈ Rn1×n2×n3 with entries aijk = f (x(1)i , x

(2)j , x

(3)k ).

Example: Slater function g(x) = exp(−α‖x‖) with x = (x(1), x(2), x(3))T ∈ R3

EFN =‖A0−A(r)‖||A0||

EFE =‖A0‖−‖A(r)‖||A0||

, EC :=maxi∈I |a0,i−ar,i |

maxi∈I |a0,i |.

xi

xj

xk

0

aijk

n

n1

3

n2

A

b

b

b(2)

(1)X(1)

X(3)

(2)

X

(3)

2 4 6 8 10 12 14

10−10

10−5

100

Tucker rank

err

or

Slater function, AR=10, n = 64

EFN

EFE

EC

0

5

10

0

5

10

0

0.2

0.4

0.6

0.8

1

0 2 4 6 8 10

−0.5

−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

Orthogonal vectors, r=6

y−axisBoris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 16 / 30

Page 9: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Multigrid Tucker approximation

[B.N. Khoromskij, ’06],[B.N. Khoromskij, V. Khoromskaia ’07]

Slater function f (x) = e−α‖x‖), EFN =‖A0−A(r)‖||A0||

5

0

Slater

-5-5

0

1

0.8

0.6

0.4

0.2

0

5

Tucker rank

2 4 6 8 10

err

or

10-8

10-6

10-4

10-2

100

n=65

n=129

n=257

1.3e+00 1.7e-01

1.3e-02 7.5e-04

Slater

Slater potential f = e−α√

x2+y2, α = 5. Decay of Tucker approximation error EFN . Decay of

entries of the Tucker core β.

x(1)

-axis

-5 0 5-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6Orthogonal vectors, r=6

x(2)

-axis

-5 0 5-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6Orthogonal vectors, r=6

x(3)

-axis

-5 0 5-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6Orthogonal vectors, r=6

Vectors of orthogonal side matrices of the Tucker decomposition of the tensor corresponding to

Slater functionBoris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 17 / 30

Tucker for 3D periodic structures

[B.N. Khoromskij, V. Khoromskaia ’07],[V. Khoromskaia ’10]

5

bohr

0

-5-5

0

bohr

1.5

1

0.5

0

5

Tucker rank

2 4 6 8 10

err

or

10-10

10-8

10-6

10-4

10-2

100

n=65

n=129

n=257

8× 8× 8 Slater.The “multi-centered Slater potential“ obtained by displacing a single Slater potential withrespect to the m ×m ×m spatial grid of size H > 0, (here m = 10)

g(x) =m∑i=1

m∑j=1

m∑k=1

e−α√

(x1−iH)2+(x2−jH)2+(x3−kH)2.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 18 / 30

Page 10: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Other examples

g(x) =e−‖x‖

‖x‖g(x) =

cos ‖x‖‖x‖

x = (x1, x2, x3) ∈ R3

2 4 6 8 10 12

10−10

10−5

100

Tucker rank

err

or

Yukawa potential, b=10, n = 64

EFN

EFE

EC

2 4 6 8 10 12

10−8

10−6

10−4

10−2

100

Tucker rank

err

or

Helmholz potential, b=6.2832, n = 64

EFN

EFE

EC

0 10 20 30 40 50 60−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6Orthogonal vectors, r=6

Yukawa , AR=10, n = 64

y−axis grid points0 10 20 30 40 50 60

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6Orthogonal vectors, r=6

Helmholz , AR=10, n = 64

x−axis grid points

[V. Khoromskaia, 2010]

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 19 / 30

Disadvantages of the standard Tucker algorithm

Disadvantages of the Tucker algorithm for full size tensors :

1 The standard Tucker algorithm is nontractable for large n!

2 Iif we have a canonical tensor with large R and n.

3 How to reduce the rank of a canonical tensor with large R and n ?

For example, if we want to represent this multidimensional function on fine gridand with much lower rank:

A separable function

f (x1, x2, . . . , xd) =R∑

k=1

f1,k(x1)f2,k(x2) . . . fd,k(x2).

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 20 / 30

Page 11: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Canonical to Tucker Approximation

Theorem [B.N. Khoromskij, V. Khoromskaia(SISC, 34 (2009))]

Let A ∈ CR,n. Then the minimisation problem

A ∈ CR,n ⊂ Vn : A(r) = argminV∈Tr,n ‖A− V ‖Vr , (5)

is equivalent to

[Z (1), ...,Z (d)] = argmaxV (`)∈M`

∥∥∥∥∥R∑ν=1

ξν

(V (1)T u(1)

ν

)⊗ ...⊗

(V (d)T u(d)

ν

)∥∥∥∥∥2

Vr

,

V (`) ∈ Rn`×r` – orthogonal.

Init. guess: RHOSVD Z(`)0 ⇒ the truncated SVD of side matrices

U(`) = [u(`)1 ...u

(`)R ], under the compatibility condition r` ≤ rank(U(`))

Error bounds for RHOSVD

‖A− A0(r)‖ ≤ ‖ξ‖

d∑`=1

(

min(n,R)∑k=r`+1

σ2`,k)1/2, where ‖ξ‖2 =

R∑ν=1

ξ2ν .

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 21 / 30

Canonical-to-Tucker approximation

[B.N. Khoromskij, V. Khoromskaia’07],[B.N. Khoromskij, V. Khoromskaia’08 ]Canonical-to-Tucker (3D). Given a tensor in the canonical format,

A = C×1 U(1) ×2 U(2) . . .×d U(d), C ∈ RR×...×R , U(`) = [u(`)1 . . . u

(`)R ] ∈ Rn`×R .

Main point: RHOSVD of side matrices: U(`) ≈ Z(`)r Σ

(`)r W

(`)r , where U

(`)r ∈ Rn`×r , r � R.

r

n

Rr

1

1 1

r1

+ ... +

n1

n nn

1 11

n

n3

2 2r r

2

r33

r3

3r

r2

B(q)

+ ... +

n3

n2

n1

u u

u u

u u

(1) (1)

(2) (2)

(3)(3)

1

1

1

R

R

R

R

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 22 / 30

Page 12: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Application of the C2T decomposition

Canonical-to-Tucker decomposition (3D) [B.N. Khoromskij, V.K. ’08]For d = 3 the non-contracted C2T tensor looks as:

r r

r

1 1

i

i

1

2n

n

1

i

n3

r

2

3

3

3

MPS (Matrix Product States) format was introduced by [White ’92],Tensor train [Oseledets, Tyrtyshnikov ’09] (for canonical function related tensors),

ai1...id =∑

αG

(1)α1 [i1]G

(2)α1α2 [i2] · · ·G (d)

αd−1[id ] ≡ G (1)[i1]G (2)[i2]...G (d)[id ], where G (`)[i`] ∈ Rr`−1×r` .

Example for d = 5:

.

r r

r r r

r

r1 1

2 3

3

4

4

i

i i

i

1

2 4

5

n

n n n

n

1

2 3 4

5

2r

3i

ai2

=1i

i3i4 i

5

ai1,i2,i3,i4,i5 =5∏

k=1

Bk (ik ), A ∈ Rn1×n2×n3×n4×n5 , Bk ∈ Rrk−1×rk , r0 = r5 = 1.

(See also hierarchical tensor format (HT) [Hackbusch, Kuehn 2009]).

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 23 / 30

Multigrid Tucker decomposition

In electronic structure calculations we need large n × n × n 3D Cartesian grids, and robust rankreduction for large R.

The conventional BTA algorithm (d = 3) ⇒ small n, moderate R:(a) For full format tensors

WF2T = O(nd+1) ⇒ WF2T = O(n4)

(b) for the canonical rank-R input tensors

WC2T = O(Rn min{R, n}+ rd−1n min{rd−1, n}),

⇒WC2T = O(nR2 + nr4).

⇒ SVD of side matrices of the sizes ≥ 104 × 104 is computationally unfeasible.

The answer to the problem:

Multigrid accelerated best Tucker approximation:

WF2T = O(n3), for full size tensors

WC2T = O(rRn), for canonical rank-R tensors.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 24 / 30

Page 13: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Multigrid Tucker decomposition

1 Sequence of nonlinear appr. problems for A = An ,n = nm := n02m,m = 0, 1, . . . ,M, on a sequence of refined grids ω3,nm .

2 Z(q)0 on grid ω3,nm → by linear interp. of Z (q) ∈ Rnm−1×rq from ω3,nm−1 .

3 The restricted ALS iteration, is based on “most important fibers” (MIFs) ofunfolding matrices.Positions of MIFs are extracted at the coarsest grid

β(q) = Z (q)TB(q) ∈ Rrq×rq . (6)

Location of MIFs corresponds to pr columns in β(q), p � r with maximalEuclidean norms (maximal energy principle).

4 Complexity for d = 3: O(RrnM + p2r2nM).(Linear w.r.t. n and R !)

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 25 / 30

MGA C2T (CR,n)[B.N. Khoromskij, V.Kh. (SISC, 34 (2009))]

B(q) → unfolding of (B[q]), β(q) = Z (q)TB(q); n0 = 64, nM = 16384

+ ... +

n1

n nn

1 11

n

n3

2

rr

r1

2r r

2

r33

r3

3r

r2 2

3+ ... +

n3

n2

n1

find MIFs

core

B[q]

[q]β

number 1

2 4 6 8 10 12 14

2

4

6

8

10

12

14

Number 2

2 4 6 8 10 12 14

2

4

6

8

10

12

14

Number 3

2 4 6 8 10 12 14

2

4

6

8

10

12

14

MIFs for H2O, p = 4.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 26 / 30

Page 14: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

C2T + T2C rank reduction

[B.N. Khoromskij, V. Khoromskaia ’09]Next step: Tucker-to-canonical transform.

A = β ×1 V (1) ×2 V (2) ×3 V (3)

where β ∈ Rr×r×r , V (`) ∈ Rn×r .

Represent the (small) core tensor in the canonical tensor format,

β = C×1 U(1) ×2 U(2) ×3 U(3), U(1) ∈ Rr×Rr ,

where Rr ≤ r2.Then

A =(C×1 U(1) ×2 U(2) ×3 U(3)

)×1 V (1) ×2 V (2) ×3 V (3)

which reduces toA = C×1 W (1) ×2 W (2) ×3 W (3), W (3) ∈ Rn×Rr

where W (`) = V (`)U(`).

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 27 / 30

Tensor operations

A1 = β ×1 U(1) ×2 U(2) . . .×d U(d), A2 = ζ ×1 V (1) ×2 V (2) . . .×d V (d), (7)

the scalar product is computed by

〈A1, A2〉 :=

r1∑k=1

r2∑m=1

βk1...kd ζm1...md

d∏`=1

⟨u

(`)k`, v

(`)m`

⟩. (8)

In fact, applying the definition of the scalar product to the rank-1 tensors (with R = r = 1), wehave

〈A1, A2〉 :=∑i∈I

u(1)i1· · · u(d)

idv

(1)i1· · · v (d)

id

=

n1∑i1=1

u(1)i1

v(1)i1· · ·

nd∑id=1

u(d)id

v(d)id

=d∏`=1

⟨u(`), v (`)

⟩. (9)

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 28 / 30

Page 15: Multi-dimensional PDEs 15 Lectures on Tensor Numerical ... 6.pdf · Institute of Natural Sciences, Shanghai Jiaotong University April 2017 Max-Planck-Institute for Mathematics in

Tensor operations

For given tensors A,B ∈ RI , the Hadamard product A� B ∈ RI of two tensors of the same sizeI is defined by the componentwise product,

(A� B)i = ai · bi, i ∈ I.

Hence, for A1,A2 ∈ T r, as in (7), we tensorize the Hadamard product by

A1 � A2 :=r∑

k1,m1=1

· · ·r∑

kd ,md=1

βk1...kd ζm1...md

(u

(1)k1� v

(1)m1

)⊗ ...⊗

(u

(d)kd� v

(d)md

). (10)

For the rank-1 tensors (with β = ζ = 1), we have

(A1 � A2)i =(u(1)i1

v(1)i1

) · · · (u(d)id

v(d)id

)

=(u(1) � v (1)

)⊗ · · · ⊗

(u(d) � v (d)

). (11)

Then (10) follows by summation over all rank-1 terms in A1 � A2. Relation (10) leads to thestorage requirements

Nst(A�B) = O(dr2n + r2d ),

that includes the memory size for d modes n× r × r Tucker vectors, and for the new Tucker core

of size (r2)d .

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 29 / 30

Tensor operations

For given A1,A2 ∈ T r, see (7), we now tensorize the convolution product via

A1 ∗ A2 :=r∑

k=1

r∑m=1

βk1...kd ζm1...md

(u

(1)k1∗ u(1)

m1

)⊗ ...⊗

(u

(d)kd∗ v (d)

md

). (12)

This relation again follows from the analysis for the case of rank-1 convolving tensors F and G ,similar to the discussion for scalar product of tensors,

(F ∗ G)j :=∑i∈I

f(1)i1· · · f (d)

idg

(1)j1−i1+1 · · · g

(d)jd−id+1

=

n1∑i1=1

f(1)i1

g(1)j1−i1+1 · · ·

nd∑id=1

f(d)id

g(d)jd−id+1 =

d∏`=1

(f (`) ∗ g (`)

)j`. (13)

Assuming that ”one-dimensional” convolutions of n-vectors, u(`)k`∗ v (`)

m`∈ R2n−1, can be

computed in O(n log n) operations, we arrive at the overall complexity estimate

N·∗· = O(dr2n log n + r2d ).

In our particular case of equidistant grids we obtain (by setting a = u(`)k`, b = v

(`)m`∈ Rn)

(u(`)k`∗ v (`)

m`)j =

n∑i=1

aibj−i+1, j = 1, ..., 2n − 1.

Hence, the 1D convolution can be performed by FFT in O(n log n) operations.

Boris N. Khoromskij and Venera Khoromskaia Institute of Natural Sciences, Shanghai Jiaotong University April 2017Tensor numerical methods 6 30 / 30