Top Banner
Computation of matrix gamma function Jo˜ ao R. Cardoso 1 , Amir Sadeghi 2 1 Coimbra Polytechnic – ISEC, Coimbra, Portugal Institute of Systems and Robotics – Coimbra [email protected] 2 Islamic Azad University, Tehran, Iran Advances in NLA, Univ. Manchester, May 2019 Jo˜ ao R. Cardoso , Amir Sadeghi Computation of matrix gamma function Advances in NLA, Univ. Manchester, May 201 / 23
23

Computation of matrix gamma function - WordPress.com

Jun 08, 2022

Download

Documents

dariahiddleston
Welcome message from author
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
Page 1: Computation of matrix gamma function - WordPress.com

Computation of matrix gamma function

Joao R. Cardoso1, Amir Sadeghi2

1Coimbra Polytechnic – ISEC, Coimbra, PortugalInstitute of Systems and Robotics – Coimbra

[email protected]

2Islamic Azad University, Tehran, Iran

Advances in NLA, Univ. Manchester, May 2019

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 1

/ 23

Page 2: Computation of matrix gamma function - WordPress.com

Motivation

Matrix gamma function is an important matrix function (connectionswith differential equations and with other special functions, such asbeta function and Bessel function);

We haven’t found any research involving its numerical computation.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 2

/ 23

Page 3: Computation of matrix gamma function - WordPress.com

Revisiting scalar gammaDefinition

Γ(z) =

∫ ∞0

e−ttz−1dt, Re(z) > 0.

(definition using Euler’s integral)

By analytic continuation, we can extend this definition to all complexnumbers except the non-positive integers 0,−1,−2, . . ..

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 3

/ 23

Page 4: Computation of matrix gamma function - WordPress.com

-4 -3 -2 -1 0 1 2 3 4 5

x

-100

-80

-60

-40

-20

0

20

40

60

80

(x)

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 4

/ 23

Page 5: Computation of matrix gamma function - WordPress.com

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 5

/ 23

Page 6: Computation of matrix gamma function - WordPress.com

Scalar gammaProperties

Connection with factorial

Γ(n + 1) = n!

(n positive integer)

Translation formulaΓ(z + 1) = z Γ(z)

Reflection formula

Γ(z) =π

Γ(1− z) sin(π z), z /∈ Z

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 6

/ 23

Page 7: Computation of matrix gamma function - WordPress.com

Computation of scalar gamma

Lanczos method: a formula involving a partial fraction expansion dueto Cornelius Lanczos (1964); most popular (available in NumericalRecipes);

Stirling’s formula: Asymptotic expansion due to Abraham de Moivre(1733); also studied by James Stirling.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 7

/ 23

Page 8: Computation of matrix gamma function - WordPress.com

Matrix gammaDefinition

Γ(A) =∫∞

0 e−ttA−I dt,

where A has eigenvalues with positive real parts and

tA−I := exp((A− I ) log t)

(Jodar & Cortes, 1998)

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 8

/ 23

Page 9: Computation of matrix gamma function - WordPress.com

Computation of Matrix gamma

Major difficulties

Methods for the matrix gamma based just on the substitution of thevariable z by a matrix A in Lanczos and Stirling approximations give verypoor results.

Scalar Lanczos method just holds for z with positive real part; if z hasnegative real part, the reflection gamma formula should be used.Scalar asymptotic Stirling formula gives good results if the real part of z issufficiently large.

How to proceed for matrices having small and large eigenvalues oreigenvalues with positive and negative real parts?

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 9

/ 23

Page 10: Computation of matrix gamma function - WordPress.com

Lanczos formula for matrices

log[Γ(A)] = 0.5 log(2π)I + (A− 0.5I ) log(A + (α− 0.5) I )− (A + (α− 0.5) I ) +

log

[c0(α)I +

m∑k=1

ck(α) (A + (k − 1)I )−1 + εα,m(A)

]

, where Re(λ) > 0.

(Logarithmic version to avoid overflow)

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 10

/ 23

Page 11: Computation of matrix gamma function - WordPress.com

Lanczos method

If A has spectrum entirely contained in the open right-half plane,compute Γ(A) by Lanczos formula (e.g, with m = 10 terms andα = 9, as recommended by Lanczos);

If σ(A) doesn’t contain negative integers and lies entirely on the openleft-half plane, use reflection property combined with Lanczos formula

(Not recommended when A has simultaneously eigvs with positive andnegative real parts)

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 11

/ 23

Page 12: Computation of matrix gamma function - WordPress.com

Stirling approximation for matrices

Γ(A) ≈

(s∏

k=1

(A + (k − 1)I )

)−1

eSm,s(A),

where

Sm,s(A) := (A + (s − 0.5)I ) log(A + (s − 1)I )− (A + (s − 1)I ) +

0.5 log(2π) +m∑

k=1

B2k

2k(2k − 1) (A + (s − 1)I )2k−1,

where Re(λ) > 0.

(B2k : Bernoulli numbers)

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 12

/ 23

Page 13: Computation of matrix gamma function - WordPress.com

Matrix gammaStirling approximation

Algorithm. This algorithm evaluates Γ(A) using the Stirling formula, with m = 12, andA ∈ Cn×n is a nonsingular matrix with spectrum satisfying one and only one of the followingconditions: (i) σ(A) is contained in the closed right-half plane; or (ii) σ(A) does not containnegative integers and lies on the open left-half plane.

1 if Re(trace(A)) ≥ 0

2 z = trace(A)/n;

3 if Im(z) ≥ 8.3 or 1− Re(z +

√8.32 − Im(z)2)

)≤ 0

4 s = 0

5 else

6 s = d1− Re(z) +√

8.32 − Im(z)2e7 end

8 Compute Γ(A) by Stirling formula;

9 else

10 S = sin(πA);

11 Compute G = Γ(I − A) by Stirling formula;;

12 Γ(A) ≈ π(SG)−1;

13 end

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 13

/ 23

Page 14: Computation of matrix gamma function - WordPress.com

Matrix reciprocal gamma

∆(A) = (Γ(A))−1 =∞∑k=0

akAk ,

a1 = 1, a2 = γ (here γ stands for the Euler-Mascheroni constant) and thecoefficients ak (k ≥ 2) are given recursively by

ak =a2ak−1 −

∑k−1j=2 (−1)jζ(j)ak−j

k − 1,

with ζ(.) being the Riemann zeta function.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 14

/ 23

Page 15: Computation of matrix gamma function - WordPress.com

-6 -4 -2 0 2 4 6

x

-4

-3

-2

-1

0

1

2

3

4

5

(x)

Reciprocal gamma

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 15

/ 23

Page 16: Computation of matrix gamma function - WordPress.com

Matrix reciprocal gammaError bound

Lemma

If A ∈ Cn×n with ‖A‖ ≤ 1, then∥∥∥∥∥∆(A)−m∑

k=1

akAk

∥∥∥∥∥ .4

π2

∞∑k=m+1

√k!

(m + 1)!(k −m − 1)!.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 16

/ 23

Page 17: Computation of matrix gamma function - WordPress.com

Matrix reciprocal gamma

Algorithm. This algorithm approximates Γ(A) , where A is a non-singularmatrix with no negative integers eigenvalues, by the reciprocal gammafunction series combined with the Gauss multiplication formula.

1 µ = 3;2 if ρ(A) ≤ µ3 ∆ =

∑50k=1 akA

k ;4 Γ(A) ≈ (∆)−1;5 else6 Compute r =

⌈ρ(A)−1µ−1

⌉;

7 ∆ =∑50

k=0 ak(Ar

)k;

8 for p = 1 : r − 1

9 Compute ∆ = ∆∑50

k=0 ak

(A+pI

r

)k;

10 end11 ∆ = (2π)

r−12 r0.5 I−A ∆;

12 Γ(A) ≈ (∆)−1;13 endJoao R. Cardoso, Amir Sadeghi Computation of matrix gamma function

Advances in NLA, Univ. Manchester, May 2019 17/ 23

Page 18: Computation of matrix gamma function - WordPress.com

Schur-Parlett method

Algorithm. This algorithm approximates Γ(A) by Schur-Parlett methodcombined with Lanczos, Stirling and reciprocal algorithms.

1 Compute a Schur decomposition A = UTU∗, where the blocks Tii inthe diagonal of T are well separated (δ = 0.1); (Some codes availablein Higham’s MFTOOLBOX)

2 Approximate Gii = Γ(Tii ) by one of the previous three algs;

3 Solve the Sylvester equations arising in Parlett’s recurrence, in orderto compute all the blocks Gij , with i < j ;

4 Γ(A) ≈ UGU∗, where G = [Gij ].

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 18

/ 23

Page 19: Computation of matrix gamma function - WordPress.com

Experiments

2 4 6 8 10 12 14 16 18 20

10-15

10-14

10-13

10-12

10-11

10-10

10-9

cond (A)u

par-lanczos

par-reciprocal

par-stirling

Figure: Relative errors for 20 test matrices together with the relative conditionnumber of Γ(A) times the unit roundoff of MATLAB.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 19

/ 23

Page 20: Computation of matrix gamma function - WordPress.com

Experiments

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

10-15

10-14

10-13

10-12

10-11

10-10

10-9

cond (A)u

par-lanczos

par-reciprocal

par-stirling

Figure: Relative errors for gallery(’moler’,12,a), by varying a from 0.1 to 1.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 20

/ 23

Page 21: Computation of matrix gamma function - WordPress.com

Experiments

15 16 17 18 19 20 21 22 23 24

n

10-16

10-14

10-12

10-10

10-8

10-6

10-4

10-2

cond (A)u

par-lanczos

par-reciprocal

par-stirling

Figure: Relative errors for wilkinson(n) with size n increasing as n = 15, . . . , 24.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 21

/ 23

Page 22: Computation of matrix gamma function - WordPress.com

Conclusions

Likewise the scalar case, the Lanczos methods shows a goodperformance in terms of a combination between accuracy andcomputational cost;

However, the technique based on the reciprocal gamma functioncombined with the Gauss multiplication formula, gives very goodresults in terms of accuracy, with the advantage of being rich inmatrix-matrix multiplications;

To make the three approximations of matrix gamma effective, theywere combined with the Schur-Parlett method.

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 22

/ 23

Page 23: Computation of matrix gamma function - WordPress.com

Further details in

Joao R. Cardoso, Amir Sadeghi, Computation of matrix gamma function,BIT Numerical Mathematics, (2019)(article in press, available online athttps://doi.org/10.1007/s10543-018-00744-1).

Joao R. Cardoso, Amir Sadeghi Computation of matrix gamma functionAdvances in NLA, Univ. Manchester, May 2019 23

/ 23