a quantum control algorithm: numerical aspects - jass 2008 · a quantum control algorithm:...
TRANSCRIPT
JASS 2008St. Petersburg, March 2008
A quantum control algorithm: numerical aspects
Philipp Klenze
Technische Universitat Munchen, Germany
This presentation contains slides adapted from the presentation “NumericalLinear Algebra Tasks in a Quantum Control Problem” by Konrad Waldherr.
Technische Universitat Munchen
Gradient Flow Algorithm
One iteration step in the Gradient Flow Algorithm• Calculate the forward-propagation for all t1, t2, ..., tk:
U(tk) = e−i∆tHk · e−i∆tHk−1 · · · e−i∆tH1
• Compute the backward-propagation for all tM, tM−1, . . . , tk
Λ(tk) = e−i∆tHk · e−i∆tHk+1 · · · e−i∆tHM
• Calculate the update
∂h(U(tk))∂uj
= Re{
tr[Λ†(tk)(−iHj)U(tk)
]}
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 2
Technische Universitat Munchen
Numerical tasks• Computation of the matrix exponentials
• Computation of all intermediate products
U0U0 ·U1U0 ·U1 ·U2...U0 ·U1 ·U2 · · ·UM
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 3
Technische Universitat Munchen
Properties of H• H is sparse, most entries are zero• H is hermitian, H† = H• H is persymmetric, symmetric with respect to the
north-west-south-east diagonal, HJ = JH†
• H has the following sparsity pattern
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 4
Technische Universitat Munchen
Simplifying the problem• H can be transformed into a real matrix
• Then, H can be transformed to two real blocks of half size:(I JI −J
)·H ·
(I IJ −J
)=
(A1 00 A2
)
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 5
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function
• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 6
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function
• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 7
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function
• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 8
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 9
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function• with polynomials
• TAYLOR series
• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 10
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 11
Technische Universitat Munchen
Ideas to calculate the matrix exponential
• The problem: compute eA :=∞∑
k=0
Ak
k!
• Diagonalise A (eigendecomposition)
• Approximate the exponential function• with polynomials
• TAYLOR series• CHEBYSHEV series expansion
• with rational functions• PADE approximation
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 12
Technische Universitat Munchen
Eigendecomposition• In the case of a diagonal matrix
A = diag(d1, . . . , dn) =
d1. . .
dn
it holds
eA = diag(ed1 , . . . , edn) =
ed1
. . .edn
• If A = SDS−1 = S (diag(d1, . . . , dn)) S−1 it follows
eA = S(
diag(ed1 , . . . , edn))
S−1
• Expensive part: Computation of the eigendecomposition
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 13
Technische Universitat Munchen
Scaling and Squaring• Some approximations work much better if the norm of the matrix
A is not to big
•(
eA/m)m
= eA
• Scaling & Squaring
eA =(
eA/2k)2k
• We scale our matrix by a factor of 12k
• Then, we compute the approximation
• In the end, we square the approximation k times
• This is not very expensive
• Additional error
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 14
Technische Universitat Munchen
Scaling and Squaring• Some approximations work much better if the norm of the matrix
A is not to big
•(
eA/m)m
= eA
• Scaling & Squaring
eA =(
eA/2k)2k
• We scale our matrix by a factor of 12k
• Then, we compute the approximation
• In the end, we square the approximation k times
• This is not very expensive
• Additional error
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 15
Technische Universitat Munchen
Taylor series• Idea: use a partial sum of the Taylor series
eA ≈ Sm(A) :=m
∑k=0
Ak
k!
• The error estimate depends on the norm of A→ Scaling & Squaring
• Convergence is slow
• Not numerically stable
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 16
Technische Universitat Munchen
Taylor series• Idea: use a partial sum of the Taylor series
eA ≈ Sm(A) :=m
∑k=0
Ak
k!
• The error estimate depends on the norm of A→ Scaling & Squaring
• Convergence is slow
• Not numerically stable
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 17
Technische Universitat Munchen
Taylor series• Idea: use a partial sum of the Taylor series
eA ≈ Sm(A) :=m
∑k=0
Ak
k!
• The error estimate depends on the norm of A→ Scaling & Squaring
• Convergence is slow
• Not numerically stable
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 18
Technische Universitat Munchen
Taylor series• Idea: use a partial sum of the Taylor series
eA ≈ Sm(A) :=m
∑k=0
Ak
k!
• The error estimate depends on the norm of A→ Scaling & Squaring
• Convergence is slow
• Not numerically stable
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 19
Technische Universitat Munchen
Chebyshev series expansion• A well-behaved function f : [−1, 1] → C can be approximated by
Chebychev polynomials Tk(x):
f (x) ≈ a0
2+
m
∑k=1
akTk(x)
with
ak :=2π
∫ 1
−1f (x)Tk(x)
dx√1− x2
• For the exponential function, ak decreases as 12kk!
• This works also for matrices if the norm is smaller than one
• Arbitrary norm→ Scaling & Squaring
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 20
Technische Universitat Munchen
Chebyshev series expansion• A well-behaved function f : [−1, 1] → C can be approximated by
Chebychev polynomials Tk(x):
f (x) ≈ a0
2+
m
∑k=1
akTk(x)
with
ak :=2π
∫ 1
−1f (x)Tk(x)
dx√1− x2
• For the exponential function, ak decreases as 12kk!
• This works also for matrices if the norm is smaller than one
• Arbitrary norm→ Scaling & Squaring
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 21
Technische Universitat Munchen
Chebyshev series expansion• A well-behaved function f : [−1, 1] → C can be approximated by
Chebychev polynomials Tk(x):
f (x) ≈ a0
2+
m
∑k=1
akTk(x)
with
ak :=2π
∫ 1
−1f (x)Tk(x)
dx√1− x2
• For the exponential function, ak decreases as 12kk!
• This works also for matrices if the norm is smaller than one
• Arbitrary norm→ Scaling & Squaring
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 22
Technische Universitat Munchen
Chebyshev series expansion• A well-behaved function f : [−1, 1] → C can be approximated by
Chebychev polynomials Tk(x):
f (x) ≈ a0
2+
m
∑k=1
akTk(x)
with
ak :=2π
∫ 1
−1f (x)Tk(x)
dx√1− x2
• For the exponential function, ak decreases as 12kk!
• This works also for matrices if the norm is smaller than one
• Arbitrary norm→ Scaling & Squaring
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 23
Technische Universitat Munchen
Pade approximation• Pade approximation works like Taylor, but using a rational
function instead of a polynomial
• For x ∈ C the Pade approximation rm(x) of ex is given by
rm(x) =pm(x)qm(x)
with pm(x) =m∑
j=0
(2m−j)!m!(2m)!(m−j)!j! xj, qm(x) =
m∑
j=0
(2m−j)!m!(−1)j
(2m)!(m−j)!j! xj
• Generalization to matrices:
eA ≈ rm(A) = (qm(A))−1 pm(A)
• Approximation is only good around 0→ Scaling & Squaring
• Expensive part: Computation of the matrix inverse
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 24
Technische Universitat Munchen
Pade approximation• Pade approximation works like Taylor, but using a rational
function instead of a polynomial
• For x ∈ C the Pade approximation rm(x) of ex is given by
rm(x) =pm(x)qm(x)
with pm(x) =m∑
j=0
(2m−j)!m!(2m)!(m−j)!j! xj, qm(x) =
m∑
j=0
(2m−j)!m!(−1)j
(2m)!(m−j)!j! xj
• Generalization to matrices:
eA ≈ rm(A) = (qm(A))−1 pm(A)
• Approximation is only good around 0→ Scaling & Squaring
• Expensive part: Computation of the matrix inverse
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 25
Technische Universitat Munchen
Pade approximation• Pade approximation works like Taylor, but using a rational
function instead of a polynomial
• For x ∈ C the Pade approximation rm(x) of ex is given by
rm(x) =pm(x)qm(x)
with pm(x) =m∑
j=0
(2m−j)!m!(2m)!(m−j)!j! xj, qm(x) =
m∑
j=0
(2m−j)!m!(−1)j
(2m)!(m−j)!j! xj
• Generalization to matrices:
eA ≈ rm(A) = (qm(A))−1 pm(A)
• Approximation is only good around 0→ Scaling & Squaring
• Expensive part: Computation of the matrix inverse
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 26
Technische Universitat Munchen
Comparison of the methods: Computation time
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 27
Technische Universitat Munchen
Comparison of the methods: accuracy
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 28
Technische Universitat Munchen
Advantages of the Chebyshev series method• Only the evaluation of a matrix polynomial required:
=⇒ BLAS-Routines
• Only products of the form dense * sparse appear
• Good convergence properties
• Matrix polynomials of order k can be evaluated with only O(√
k)matrix-matrix-products
• Theoretically nice approach
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 29
Technische Universitat Munchen
Parallel matrix-matrix-multiplication• Numerical task: Compute all intermediate products
U0U0 ·U1U0 ·U1 ·U2...U0 ·U1 ·U2 · · ·UM
• Two approaches for a parallel algorithm:• slice-wise method• tree-like method
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 30
Technische Universitat Munchen
The slice-wise approach
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 31
Technische Universitat Munchen
The slice-wise approach
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 32
Technische Universitat Munchen
The slice-wise approach
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 33
Technische Universitat Munchen
The slice-wise approach: conclusions• Broadcast of all matrices Uk to all processors
• Each processor is responsible for ”its” rows
• No communication during the algorithm required
• Optimal in terms of scalar multiplications
• Broadcasting costs most of the time
• Memory becomes an issue
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 34
Technische Universitat Munchen
The tree-like approachPlease look at the whiteboard.
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 35
Technische Universitat Munchen
The tree-like approach: conclusions• “Expanded” binary tree
• Complicated algorithm
• No broadcasting required
• Still much communication
• More multiplications than strictly needed
• “Super Nodes” do quasi-broadcast
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 36
Technische Universitat Munchen
a new approachPlease look at the whiteboard.
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 37
Technische Universitat Munchen
The best of both worlds: a new approach• Pipeline
• Litte communication required
• Simple algorithm
• Optimal in terms of total scalar multiplications
• Possibility to parallelize the entire GRAPE algorithm
• Some idle time until the pipeline is filled
Philipp Klenze: A quantum control algorithm: numerical aspects
JASS 2008, March 27, 2008 38