The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A...

53
The Matrix Logarithm: from Theory to Computation Nick Higham School of Mathematics The University of Manchester http://www.maths.manchester.ac.uk/~higham @nhigham, nickhigham.wordpress.com Napier 400 Symposium University of Edinburgh, March 2014

Transcript of The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A...

Page 1: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Research Matters

February 25, 2009

Nick HighamDirector of Research

School of Mathematics

1 / 6

The Matrix Logarithm:from Theory to Computation

Nick HighamSchool of Mathematics

The University of Manchester

http://www.maths.manchester.ac.uk/~higham@nhigham, nickhigham.wordpress.com

Napier 400 SymposiumUniversity of Edinburgh, March 2014

Page 2: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Outline

1 Properties, Formulas & Applications

2 Computation

Nick Higham Matrix Logarithm 2 / 33

Page 3: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Logarithm

A logarithm of A ∈ Cn×n is any matrix X such that eX = A.

Existence.Representation, classification.Computation.Conditioning.

Exists iff A nonsingular.Not unique.

Nick Higham Matrix Logarithm 3 / 33

Page 4: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Logarithm

A logarithm of A ∈ Cn×n is any matrix X such that eX = A.

Existence.Representation, classification.Computation.Conditioning.

Exists iff A nonsingular.Not unique.

Nick Higham Matrix Logarithm 3 / 33

Page 5: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm Example

Find a real log of A = −I2n, i.e., real solution of eX = A.

For (non-primary) real log, map eigenvalues in pairs{−1,−1} → {(2k + 1)πi ,−(2k + 1)πi}.Let H = π

[0 1−1 0

]. Then eH = −I2. All solutions are

X = U diag((2k1 + 1)H, (2k2 + 1)H, . . . , (2kn + 1)H

)U−1,

for real nonsingular U. Thus, e.g., k1 = 0, k2 = 1, integer U,

eX = −I4 for X = π

39 20 12 6−55 −28 −15 −10

7 3 0 4−71 −36 −24 −11

.

Nick Higham Matrix Logarithm 4 / 33

Page 6: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm Example

Find a real log of A = −I2n, i.e., real solution of eX = A.

For (non-primary) real log, map eigenvalues in pairs{−1,−1} → {(2k + 1)πi ,−(2k + 1)πi}.

Let H = π[

0 1−1 0

]. Then eH = −I2. All solutions are

X = U diag((2k1 + 1)H, (2k2 + 1)H, . . . , (2kn + 1)H

)U−1,

for real nonsingular U. Thus, e.g., k1 = 0, k2 = 1, integer U,

eX = −I4 for X = π

39 20 12 6−55 −28 −15 −10

7 3 0 4−71 −36 −24 −11

.

Nick Higham Matrix Logarithm 4 / 33

Page 7: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm Example

Find a real log of A = −I2n, i.e., real solution of eX = A.

For (non-primary) real log, map eigenvalues in pairs{−1,−1} → {(2k + 1)πi ,−(2k + 1)πi}.Let H = π

[0 1−1 0

]. Then eH = −I2.

All solutions are

X = U diag((2k1 + 1)H, (2k2 + 1)H, . . . , (2kn + 1)H

)U−1,

for real nonsingular U. Thus, e.g., k1 = 0, k2 = 1, integer U,

eX = −I4 for X = π

39 20 12 6−55 −28 −15 −10

7 3 0 4−71 −36 −24 −11

.

Nick Higham Matrix Logarithm 4 / 33

Page 8: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm Example

Find a real log of A = −I2n, i.e., real solution of eX = A.

For (non-primary) real log, map eigenvalues in pairs{−1,−1} → {(2k + 1)πi ,−(2k + 1)πi}.Let H = π

[0 1−1 0

]. Then eH = −I2. All solutions are

X = U diag((2k1 + 1)H, (2k2 + 1)H, . . . , (2kn + 1)H

)U−1,

for real nonsingular U. Thus, e.g., k1 = 0, k2 = 1, integer U,

eX = −I4 for X = π

39 20 12 6−55 −28 −15 −10

7 3 0 4−71 −36 −24 −11

.

Nick Higham Matrix Logarithm 4 / 33

Page 9: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Markov Models (1)

Time-homogeneous continuous-time Markov processwith transition probability matrix P(t) ∈ Rn×n.Transition intensity matrix Q: qij ≥ 0 (i 6= j),∑n

j=1 qij = 0, P(t) = eQt .

For discrete-time Markov processes:

Embeddability problemWhen does a given stochastic P have a reallogarithm Q that is an intensity matrix?

NP-hard (Cubitt, Eisert & Wolf, 2012).

Nick Higham Matrix Logarithm 5 / 33

Page 10: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Markov Models (2)—Example

With x = −e−2√

3π ≈ −1.9× 10−5,

P =13

1 + 2x 1− x 1− x1− x 1 + 2x 1− x1− x 1− x 1 + 2x

.P diagonalizable, Λ(P) = {1, x , x}.Every primary log complex (can’t have complexconjugate ei’vals).Yet a generator is the non-primary log

Q = 2√

−2/3 1/2 1/61/6 −2/3 1/21/2 1/6 −2/3

.Nick Higham Matrix Logarithm 6 / 33

Page 11: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Markov Models (3)–Practicalities

Let P be transition probability matrix for discrete-timeMarkov process.If P is transition matrix for 1 year,P(1/12) = P1/12 = e

112 log P is matrix for 1 month.

Problem: log P, P1/k may have wrong sign patterns⇒“regularize”.In credit risk, P is strictly diagonally dominant, whichimplies at most one generator.

Nick Higham Matrix Logarithm 7 / 33

Page 12: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Principal Logarithm and pth Root

Let A ∈ Cn×n have no eigenvalues on R− .

Principal logX = log(A) denote unique X such that

eX = A.−π < Im

(λ(X )

)< π.

Principal power

For s ∈ R, As = es log A.

On next few slides relax to arbitrary nonsingular A and−π < Im

(λ(X )

)≤ π.

Nick Higham Matrix Logarithm 8 / 33

Page 13: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Principal Logarithm and pth Root

Let A ∈ Cn×n have no eigenvalues on R− .

Principal logX = log(A) denote unique X such that

eX = A.−π < Im

(λ(X )

)< π.

Principal power

For s ∈ R, As = es log A.

On next few slides relax to arbitrary nonsingular A and−π < Im

(λ(X )

)≤ π.

Nick Higham Matrix Logarithm 8 / 33

Page 14: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Principal Logarithm and pth Root

Let A ∈ Cn×n have no eigenvalues on R− .

Principal logX = log(A) denote unique X such that

eX = A.−π < Im

(λ(X )

)< π.

Principal power

For s ∈ R, As = es log A.

On next few slides relax to arbitrary nonsingular A and−π < Im

(λ(X )

)≤ π.

Nick Higham Matrix Logarithm 8 / 33

Page 15: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Unwinding Function

Definition (Aprahamian & H, 2014)

U(A) = A− log eA

2πi, A ∈ Cn×n.

Corless, Hare & Jeffrey (1996): U(z) =⌈

Im z−π2π

⌉∈ Z.

Jordan form: for Z−1AZ = diag(Jk(λk)),

U(A) = Zdiag(U(λk)Imk )Z−1.

U(A) is diagonalizable and has integer ei’vals.

Nick Higham Matrix Logarithm 9 / 33

Page 16: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Unwinding Function

Definition (Aprahamian & H, 2014)

U(A) = A− log eA

2πi, A ∈ Cn×n.

Corless, Hare & Jeffrey (1996): U(z) =⌈

Im z−π2π

⌉∈ Z.

Jordan form: for Z−1AZ = diag(Jk(λk)),

U(A) = Zdiag(U(λk)Imk )Z−1.

U(A) is diagonalizable and has integer ei’vals.

Nick Higham Matrix Logarithm 9 / 33

Page 17: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

When is log eA = A?

Theorem

For A ∈ Cn×n, U(A) = 0 iff Imλ(Aj) ∈ (−π, π] for all j .

Proof: Immediate from JCF formula and scalar case.

Thus log eA = A forHermitianunitaryidempotentstochastic

as |λ| ≤ 1 in every case.

Nick Higham Matrix Logarithm 10 / 33

Page 18: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm of a Fractional Matrix Power (1)

Lemma

For A ∈ Cn×n and α ∈ C,

log Aα = α log A− 2πi U(α log A).

Proof.

log Aα = log eα log A

= α log A− 2πi U(α log A).

Nick Higham Matrix Logarithm 11 / 33

Page 19: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm of a Fractional Matrix Power (1)

Lemma

For A ∈ Cn×n and α ∈ C,

log Aα = α log A− 2πi U(α log A).

Proof.

log Aα = log eα log A

= α log A− 2πi U(α log A).

Nick Higham Matrix Logarithm 11 / 33

Page 20: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm of a Fractional Matrix Power (2)

CorollaryFor A ∈ Cn×n

log(Aα) = α log A

for α ∈ (−1,1] and for α = −1 if A has no eigenvalues onR−.

Special cases: log A−1 = − log A, log A1/2 = 12 log A.

Nick Higham Matrix Logarithm 12 / 33

Page 21: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Logarithm of a Fractional Matrix Power (2)

CorollaryFor A ∈ Cn×n

log(Aα) = α log A

for α ∈ (−1,1] and for α = −1 if A has no eigenvalues onR−.

Special cases: log A−1 = − log A, log A1/2 = 12 log A.

Nick Higham Matrix Logarithm 12 / 33

Page 22: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Function of 2× 2 Triangular Matrix

f([

λ1 t12

0 λ2

])=

f (λ1) t12f (λ2)− f (λ1)

λ2 − λ1

0 f (λ2)

, λ1 6= λ2,

[f (λ) t12f ′(λ)

0 f (λ)

], λ1 = λ2 = λ.

(1,2) element given by t12f [λ2, λ1] always.

Inaccurate if λ1 ≈ λ2.

Nick Higham Matrix Logarithm 13 / 33

Page 23: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Function of 2× 2 Triangular Matrix

f([

λ1 t12

0 λ2

])=

f (λ1) t12f (λ2)− f (λ1)

λ2 − λ1

0 f (λ2)

, λ1 6= λ2,

[f (λ) t12f ′(λ)

0 f (λ)

], λ1 = λ2 = λ.

(1,2) element given by t12f [λ2, λ1] always.

Inaccurate if λ1 ≈ λ2.

Nick Higham Matrix Logarithm 13 / 33

Page 24: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Log of 2× 2 Triangular Matrix

logλ2 − logλ1 = log(λ2

λ1

)+ 2π i U(logλ2 − logλ1)

= log(

1 + z1− z

)+ 2π i U(logλ2 − logλ1),

where z = (λ2 − λ1)/(λ2 + λ1).

atanh z :=12

log(

1 + z1− z

),

f12 = t122 atanh z + 2πiU(logλ2 − logλ1)

λ2 − λ1.

Nick Higham Matrix Logarithm 14 / 33

Page 25: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Log of 2× 2 Triangular Matrix

logλ2 − logλ1 = log(λ2

λ1

)+ 2π i U(logλ2 − logλ1)

= log(

1 + z1− z

)+ 2π i U(logλ2 − logλ1),

where z = (λ2 − λ1)/(λ2 + λ1).

atanh z :=12

log(

1 + z1− z

),

f12 = t122 atanh z + 2πiU(logλ2 − logλ1)

λ2 − λ1.

Nick Higham Matrix Logarithm 14 / 33

Page 26: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

The Average Eye

First order character of optical system characterized bytransference matrix

T =

[S δ0 1

]∈ R5×5,

where S ∈ R4×4 is symplectic:

ST JS = J =

[0 I2−I2 0

].

Average m−1∑mi=1 Ti is not a transference matrix.

Harris (2005) proposes the average exp(m−1∑mi=1 log Ti).

Nick Higham Matrix Logarithm 15 / 33

Page 27: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Other Applications

Patch modeling-based skin detection (Hu, Zuo, Wu,Chen, Zhang & Suter, 2011).

In-betweening in computer animations (Rossignac &Vinacua, 2011).

Mueller matrix M ∈ R4×4 in optics—associated with anelement that alters the polarization of light (Chipman,2010).

Nick Higham Matrix Logarithm 16 / 33

Page 28: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Outline

1 Properties, Formulas & Applications

2 Computation

Nick Higham Matrix Logarithm 17 / 33

Page 29: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Henry Briggs (1561–1630)

Arithmetica Logarithmica (1624)Logarithms to base 10 of 1–20,000 and90,000–100,000 to 14 decimal places.

Briggs must be viewed as one of thegreat figures in numerical analysis.

—Herman H. Goldstine,A History of Numerical Analysis (1977)

Nick Higham Matrix Logarithm 18 / 33

Page 30: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Henry Briggs (1561–1630)

Arithmetica Logarithmica (1624)Logarithms to base 10 of 1–20,000 and90,000–100,000 to 14 decimal places.

Briggs must be viewed as one of thegreat figures in numerical analysis.

—Herman H. Goldstine,A History of Numerical Analysis (1977)

Nick Higham Matrix Logarithm 18 / 33

Page 31: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,
Page 32: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,
Page 33: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Briggs’ Log Method (1617)

log(ab) = log a + log b ⇒ log a = 2 log a1/2.

Use repeatedly:log a = 2k log a1/2k

.

Write a1/2k= 1 + x and note log(1 + x) ≈ x . Briggs worked

to base 10 and used

log10 a ≈ 2k · log10 e · (a1/2k − 1).

Nick Higham Matrix Logarithm 21 / 33

Page 34: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Logarithm

Assume A has no ei’vals on R−. From matrix unwindingresult,

log A = 2 log A1/2.

Use Briggs’ idea: log A = 2k log(A1/2k)

.

Kenney & Laub’s (1989) inverse scaling and squaringmethod:

Bring A close to I by repeated square roots.Approximate log A1/2k using an [m/m] Padéapproximant rm(x) ≈ log(1 + x).Rescale to find log A.

Nick Higham Matrix Logarithm 22 / 33

Page 35: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Logarithm

Assume A has no ei’vals on R−. From matrix unwindingresult,

log A = 2 log A1/2.

Use Briggs’ idea: log A = 2k log(A1/2k)

.

Kenney & Laub’s (1989) inverse scaling and squaringmethod:

Bring A close to I by repeated square roots.Approximate log A1/2k using an [m/m] Padéapproximant rm(x) ≈ log(1 + x).Rescale to find log A.

Nick Higham Matrix Logarithm 22 / 33

Page 36: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Matrix Logarithm

Assume A has no ei’vals on R−. From matrix unwindingresult,

log A = 2 log A1/2.

Use Briggs’ idea: log A = 2k log(A1/2k)

.

Kenney & Laub’s (1989) inverse scaling and squaringmethod:

Bring A close to I by repeated square roots.Approximate log A1/2k using an [m/m] Padéapproximant rm(x) ≈ log(1 + x).Rescale to find log A.

Nick Higham Matrix Logarithm 22 / 33

Page 37: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Choice of Parameters s, m

Must have ‖I − A1/2s‖ < 1. Recall rm(x) ≈ log(1 + x).

Larger Padé degree m means smaller s.

Let h2m+1(X ) = erm(X) − X − I.Assume ρ(rm(X )) < π, so log(erm(X)) = rm(X ). Then

rm(X ) = log(I + X + h2m+1(X )︸ ︷︷ ︸∆X

)

where

h2m+1(X ) =∞∑

k=2m+1

ckX k .

Nick Higham Matrix Logarithm 23 / 33

Page 38: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Bounding the Backward Error

Want to bound norm of h2m+1(X ) =∑∞

k=2m+1 ckX k .

Non-normality implies ρ(A)� ‖A‖.

Note that

ρ(A) ≤ ‖Ak‖1/k ≤ ‖A‖, k = 1 : ∞.

and limk→∞ ‖Ak‖1/k = ρ(A).

Use ‖Ak‖1/k instead of ‖A‖ in the truncation bounds.

Nick Higham Matrix Logarithm 24 / 33

Page 39: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

A =

[0.9 5000 −0.5

].

0 5 10 15 2010

0

102

104

106

108

1010

‖A‖k2‖Ak‖2(‖A5‖1/52 )k

(‖A10‖1/102 )k

‖Ak‖1/k2

Page 40: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Algorithm of Al-Mohy & H (2012)

Truncation bounds use ‖Ak‖1/k rather than ‖A‖, leadingto major benefits in speed and accuracy.Matrix norms not such a blunt tool!Use estimates of ‖Ak‖ (alg of H & Tisseur (2000)).Choose s and m to achieve double precision backwarderror at minimal cost.Initial Schur decomposition: A = QTQ∗.Directly and accurately compute certain elements ofT 1/2s − I and log T . Use

a1/2s − 1 =a− 1∏s

i=1(1 + a1/2i ).

Nick Higham Matrix Logarithm 26 / 33

Page 41: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Algorithm of Al-Mohy & H (2012) Cont.

Use above formula for log of 2× 2 blocks.For real Schur decomposition 2× 2 diagonal blocks

B =

[a bc a

],

where bc < 0. Ei’vals λ± = a± i(−bc)1/2.Let θ = arg(λ+) ∈ (−π, π). Have

log(B) =

[log(a2 − bc)/2 θb (−bc)−1/2

θc (−bc)−1/2 log(a2 − bc)/2

].

Nick Higham Matrix Logarithm 27 / 33

Page 42: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Frechét Derivative of Logarithm

f (A + E)− f (A)− Lf (A,E) = o(‖E‖).Integral formula

Lf (A,E) =

∫ 1

0

(t(A− I) + I

)−1E(t(A− I) + I

)−1 dt .

Method based on

f([

X E0 X

])=

[f (X ) Lf (X ,E)

0 f (X )

].

Kenney & Laub (1998): Kronecker–Sylvester alg,Padé of tanh(x)/x . Requires complex arithmetic.

Nick Higham Matrix Logarithm 28 / 33

Page 43: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Algorithm of Al-Mohy, H & Relton (2013)

Fréchet differentiate the ISS algorithm!

1 E0 = E2 for i = 1: s3 Compute A1/2i .4 Solve the Sylvester eqn A1/2i Ei + EiA1/2i

= Ei−1.5 end6 log(A) ≈ 2srm(A1/2s − I)7 Llog(A,E) ≈ 2sLrm(A1/2s − I,Es)

Backward Error Result

rm(X ) = log(I + X +∆X ),

Lrm(X ,E) = Llog(I + X +∆X ,E +∆E).

Nick Higham Matrix Logarithm 29 / 33

Page 44: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Knowledge Transfer Partnership

University of Manchester and NAG (2010–2013)funded by EPSRC, NAG and TSB.

Developed suite of 40 NAG Library codes for matrixfunctions.

Extensive set of new codes included in Mark 23 (2012)onwards.

Improvements to existing state of the art: faster andmore accurate.

Nick Higham Matrix Logarithm 30 / 33

Page 45: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,
Page 46: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Availability of Algorithms

MATLAB MATLAB NAG SciPybuilt-in Third party Library

eA × √ √ √log A × √ √ √A1/2 √ √ √ √f (A)

√–

√ ×At × √ √ √

cond(f ,A) × √ √ ×eAb × √ √ √

Lexp × √ √ √Llog × √ √ ×Lx t × √ √ ×

A Catalogue of Software for Matrix Functions(Deadman & H, 2014).

Nick Higham Matrix Logarithm 32 / 33

Page 47: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

Connections

James Joseph Sylvester(September 3, 1814–March 15,1897), FRS. Gave first generalf (A) formula in 1883:

f (A) =n∑

i=1

f (λi)∏j 6=i

A− λj Iλi − λj

.

Savilian Professor of Geometry, Oxford:Briggs (1619–1631), Sylvester (1883–1894).

Lambert W function: W eW = A(Corless, Gonnet, Hare, Jeffrey & Knuth, 1996).

Nick Higham Matrix Logarithm 33 / 33

Page 48: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References I

A. H. Al-Mohy and N. J. Higham.Improved inverse scaling and squaring algorithms forthe matrix logarithm.SIAM J. Sci. Comput., 34(4):C153–C169, 2012.

A. H. Al-Mohy, N. J. Higham, and S. D. Relton.Computing the Fréchet derivative of the matrix logarithmand estimating the condition number.SIAM J. Sci. Comput., 35(4):C394–C410, 2013.

M. Aprahamian and N. J. Higham.The matrix unwinding function, with an application tocomputing the matrix exponential.SIAM J. Matrix Anal. Appl., 35(1):88–109, 2014.

Nick Higham Matrix Logarithm 1 / 6

Page 49: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References II

R. A. Chipman.Mueller matrices.In M. Bass, editor, Handbook of Optics: VolumeI—Geometrical and Physical Optics, Polarized Light,Components and Instruments, pages 14.1–14.44.McGraw-Hill, New York, third edition, 2010.

R. M. Corless, G. H. Gonnet, D. E. G. Hare, D. J.Jeffrey, and D. E. Knuth.On the Lambert W function.Adv. in Comput. Math., 5(4):329–359, 1996.

R. M. Corless and D. J. Jeffrey.The unwinding number.ACM SIGSAM Bulletin, 30(2):28–35, June 1996.

Nick Higham Matrix Logarithm 2 / 6

Page 50: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References III

T. S. Cubitt, J. Eisert, and M. M. Wolf.The complexity of relating quantum channels to masterequations.Commun. Math. Phys., 310(2):383–418, 2012.

W. F. Harris.The average eye.Opthal. Physiol. Opt., 24:580–585, 2005.

N. J. Higham.Functions of Matrices: Theory and Computation.Society for Industrial and Applied Mathematics,Philadelphia, PA, USA, 2008.ISBN 978-0-898716-46-7.xx+425 pp.

Nick Higham Matrix Logarithm 3 / 6

Page 51: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References IV

N. J. Higham and A. H. Al-Mohy.Computing matrix functions.Acta Numerica, 19:159–208, 2010.

W. Hu, H. Zuo, O. Wu, Y. Chen, Z. Zhang, and D. Suter.Recognition of adult images, videos, and web pagebags.ACM Trans. Multimedia Comput. Commun. Appl., 78:28:1–28:24, 2011.

D. J. Jeffrey, D. E. G. Hare, and R. M. Corless.Unwinding the branches of the Lambert W function.Math. Scientist, 21:1–7, 1996.

Nick Higham Matrix Logarithm 4 / 6

Page 52: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References V

C. S. Kenney and A. J. Laub.Condition estimates for matrix functions.SIAM J. Matrix Anal. Appl., 10(2):191–209, 1989.

C. S. Kenney and A. J. Laub.A Schur–Fréchet algorithm for computing the logarithmand exponential of a matrix.SIAM J. Matrix Anal. Appl., 19(3):640–663, 1998.

R. Ossikovski.Differential matrix formalism for depolarizing anisotropicmedia.Optics Letters, 36(12):2330–2332, 2011.

Nick Higham Matrix Logarithm 5 / 6

Page 53: The Matrix Logarithm: from Theory to Computationhigham/talks/napier_log14.pdf · Matrix Logarithm A logarithm of A 2Cn n is any matrix X such that eX = A. Existence. Representation,

References VI

J. Rossignac and À. Vinacua.Steady affine motions and morphs.ACM Trans. Graphics, 30(5):116:1–116:16, 2011.

J. J. Sylvester.On the equation to the secular inequalities in theplanetary theory.Philosophical Magazine, 16:267–269, 1883.

Nick Higham Matrix Logarithm 6 / 6