Numerical Tensor Calculus Wolfgang HackbuschWolfgang Hackbusch Max-Planck-Institut f ur Mathematik in den Naturwissenschaften and University of Kiel Inselstr. 22-26, D-04103 Leipzig, Germany [email protected]http://www.mis.mpg.de/scicomp/hackbusch e.html Torino, September 12+14, 2018
87
Embed
Numerical Tensor Calculus - polito.it...1 Introduction: Tensors 1.1 Where do large-scale tensors appear? The tensor space V = V1 V2 Vdwith vector spaces Vj(1 j d) is de ned as (closure
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Numerical Tensor Calculus
Wolfgang HackbuschWolfgang Hackbusch
Max-Planck-Institut f�ur Mathematik in den Naturwissenschaften
Total number of grid points N =Qdj=1 nj; e.g., nd: Tensor space:
RN ' Rn1 Rn2 : : : Rnd:
Small discretisation errors require large dimensions nj:
Challenge: Huge dimensions like in ...
1) n = 1 000 000 and d = 3
2) n = 1000 and d = 1000 )
N = 10001000 = 103000:
1.1.3 Matrices or Operators
Let V = V1 V2 : : : Vd; W = W1 W2 : : :Wd be tensor spaces,
Aj : Vj !Wj linear mappings (1 � j � d):
The tensor product (Kronecker product)
A = A1 A2 : : :Ad : V!W
is the mapping
A : v(1) v(2) : : : v(d) 7! A1v(1) A2v
(2) : : :Adv(d):
If Aj 2 Rn�n then A 2 Rnd�nd:
Example: Poisson problem ��u = f in [0; 1]d, u = 0 on �.
The di�erential operator has the form
L =@2
@x21
I : : : I + : : :+ I : : : I @2
@x2d
:
Discretise by di�erence scheme with n grid points per direction.
The system matrix is
A = T1 I : : : I + : : :+ I : : : I Td:
Challenge: Approximate the inverse of A 2 RN�N ,
where n = d = 1000; so that
N = nd = 10001000 = 103000:
Later result: required storage: O(dn log2 1")
1.2 Tensor Operations
addition: v +w,
scalar product: hv;wi
matrix-vector multiplication:
dNj=1
A(j)
! dNj=1
v(j)
!=
dNj=1
A(j)v(j);
Hadamard product: (v �w) [i] = v[i]w[i]; pointwise product of functions0@ dOj=1
v(j)
1A�0@ dOj=1
w(j)
1A =dOj=1
v(j) � w(j);
convolution: v;w 2 Ndj=1Rn : u = v ?w with ui =
P0�k�i vi�kwk0@ dO
j=1
v(j)
1A ?0@ dOj=1
w(j)
1A =dOj=1
v(j) ? w(j):
1.3 High-Dimensional Problems in Practice
1) boundary value problems Lu = f in cubes or R3 ) d = 3; nj large
2) Hartree-Fock equations (as 1))
3) Schr�odinger equation (d = 3� number of electrons + antisymmetry)
4) bvp L(p)u = f with parameters p = (p1; : : : ; pm) ) d = m+ 1
5) bvp with stochastic coe�cients ) as 4) with m =1
6) coding of a d-variate function in Cartesian product ) d = d
7) ...
8) Lyapunov equation (A I + I A)x = b
2 Tensor Representations
How to represent tensors with nd entries by few data?
Classical formats:
� r-Term Format (Canonical Format)
� Tensor Subspace Format (Tucker Format)
More recent:
� Hierarchical Tensor Format
2.1 r-Term Format (Canonical Format)
By de�nition, any algebraic tensor v 2 V = V1 V2 : : : Vd has a
representation
v =rX
�=1
v(1)� v
(2)� : : : v
(d)� with v
(j)� 2 Vj
and suitable r. Set
Rr :=
8<:rX
�=1
v(1)� v
(2)� : : : v
(d)� : v
(j)� 2 Vj
9=;
Storage: rdn (for n = max dimVj):
If r is of moderate size, this format is advantageous.
Often, a tensor v is replaced by an approximation v" 2 Rr with r = r("):
rank(v) := minfr : v 2 Rrg; Rr := fv 2 V : rank(v) � rg :
Recall the matrix A discretising the Laplace equation:
A = T1 I : : : I + : : :+ I : : : I Td:
REMARK: A 2 Rd and rank(A) = d (tensor rank, not matrix rank).
Tj: tridiagonal matrices of size n� n:
Size of A: N �N with N = nd:
E.g., n = d = 1000 =) N = nd = 10001000 = 103000:
We aim at the inverse of A 2 RN�N .
Solution: A�1 � Br with Br of the form
Br =rXi=1
ai
dOj=1
exp(�biTj);
where ai; bi > 0 are explicitly known.
Proof. Approximate 1=x in [1;1) by exponential sums Er(x) =Pri=1 ai exp(�bix):
The best approximation satis�es 1
�� Er(�)
1;[1;1)� O(exp(�cr1=2)):
For a positive de�nite matrix with �(A) � [1;1); Er(A) approximates A�1
with Er(A)�A�1
2� O(exp(�cr1=2)):
In the case of A = T1 I : : : I + : : :+ I : : : I Td one obtains
Br := Er(A) =rXi=1
ai
dOj=1
exp(�biTj) 2 Rr:
Representation versus Decomposition
P := (�dj=1Vj)r parameter set.
Representation of a tensor:
' : P �! Rr � V:
Injectivity of ' not required, rank('(p)) � r:
Let rank(v) = r: Under certain conditions the representation of v = '(p) is
essentially unique. This allows the decomposition
'�1 : Rr �! P:
Operations with Tensors and Truncations
A =rX
�=1
dOj=1
A(j)� 2 Rr; v =
sX�=1
dOj=1
v(j)� 2 Rs
)
w := Av =rX
�=1
sX�=1
dOj=1
A(j)� v
(j)� 2 Rrs
Because of the increased representation rank rs, one must apply a truncation
w 7! w0 2 Rr0 with r0 < rs.
Unfortunately, truncation to lower rank is not straightforward in the r-term
format.
There are also other disadvantages of the r-term format ....
Numerical Di�culties because of Non-Closedness
In general, Rr is not closed. Example: a; b linearly independent and
v = a a b+ a b a+ b a a 2 R3nR2
v = (b+ na)�a+ 1
nb� a+ a a (b� na)| {z }
vn2R2
� 1nb b a:
Here, the terms of vn grow like O(n), while the result is of size O(1):This implies numerical cancellation: log2 n binary digits of vn are lost.We say that the sequence fvng is unstable.
Proposition: Suppose dim(Vj) <1 and v 2 V =Ndj=1 Vj.
A stable sequence vn 2 Rr with limvn = v exists if and only if v 2 Rr:
Conclusion: If v = limvn =2 Rr; the sequence vn 2 Rr is unstable.
Best approximation problem: Let v� 2 V: Try to �nd v 2 Rr with
kv� � vk = inffkv� �wk : w 2 Rrg:This optimisation problem need not be solvable.
De Silva{Lim (2008): Tensors without a best approximation have a positivemeasure (K = R).
2.2 Tensor Subspace Format (Tucker Format)
2.2.1 De�nition of Tr
Implementational description: Tr with r = (r1; : : : ; rd) contains all tensors of
the form
v =r1Xi1=1
� � �rdXid=1
a[i1; : : : ; id]dOj=1
b(j)ij
with some vectors fb(j)ij
: 1 � ij � rjg � Vj possibly with rj � nj and
a[i1; : : : ; id] 2 R:The core tensor a has
Qdj=1 rj entries.
Algebraic description:
Tensor space V = V1 V2 : : : Vd: Choose subspaces Uj � Vj and consider
the tensor subspace U =dNj=1
Uj: Then
Tr :=[
dim(Uj)�rj
dOj=1
Uj:
Short Notation
v =r1Xi1=1
� � �rdXid=1
a[i1; : : : ; id]dOj=1
b(j)ij:
De�ne matrices B(j) := [b(j)1 � � � b
(j)rj ] and B :=
Ndj=1B
(j):
Then
v = Ba
2.2.2 Matricisation and Tucker Ranks
Let V = Rn1 Rn2 : : : Rnd; �x j 2 f1; : : : ; dg; set n[j] :=Qk 6=j nk:
The j-th matricisation maps a tensor v 2 V into a matrix
into the orthonormal basisn(�!)�1=2 �` H�(�) : � 2 `0(N); ` 2 N
ohas the coe�cients
�`;� = (�!)�1=2ZD�`(x)E [�(x; �)H�(�)] dx
=ZD�`(x)m�(x)
Yk
���0k�1=2
k(x)��k
(�k!)�1=2 dx
� �0�
ZD�`(x)m�(x)dx
(�0�: Kronecker delta).
7.2 Discretisation
Spatial discretisation: subspace VN � H10(D) spanned by
f'1; : : : ; 'Ng:
Stochastic discretisation: subspace SJ � L2() spanned by
fH�(�) : � 2 Jg with #J <1; pk = maxf�k : � 2 Jg:
Galerkin discretisation:
a('i H�(�); 'j H�(�))
= ���
ZDm�(x)
Dr'i(x);r'j(x)
Edx
+1X`=1
�(�)` � E(H�(�)H�(�)H�(�)) �
ZD�`(x)
Dr'i(x);r'j(x)
Edx
Stochastic Galerkin matrix:
K :=�a('i H�; 'j H�)
�(i;�);(j;�)
= K0 �0 +X`
X�2J
�(�)` K`
KOk=1
��k 2 RN�N KOk=1
R(pk+1)�(pk+1)
with
K := maxfk : �k > 0 for some � 2 Jg;���k
��� := E(H�k(�k)H�(�k)H�(�k)); ��k 2 R
(pk+1)�(pk+1);
(K`)ij :=ZD�`(x)
Dr'i(x);r'j(x)
Edx; K` 2 RN�N ;
(K0)ij :=ZDm�(x)
Dr'i(x);r'j(x)
Edx; K0 2 RN�N :
The size of the stochastic Galerkin matrix is0@N � KYk=1
(pk + 1)
1A�0@N � KY
k=1
(pk + 1)
1A :
Truncation of ` 2 N in
K = K0 �0 +X`2N
X�2J
�(�)` K`
KOk=1
��k
to ` 2 f1; : : : ;Mg yields a �nite expression
K � L := K0 �0 +MX`=1
X�2J
�(�)` K`
KOk=1
��k:
The approximation error is proportional to1P
`=M+1�` ! 0:
Question: What is a suitable representation of the huge matrix L or its
approximation?
Later numerical example:
N = 1000; p = 10; K = 20 ) N � (p+ 1)20 � 6:7� 1023:
7.3 Tensor rank of the stochastic Galerkin matrix
1 + M �#J terms are involved in
L := K0 �0 +MX`=1
X�2J
�`;�K` KOk=1
��k:
Assume that we can approximate the tensor
� 2 RM KOk=1
Rpk+1
by � in R-term format: � =PRj=1
�y
(0)j
NKk=1 y
(k)j
�; i.e.,
�`;� =RXj=1
24�y(0)j
�`�KYk=1
�y
(k)j
��k
35 with y(0)j 2 RM and y
(k)j 2 Rpk+1:
Then
L =K0 �0 +RXj=1
0@ MX`=1
�y
(0)j
�`K`
1A KOk=1
0@X�k
�y
(k)j
��k
��k
1A ;i.e., L has an (1 +R)-term representation: L 2 R1+R:
) also the other ranks (Tucker, hierarchical format, TT) are � 1 + R:
Interludio:
Vj = KIj , V =Nj Vj:
For each ij 2 Ij is associated to a function f(j)ij:
The tensor v 2 V is de�ned by
v[i1; : : : ; id] =ZD
dYj=1
f(j)ij
(x)dx:
Then quadrature yields
v[i1; : : : ; id] � ~v[i1; : : : ; id] :=RX`=1
!`
dYj=1
f(j)ij
(x`):
Set v(j)` :=
�f
(j)i (x`)
�i2Ij
2 Vj: Then ~v[i1; : : : ; id] =PR`=1 !`
Qdj=1 v
(j)` [ij];
i.e.,
~v =RX`=1
!`
dOj=1
v(j)` 2 RR:
Explicit description of �:
�`;� :=ZD�`(x)m�(x)
KYk=1
��(�0k)
12 k(x)
��k(�k!)�
12
�dx��0;�
ZD�`(x)m�(x)dx:
Apply a quadrature toRD � � � dx: �`;� � �`;� :=
RXj=1
!j�`(xj)m�(xj)KYk=1
nh(�0k)1=2 k(xj)
i�k(�k!)�1=2
o��0;�
RXj0=1
!j0�`(xj0)m�(xj0):
This yields the desired (R + 1)-term representation of � :�y
(0)j
�`
:= !j �`(xj)m�(xj);�y
(k)j
��k
:=h(�0k)1=2 k(xj)
i�k(�k!)�1=2 (1 � k � K)
for 1 � j � R:
The additional term for j = 0 is�y
(0)0
�`
:= �RXj0=1
!j0 �`(xj0)m�(xj0);�y
(k)0
��k
:= �0;�k:
The error k� � �kF (quadrature error) does not depend on J (i.e., on K and
pk):
Final problem:
Lu =
0@ RXj=0
Kj �j
1Au = f :
Let B the approximate inverse of the discrete Laplacian. Then
�(BKj) = O(1)
and (B I) L is well-conditioned.
Numerical results with
��(x; y) = exp(�a2 kx� yk2);1
acovariance length;
Gaussian quadrature with S points per direction:
10−6
10−5
10−4
10−3
10−2
10−1
100
0 10 20 30 40 50 60
Rel
ati
ve
erro
r
Representation rank
a = 1.00, S = 20
a = 2.00, S = 20
a = 3.00, S = 35
a = 4.00, S = 55
10−6
10−5
10−4
10−3
10−2
10−1
100
0 20 40 60 80 100 120 140 160 180 200R
elati
ve
erro
rRepresentation rank
a = 1.00, S = 20
a = 2.00, S = 20
a = 3.00, S = 31
D = (0; 1) D = (0; 1)2
8 Minimal Subspaces
8.1 De�nitions
We recall the de�nition of the algebraic tensor space:
V := span
8<:dOj=1
v(j) : v(j) 2 Vj
9=; =: adOj=1
Vj
Here, dim(Vj) =1 may hold.
Question: Given v 2 V; are there minimal subspaces Uminj (v) � Vj such that
v 2dOj=1
Uminj (v);
v 2dOj=1
Uj =) Uminj (v) � Uj:
Such subspaces are the optimal choice for the tensor subspace representation(Tucker).
Elementary results:
1) There are �nite-dimensional Uj with v 2 Ndj=1Uj; more precisely
dim(Uj) � rank(v):
2) v 2 Ndj=1U
0j and v 2 Nd
j=1U00j imply v 2 Nd
j=1
�U 0j \ U 00j
�:
3) The intersection of all Uj with v 2 Ndj=1Uj yields Umin
j (v):
Characterisation of Uminj (v) in the �nite-dimensional case:
Uminj (v) = range(Mj); where Mj :=Mj(v) (matricisation).
The characterisation in the general case needs some notation.
V 0j dual space of Vj: Consider '[j] :=Nk 6=j '
(k) with '(k) 2 V 0k:'[j] can be regarded as a map from V =
Ndk=1 Vk onto Vj via
'[j]
0@ dOk=1
v(k)
1A =
0@Yk 6=j
'(k)(v(k))
1A v(j):
If Vj is a normed space, V �j denotes the continuous dual space (V �j � V 0j ):
Characterisations:
Uminj (v) =
8<:'[j](v) : '[j] 2 aOk 6=j
V 0k
9=; ;Uminj (v) =
8><>:'(v) : ' 2
0@a Ok 6=j
Vk
1A09>=>; ;
although aNk 6=j V
0k is strictly smaller than (a
Nk 6=j Vk)0 in the general
in�nite-dimensional case.
If Vk and/or aNk 6=j Vk are normed spaces, even
Uminj (v) =
8<:'[j](v) : '[j] 2 aOk 6=j
V �k
9=; ;Uminj (v) =
8<:'(v) : ' 2
0@a Ok 6=j
Vk
1A�9=;holds.
8.2 Topological Tensor Space�Vj; k�kj
�are Banach spaces. The topological tensor space V := k�k
Ndj=1 Vj is
the completion of the algebraic tensor space aNdj=1 Vj w.r.t. a norm k�k :
A necessary condition for reasonable topological tensor spaces is the continuity
of the tensor product, i.e., dOj=1
v(j)
� CdYj=1
v(j) j
for some C <1 and all v(j) 2 Vj:
DEFINITION: k�k is called a crossnorm if dOj=1
v(j)
=dYj=1
v(j) j:
REMARK: There are di�erent crossnorms k�k for the same k�kj !
Reasonable Crossnorms
k�k�j : dual norm corresponding to k�kj ; i.e. k'k�j = maxfj'(v)j = kvkj : 0 6=v 2 Vjg:
DEFINITION: k�k is called a reasonable crossnorm if dOj=1
v(j)
=dYj=1
v(j) j
for v(j) 2 Vj and
dOj=1
'(j)
�
=dYj=1
'(j) �j
for '(j) 2 V �j :
There are two extreme reasonable crossnorm. The strongest is the projective
norm
kvk^ := inf
8<:mXi=1
dYj=1
v(j)i
j
: v =mXi=1
dOj=1
v(j)i
9=;The weakest is ....
DEFINITION. For v 2 V = aNdj=1 Vj de�ne k�k_ by
kvk_ := sup
8<:����'(1) '(2) : : : '(d)
�(v)
���k'(j)k�1k'(j)k�2 � : : : � k'(j)k�d
: 0 6= '(j) 2 V �j ; 1 � j � d
9=; :(injective norm [Grothendieck 1953]).
THEOREM. A norm k�k on aNdj=1 Vj ; for which
Od
j=1: V1 � : : :� Vd ! a
Od
j=1Vj andOd
j=1: V �1 � : : :� V �d ! a
Od
j=1V �j
are continuous, cannot be weaker than k�k_ ; i.e.,
k�k & k�k_ : (norm)
We recall the de�nition of '[j] :=Nk 6=j '
(k) ('(k) 2 V 0k) by
'[j]
0@ dOk=1
v(k)
1A =
0@Yk 6=j
'(k)(v(k))
1A v(j):
LEMMA. ' 2 aNk2f1;:::;dgnfjg V
�j is continuous, i.e., ' 2 L
�_Ndk=1 Vk; Vj
�:
Its norm is
k'kVj _
Ndk=1 Vk
=Y
k2f1;:::;dgnfjgkv�kk
�k :
Consequence: ' 2 aNk2f1;:::;dgnfjg V
�j is well de�ned for topological tensors
v 2 _Ndk=1 Vk : The same conclusion holds for stronger norms than k�k_ ; in
particular for all reasonable crossnorms.
Assume k�k & k�k_.
MAIN THEOREM. For vn 2 aNdj=1 Vj assume vn * v 2 k�k
Ndj=1 Vj . Then
dimUminj (v) � lim inf
n!1 dimUminj (vn) for all 1 � j � d:
THEOREM. The sets Tr and Hr are weakly closed.
PROOF. Let vn 2 Tr; i.e., there are subspaces Uj;n with vn 2Ndj=1Uj;n and
dimUj;n � rj: Note that Uminj (vn) � Uj;n with dimUmin
j (vn) � rj:
If vn * v; then dimUj;min(v) � rj and therefore v 2 Tr. Similar for Hr:
Application to Best Approximation
THEOREM. Let (X; k�k) be a re exive Banach space with a weakly closed subset; 6= M � X. Then for any x 2 X there exists a best approximation v 2 Mwith
kx� vk = inffkx� wk : w 2Mg:
LEMMA A. If xn * x; then kxk � lim infn!1 kxnk :
LEMMA B. If X is a re exive Banach space, any bounded sequence xn 2 Xhas a subsequence xni converging weakly to some x 2 X:
PROOFofthe Theorem. Choose wn2M with kx�wnk! inffkx�wk : w2Mg.Since (wn)n2N is a bounded sequence in X, LEMMA B ensures theexistence of a subsequence wni * v 2 X. v belongs to M because wni 2 Mand M is weakly closed. Since also x � wni * x � v; LEMMA A showskx� vk � lim inf kx� wnik � inffkx� wk : w 2Mg.
Conclusion for M 2 fTr;Hrg:
COROLLARY. Let k�k satisfy k�k & k�k_ and let (V; k�k) be re exive. Thenbest approximations in the formats Tr and Hr exist.
9 Properties of the HOSVD Projection
We recall: The Tucker and hierarchical representation may be based on the
HOSVD bases�b
(�)` : 1 � ` � r�
�: The HOSVD projection is of the form
P = P� P�c with P�b(�)` =
(b
(�)` for 1 � ` � s�;0 for s� < ` � r�
Let
uHOSVD = Pv:
LEMMA. Let �jv = 0 for some �j = id : : : 'j id : : : id; 'j 2 V 0j :Then also �juHOSVD = 0:
LEMMA. If v 2 V belongs to the domain of �j; then also uHOSVD belongs
to the domain and satis�es �juHOSVD
� �jv :Application:
@kuHOSVD=@xkj
L2 �
@kv=@xkj L2 :
L1 Estimates
Problem:
� HOSVD projection uses the underlying Hilbert norm (L2)
� Pointwise evaluations require the maximum norm (L1)
Gagliardo-Nirenberg inequality:
k'k1 � cm j'j
d2mm k'k
1� d2m
L2 ; where
j'jm :=
0@Z
dXj=1
�����@m'@xmj
�����2
dx
1A1=2
:
For = Rd we have
limm!1 c
m = ��d=2:
10 Graph-Based Formats
10.1 Matrix-Product (TT) Format
A particular binary tree is {1} {2}
{1,2} {3}
{1,2,3} {4}
{1,2,3,4} {5}
{1,2,3,4,5} {6}
{1,2,3,4,5,6} {7}
{1,2,3,4,5,6,7}
. It leads to the TT format
(Oseledets{Tyrtyshnikov 2005) and coincides with the description of the matrix
product states (Vidal 2003, Verstraete{Cirac 2006) used in physics:
Instead, the hierarchical format (in particular, the TT format) is used.
Conclusion for polynomial p-methods
If f � P with a polynomial P of degree � p () data size p+ 1),
then the tensorised grid function f can be approximated by a tensor ~f such that
the TT ranks are bounded by �j � p+ 1 : f � ~f 2� kf �Pk2
The data size is bounded by
� 2d (p+ 1)2 :
hp Method
Let f be an asymptotically smooth function in (0; 1] with possible singularity atx = 0; e.g., f(x) = xx:Use the (best) piecewise polynomial approximation ~f (by degree p) in all intervals
[0; 1n]; [1
n;2n]; [2
n;4n]; : : : ; [1
4;12]; [1
2; 1]:
Required data size of hp method: (p+ 1) log2 n:Tensor ranks:
Hence, the data size of the tensorisation of ~f is bounded by
d (p+ 2)2 = (p+ 2)2 log2 n:
THEOREM (Grasedyck 2010) f asymptotically smooth with m point singulari-ties. Then the data size of v" corresponding exactly to a piecewise polynomialapproximation is characterised by