a quantum control algorithm: numerical aspects - jass 2008 · a quantum control algorithm:...

38
JASS 2008 St. Petersburg, March 2008 A quantum control algorithm: numerical aspects Philipp Klenze Technische Universit¨ at M ¨ unchen, Germany This presentation contains slides adapted from the presentation “Numerical Linear Algebra Tasks in a Quantum Control Problem” by Konrad Waldherr.

Upload: others

Post on 15-Nov-2019

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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.

Page 2: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 3: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 4: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 5: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 6: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 7: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 8: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 9: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 10: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 11: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 12: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 13: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 14: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 15: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 16: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 17: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 18: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 19: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 20: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 21: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 22: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 23: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 24: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 25: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 26: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 27: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

Comparison of the methods: Computation time

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 27

Page 28: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

Comparison of the methods: accuracy

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 28

Page 29: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 30: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 31: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

The slice-wise approach

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 31

Page 32: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

The slice-wise approach

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 32

Page 33: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

The slice-wise approach

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 33

Page 34: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 35: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 36: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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

Page 37: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

Technische Universitat Munchen

a new approachPlease look at the whiteboard.

Philipp Klenze: A quantum control algorithm: numerical aspects

JASS 2008, March 27, 2008 37

Page 38: A quantum control algorithm: numerical aspects - JASS 2008 · A quantum control algorithm: numerical aspects Philipp Klenze Technische Universitat M¨ unchen, Germany¨ This presentation

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