Positive Denite Matrix. Ya Yan Lu 1. Department of Mathematics. City University of Hong Kong. Kowloon, Hong Kong. Abstract

Similar documents
Exponentials of Symmetric Matrices through Tridiagonal Reductions

Automatica, 33(9): , September 1997.

Using Godunov s Two-Sided Sturm Sequences to Accurately Compute Singular Vectors of Bidiagonal Matrices.

Computing least squares condition numbers on hybrid multicore/gpu systems

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems

A note on eigenvalue computation for a tridiagonal matrix with real eigenvalues Akiko Fukuda

D. Gimenez, M. T. Camara, P. Montilla. Aptdo Murcia. Spain. ABSTRACT

Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems. Contents

Generalized interval arithmetic on compact matrix Lie groups

Baltzer Journals April 24, Bounds for the Trace of the Inverse and the Determinant. of Symmetric Positive Denite Matrices

OUTLINE 1. Introduction 1.1 Notation 1.2 Special matrices 2. Gaussian Elimination 2.1 Vector and matrix norms 2.2 Finite precision arithmetic 2.3 Fact

Solutions Preliminary Examination in Numerical Analysis January, 2017

LAPACK-Style Codes for Pivoted Cholesky and QR Updating. Hammarling, Sven and Higham, Nicholas J. and Lucas, Craig. MIMS EPrint: 2006.

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

NAG Library Routine Document F08JDF (DSTEVR)

Recurrence Relations and Fast Algorithms

2 MULTIPLYING COMPLEX MATRICES It is rare in matrix computations to be able to produce such a clear-cut computational saving over a standard technique

c 2007 Society for Industrial and Applied Mathematics

The Best Circulant Preconditioners for Hermitian Toeplitz Systems II: The Multiple-Zero Case Raymond H. Chan Michael K. Ng y Andy M. Yip z Abstract In

NAG Library Routine Document F08UBF (DSBGVX)

NAG Library Routine Document F08FNF (ZHEEV).1

NAG Library Routine Document F08FAF (DSYEV)

Computing the matrix cosine

Eigenvalue problems and optimization

The restarted QR-algorithm for eigenvalue computation of structured matrices

Taylor series based nite dierence approximations of higher-degree derivatives

On Orthogonal Block Elimination. Christian Bischof and Xiaobai Sun. Argonne, IL Argonne Preprint MCS-P

AIMS Exercise Set # 1

The geometric mean algorithm

Improved Inverse Scaling and Squaring Algorithms for the Matrix Logarithm. Al-Mohy, Awad H. and Higham, Nicholas J. MIMS EPrint: 2011.

Lecture 2: Computing functions of dense matrices

A MULTIGRID ALGORITHM FOR. Richard E. Ewing and Jian Shen. Institute for Scientic Computation. Texas A&M University. College Station, Texas SUMMARY

NAG Library Routine Document F08FPF (ZHEEVX)

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

2 Computing complex square roots of a real matrix

The Nearest Doubly Stochastic Matrix to a Real Matrix with the same First Moment

ƒ f(x)dx ~ X) ^i,nf(%i,n) -1 *=1 are the zeros of P«(#) and where the num

Institute for Advanced Computer Studies. Department of Computer Science. On the Adjoint Matrix. G. W. Stewart y ABSTRACT

On aggressive early deflation in parallel variants of the QR algorithm

The Matrix Sign Function Method and the. Computation of Invariant Subspaces. November Abstract

Solving Orthogonal Matrix Differential Systems in Mathematica

Introduction. Chapter One

On a quadratic matrix equation associated with an M-matrix

Beresford N. Parlett Λ. April 22, Early History of Eigenvalue Computations 1. 2 The LU and QR Algorithms 3. 3 The Symmetric Case 8

ETNA Kent State University

A Method for Constructing Diagonally Dominant Preconditioners based on Jacobi Rotations

A Backward Stable Hyperbolic QR Factorization Method for Solving Indefinite Least Squares Problem

PROOF OF TWO MATRIX THEOREMS VIA TRIANGULAR FACTORIZATIONS ROY MATHIAS

Numerical Methods in Physics and Astrophysics

QR Decomposition. When solving an overdetermined system by projection (or a least squares solution) often the following method is used:

1 Number Systems and Errors 1

1 Ordinary points and singular points

Non-stationary extremal eigenvalue approximations in iterative solutions of linear systems and estimators for relative error

Introduction to Numerical Analysis

Jacobian conditioning analysis for model validation

NAG Toolbox for Matlab nag_lapack_dggev (f08wa)

PARTIAL DIFFERENTIAL EQUATIONS

EXISTENCE VERIFICATION FOR SINGULAR ZEROS OF REAL NONLINEAR SYSTEMS

Testing Linear Algebra Software

Numerical Methods in Physics and Astrophysics

1.1. Contributions. The most important feature of problem (1.1) is that A is

Math 411 Preliminaries

Roundoff Error. Monday, August 29, 11

NAG Library Routine Document F07HAF (DPBSV)

Numerical Methods in Matrix Computations

Total least squares. Gérard MEURANT. October, 2008

INTEGER POWERS OF ANTI-BIDIAGONAL HANKEL MATRICES

Matrix Shapes Invariant under the Symmetric QR Algorithm

Computation of a canonical form for linear differential-algebraic equations

NAG Library Routine Document F08PNF (ZGEES)

Some bounds for the logarithmic function

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

Improved Newton s method with exact line searches to solve quadratic matrix equation

Notes for CS542G (Iterative Solvers for Linear Systems)

1 Vectors. Notes for Bindel, Spring 2017 Numerical Analysis (CS 4220)

Math 411 Preliminaries

NAG Toolbox for MATLAB Chapter Introduction. F02 Eigenvalues and Eigenvectors

Some Notes on Least Squares, QR-factorization, SVD and Fitting

S.F. Xu (Department of Mathematics, Peking University, Beijing)

Numerical Analysis Lecture Notes

Numerical Analysis: Solving Systems of Linear Equations

Luca Dieci, ** Benedetta Morini and Alessandra Papini. *** In this work, we consider computing the real logarithm of a real matrix.

problem Au = u by constructing an orthonormal basis V k = [v 1 ; : : : ; v k ], at each k th iteration step, and then nding an approximation for the e

Key words. conjugate gradients, normwise backward error, incremental norm estimation.

The Godunov Inverse Iteration: A Fast and Accurate Solution to the Symmetric Tridiagonal Eigenvalue Problem

NUMERICAL COMPUTATION IN SCIENCE AND ENGINEERING

Last Time. Social Network Graphs Betweenness. Graph Laplacian. Girvan-Newman Algorithm. Spectral Bisection

THE RELATION BETWEEN THE QR AND LR ALGORITHMS

What is the meaning of the graph energy after all?

Cyclic Reduction History and Applications

A New Block Algorithm for Full-Rank Solution of the Sylvester-observer Equation.

The Scaling and Squaring Method for the Matrix Exponential Revisited. Nicholas J. Higham

QUADRATURES INVOLVING POLYNOMIALS AND DAUBECHIES' WAVELETS *

216 S. Chandrasearan and I.C.F. Isen Our results dier from those of Sun [14] in two asects: we assume that comuted eigenvalues or singular values are

Math 405: Numerical Methods for Differential Equations 2016 W1 Topics 10: Matrix Eigenvalues and the Symmetric QR Algorithm

Reduced Synchronization Overhead on. December 3, Abstract. The standard formulation of the conjugate gradient algorithm involves

Linearized methods for ordinary di erential equations

Research CharlieMatters

Transcription:

Computing the Logarithm of a Symmetric Positive Denite Matrix Ya Yan Lu Department of Mathematics City University of Hong Kong Kowloon, Hong Kong Abstract A numerical method for computing the logarithm of a symmetric positive denite matrix is developed in this paper. It is based on reducing the original matrix to a tridiagonal matrix by orthogonal similarity transformations and applying Pade approximations to the logarithm of the tridiagonal matrix. Theoretical studies and numerical experiments indicate that the method is quite ecient when the matrix is not very ill-conditioned. Introduction In this paper, we describe a new method for computing the logarithm of a real symmetric positive denite matrix. The standard method for computing a matrix function (logarithm included) of a symmetric matrix is to use the spectral decomposition A = V V T ; () where is the diagonal matrix of the eigenvalues, V is the orthogonal matrix of the corresponding eigenvectors. The matrix function, say ln(a), is then given by ln(a) = V ln()v T : (2) The computation of the eigenvalues and eigenvectors is a relatively expensive step. The number of required arithmetic operations is around 9n 3 [9]. After calculating the spectral decomposition (), about n 3 additional operations are required to compute ln(a) by Equation (2). This has taken into account the fact that the matrix function ln(a) is also symmetric, and it is only necessary to calculate its lower or upper triangular part. Therefore, the total number of arithmetic operations is around 0n 3. The situation is more complicated for a non-symmetric matrix. A number of methods have been developed [4, 7]. Typically, the computation is based on the Schur decomposition of the matrix [7]. Pade approximations can also be used [4]. The purpose of this paper is to develop a special method for symmetric positive denite matrices that avoids the computation of the spectral decomposition. Our method This research was partially supported by the CityU research grant #9030458.

for computing ln(a) requires about 0n 3 =3 + 5n 2 m=2 operations, where m is an integer that depends on the desired accuracy and the spectral condition number of the p p matrix A. An upper bound for m is 4 4 ln( =). When the matrix A is not very illconditioned, the new method is more ecient than the spectral decomposition method above. It turns out that the new method is also much easier for parallel implementation. Our method is based on the Pade approximation of ln( + x). It is, however, quite dierent from a straight forward evaluation of the rational function (the Pade approximant) of the matrix. We rst use orthogonal similarity transformations to reduce the matrix A to a tridiagonal matrix T, then use the prime fraction form of a diagonal Pade approximant of ln( + x) to approximate ln(t ). The [m=m] diagonal Pade approximant of ln( + x) can be written as ln( + x) = x + b (m) x ; (3) where, b (m) are the weights and nodes of the Gauss-Legendre quadrature formula on (0; ). For a symmetric tridiagonal matrix X, the matrix P m = a(m) (I + b (m) X)? X can be evaluated in about 5n 2 m=2 operations. We also scale the matrix T by and write T= as I + X. It turns out the = p n (where, n are the largest and smallest eigenvalues of A) is the best choice for minimizing the error. Fortunately, and n can be easily calculated when T is available. For any given error tolerance, we also nd the minimum integer m, such that the [m=m] diagonal Pade approximant satises the accuracy requirement. The details of our method will be presented in section 3. In the next section, we discuss some useful properties of the diagonal Pade approximants of ln(+x). Numerical examples are presented in section 4. We end our paper with a short discussion in the last section. 2 Diagonal Pade approximants of ln( + x) The function ln( + x) has the following continued fraction expansion [, 3] where c = ; c 2 = ln( + x) = 2(2? ) ; c 2+ = c x + c 2x + c 3 x + c 4 x +::: 2(2 + ) ; for = ; 2; 3; :::: (4) The expansion is valid for any x in the complex plane, except for real x satisfying x?. The k-th approximant c x f k (x) = c + 2 x +... +c k x 2

matches the rst k derivatives of ln( + x), that is d f k (x) dx x=0 = d ln( + x) dx x=0 for = ; 2; :::; k: If k is an even integer, say k = 2m, it is clear that f k (x) = p m (x)=q m (x), where p m (x), q m (x) are polynomials of degree m. This is exactly the [m=m] diagonal Pade approximant of ln( + x). Gauss [8] used the continued fraction of ln[( + x)=(? x)] to derive the quadrature formulas on the interval (?; ). For the unit interval (0; ), the corresponding function is ln( + x). We have Lemma The [m=m] diagonal Pade approximant f 2m (x) has the following prime fraction form f 2m (x) = = x + b (m) x where, b (m) are the weights and nodes of the m-point Gauss-Legendre quadrature formula on (0; ). In [7], a proof is given for the above result that links the approximant f 2m with the application of the Gauss-Legendre quadrature to the integral representation of ln( + x). Z 0 x dt = ln( + x): + xt Since the m-point Gauss-Legendre quadrature formula on (0; ) Z 0 F (t) dt = ; F (b (m) ) is exact for polynomials of degree less than 2m, we have = (b (m) ) i? = This gives rise to the expansion = Z 0 x + b (m) x t i? dt = ; for i = ; 2; :::; 2m: i =? 2 i= (?x) i + ::: i that matches the Taylor expansion of ln( + x) for the rst 2m terms. Let r (m) be the zeros of the Legendre polynomial of degree m, we have b (m) = (r (m) + )=2: The zeros of Legendre polynomials are pairs of real numbers with opposite signs within the interval (?; ), except the zero 0 when the degree is an odd integer. If we order fb (m) g as an increasing sequence, we have b (m) + b (m) m?+ = ; = m?+ for = ; 2; :::; b m c. If m is odd, then b(m) = =2: With these properties, if we group 2 (m+)=2 the two terms with indexes and m? + together for the expression P m = a(m) x=( + b (m) x), it is easy to verify that the following lemma is true. 3

Lemma 2 The diagonal Pade approximant of ln(+x) preserves the logarithmic identity ln y =? ln(=y) for any y > 0. Namely, f 2m (y? ) =?f 2m y?! : Let the error of the m-th diagonal Pade approximant be E m (x) = ln( + x)? f 2m (x) = ln( + x)? We establish the following result = x + b (m) x : Lemma 3 The error E m (x) is an increasing function of x satisfying E m (x) 8 >< >: < 0 if? < x < 0 = 0 if x = 0 > 0 if x > 0. Proof: An exact formula of the error has been found by Kenney and Laub [4]: E m (x) =? my = + b (m) + b (m) x X n=2m (n? m)! 2 (n + )!(n? 2m)! (?x)n+ : Since b (m) 2 (0; ), it is clear that for? < x < 0, E m (x) is a negative and increasing function of x. For x > 0, we let x = y? for y > and observe that from Lemma 2,! E m (y? ) =?E m y? : Since =y? is negative, we obtain that E m (x) is a positive increasing function of x for x > 0. Related to the approximation of ln(a), where A is a symmetric positive denite matrix, we consider the approximation of ln for 0 < n < <, where, n are two positive constants. For a given small positive constant, we determine the smallest integer m, such that s ln( + )? f 2m () ; for =? > 0; (5) n then approximate ln by ln = ln! q q n p = ln n + ln( + x) n 2 ln( n ) + We have the following theorem = x + b (m) x ; for x = p? : n 4

Theorem For given > n > 0 and > 0, if condition (5) is satised for some positive integer m, then ln? 2 ln( n )? = x + b (m) x ; for n ; where and b (m) are the weights and nodes of the m-point Gauss-Legendre quadrature formula on (0; ), and x = = p n?. Proof: We have introduced a scaling factor = p n, so q that the approximation of ln q for 2 [ n ; ] becomes the approximation of ln(+x) for n =? x = n?. From Lemma 3, it is clear that the maximum of E m (x) on the interval is reached at the two end points and it is less than or equal to because of condition (5) and Lemma 2. This concludes our proof. To determine the minimum integer m, such that (5) is satised, we use the forward recurrence formula [3] for evaluating continued fraction approximants. We have f k () = k = k and " # 0 = 0 " # 0 ; " # " c = # ; " # = " # " #??2 + c??2 for 2, where the continued fraction expansion coecients are given in (4). (6) 3 The new method The new method in this section for computing ln(a) is quite similar to our method [6] for p A, where A is a symmetric positive denite matrix. It starts with an orthogonal reduction to a tridiagonal matrix T, then applies Pade approximations. The matrix T is written as T = (I + X) for some and ln(i + X) is approximated by P m = a(m) (I + b (m) X)? X. The main dierences are related to the scaling parameter, the integer m and the coecients f ; b (m) g. For p A, the coecients have simple explicit formulas, while for ln(a), these coecients are the weights and nodes of the m-point Gauss-Legendre quadrature rule. With a given error tolerance, the scaling parameter and the integer m are determined from and the extreme eigenvalues of A (also of T ). For ln(a), we have the exact formula = p n and m can be calculated by a forward recurrence formula. For p A, both and m must be computed numerically. However, they can be determined from the solution of a nonlinear equation in one variable. Our method calculates the approximation S m to ln(a) for a given error tolerance, such that ln(a)? S m 2 ; (7) where 2 is the matrix 2-norm. It involves the following steps:. Reduce the matrix A to a tridiagonal matrix T by orthogonal similarity transformations, i.e., A = QT Q T, where Q is an orthogonal matrix. 5

2. Calculate the largest and smallest eigenvalues of T, say, > n > 0, where n is the size of the matrix A. 3. Determine the minimum integer m such that! 2 ln? 2m ; (8) n 2m where f 2m ; 2m g are calculated from (6), with = q = n?. 4. Compute the weights f g and nodes fb (m) g of the m-point Gauss-Legendre quadrature formula on (0,): 5. Evaluate R m given by: R m = = Z 0 f(x) dx = f(b (m) ): (I + b (m) X)? X; for X = p n T? I: 6. Evaluate S m for the approximation of ln(a): S m = 2 ln( n ) I + QR m Q T : (9) The rst step is a standard procedure for calculating all the eigenvalues (and eigenvectors) of a symmetric matrix [9]. When the matrix A is dense, Householder reectors can be used. The number of operations required in this step is about 4n 3 =3. In our implementation, this step is a simple call to the LAPACK [2] routine xsytrd. The second step involves the calculation of the two extreme eigenvalues of T. It requires O(n) operations, if the bisection method is used. We call the LAPACK routine xstebz in our program. The third step is to nd the minimum integer m satisfying the condition (5), i.e. (8), based on the forward recurrence formula (6). The number of operations required in this step is O(m). The following scaling has been used to avoid over-ow: := =? ; := =? ;? :=? =? ;? := : This procedure appears to be numerically stable. Theoretically, the sequence f = g converges to ln( + ). In practice, we observe that the calculated values are always close to ln( + ) even when is large. However, when is large and is small, the small error in the numerically computed value of = could lead to a dierent m. For example, a single precision algorithm for Step 3 gives m = 07 for = 0 6 and = 0?5. Actually, m should be 05. 6

In Step 4, we determine the weights and nodes of the m-point Gauss-Legendre quadrature formula on (0; ). This can be achieved in O(m 2 ) operations [6]. An ecient routine can be found in [7]. We assume that the nodes are ordered as 0 < b (m) < b (m) 2 < ::: < b (m) m < : Step 5 involves the summation of the matrices Y satisfying (I + b (m) X)Y = X for = ; 2; :::; m: Since the matrix Y is symmetric and the right hand side above is a tridiagonal matrix, it is possible to calculate Y in about 2n 2 operations. The total number of operations required in this step is 5=2 n 2 m, because there are m such matrices and one has to add them together. Since b (m) 2 (0; ) and T is positive denite, it is easy to see that I + b (m) X is also positive denite. In fact, I + b (m) X = (? b (m) )I + b(m) p T = b (m) n The spectral condition number of I + b (m) X is m?+ I + = b(m) m?+ + b (m) p b (m) m?+ + b (m) = p ; where = = n : b(m) p n T: It is clear that is always less than and it increases when increases. If is not close to m, we have = O( p ). For large and large m (so that the error is less than a given tolerence), we have b (m) c m 2 ; b(m) m? c m 2 and m + c p =m 2 where c is some positive constant. In section 4, an upper bound for m is derived which is O( 4p ln( p =)) for large. It seems from numerical experiments that it is also the correct asymptotic formula for m. If that is the case, we have m = O(). This indicates that when the matrix A is ill-conditioned, we will not be able to calculate Y accurately if is close or equal to m. However, the magnitude of Y is related to the coecient which is small when is close or equal to m. Therefore, it is more natural to consider the absolute errors in Y and compare the sum of these errors with the sum of Y (i.e. R m ). For this purpose, we consider a small perturbation to the right hand side of the equation of Y. That is (I + b (m) X)(Y + Y ~ ) = (X + X): ~ We have ~R m = = ~Y = = (I + b (m) X)? X: ~ 7

This gives rise to ~ R m 2 (m; ) ~ X 2 ; where (m; ) = = b (m) m?+ + b (m) = p : The number is quite small. As an example, we consider = 0 6 and = 0?5. This leads to m = 05 and = 6:9466. Therefore, the error Rm ~ is still quite small, if X ~ is small. Let us assume that X ~ is O(uX 2 ) = O(u p ), where u is the unit round o. Then, we can at best hope that R ~ m = O(u p ). Since R m ln(i + X), we have R m 2 = O(ln p ). Therefore, Rm ~ could be large compared with R m. This suggests that we may not be able to obtain good relative accuracy when the matrix A is illconditioned, even though the absolute error could be O(u p ). However, this also applies to the standard method based on the spectral decomposition. If the small eigenvalues are not calculated to high relative accuracy, we can not expect the obtained result for ln(a) to be accurate. Consider the special case where the matrix A has = p and n = = p. If an error of O(u p ) = O(uA 2 ) is introduced to n, then the smallest eigenvalue becomes n ( + ), where = O(u). Assuming u is still small, this gives rises to the error term ln( + ). Therefore, we might have O(u) errors in the approximation of ln(a), while the 2-norm of ln(a) is ust ln p. When the matrix A is reduced to the tridiagonal matrix T in step, the matrix Q is obtained as a sequence of Householder reectors. To compute QR m Q T, we multiply the reectors from both the left and the right sides following the reversed sequence. Using similar techniques as in the reduction step, the matrix QR m Q T can be calculated in 2n 3 operations. The matrix S m is obtained by adding the diagonals by ln = 2 ln( n ). Our method is dominated by step, 5 and 6. The leading terms of the total number of operations are 0 3 n3 + 5 2 n2 m. The time spent on the other steps is q negligible. q Since the eigenvalues of the symmetric matrix X lie in the interval [ n =?; = n? ], from Theorem, we have ln(i + X)? This gives rise to Equation (7). = (I + b (m) X)? X 2 : 4 An upper bound For a given error tolerance, the third step of our method determines the minimum integer m, such that condition (5), i.e., ln( + )? f 2m () is satised, where = q = n? and f 2m () is the [m=m] diagonal Pade approximant of ln( + ). In the actual implementation, we use the forward recurrence formula [3] 8

of the continued fraction of ln( + ) and calculate f 2 () for = ; 2; :::. The minimum integer m satisfying (5) can be easily found. When the integer m is calculated, we can decide whether to use the method developed in this paper instead of the standard method based on the spectral decomposition, by comparing the required numbers of operations of the two methods. If m is too large for the new method to have any advantage, we can continue the spectral decomposition method. The rst step of orthogonal reduction to a tridiagonal matrix is not wasted, since it is needed in both cases. An estimate for the minimum integer m for the given and = = n is useful, it allows us to determine the number of arithmetic operations required by this method without going through the calculation of f 2m (). It also gives us a general idea on when the new method is suitable if the size of the matrix n, the error tolerance and the spectral condition number are known. In this section, we derive an upper bound for the minimum m satisfying (5). Unfortunately, the upper bound is still not very tight. As a special case of the general error estimate established by Gragg [0] for g-fractions, the continued fraction of ln( + x)=x satises ln( + x)? F n (x) x x + x? p + x + p + x n? for x > 0, where F n (x) = c + c 2 x : + c 3 x +::: +cnx Notice that F 2m (x) = f 2m (x)=x. Now, for x = = p?, we have ln( + )? f 2m () (p? ) 2 p 4? 2m? p p + An upper bound m for the minimum m is established, if we let This gives rise to For large, we have ( p? ) 2 p 4? 2m? p p = : 4 + h m = ln p i p (?) 2 4 2 ln p +? 4p 2 : + m p 4 4 ln p! 4 : (0) In Figure, we plot the actual minimum integer m and the upper bound m for up to 0 8 and = 0?5. We realize that m over-estimates the minimum m by more than 50% for large. Therefore, the upper bound m can only be used for a rough estimate of the total number of required operations. 9

600 500 400 m 300 200 00 epsilon=.0e 5 0 0 2 3 4 5 6 7 8 9 0 kappa x 0 7 Figure : The minimum m and upper bound m for = 0?5. 5 Numerical examples In this section, we demonstrate the accuracy and eciency of the new method by numerical examples. We choose = ln(a) 2, where = 0?5 is the relative error tolerance in the matrix 2-norm. Since the extreme eigenvalues of A are calculated in step 2, the 2-norm of ln(a) can be obtained without any extra work. The integer m calculated in step 3 depends on = = n and. However, its values are typically smaller than the size of the matrix n. This is consistent with the theoretical result in section 4 that its dependence on is mainly 4p. Our numerical results are calculated in single precision, then compared with the double precision \exact" solutions obtained from the standard spectral decomposition method. The following notations are used for the relative errors in various matrix norms: e f = ln(a)? S m f ln(a) f ; e = ln(a)? S m ln(a) ; e 2 = ln(a)? S m 2 ln(a) 2 : We also calculate the relative errors for the single precision solutions obtained from the spectral decomposition method (based on the same double precision \eaxct" solutions). These relative errors are denoted by s f, s and s 2. The numerical experiments are carried out on a SUN Ultra (model 70) workstation. 0

Example : The n n matrix is A = (a i ), where a i = 2 + (i? ) 2 : As we can see from the following table, the integer m is quite small for = 0?5. The relative errors in dierent matrix norms are listed in the table for various values of n. Theoretically, the entries in the e 2 column should be less than or equal to. This has n m e f e e 2 s f s s 2 5 6 3.4E-06 3.7E-06 3.6E-06 6.8E-07.0E-06 8.6E-07 0 7.7E-06 2.9E-06 2.2E-06 5.0E-07 9.7E-07 6.5E-07 20 7 2.8E-06 6.4E-06 4.7E-06.2E-06 4.0E-06 2.9E-06 50 7 3.6E-06 9.8E-06 6.7E-06.2E-06 5.0E-06 2.4E-06 00 7 4.0E-06.3E-05 8.0E-06.7E-06 9.3E-06 4.2E-06 50 7 4.0E-06.6E-05 8.2E-06 2.0E-06.6E-05 5.4E-06 200 7 4.4E-06 2.2E-05 9.5E-06 2.5E-06 2.3E-05 7.5E-06 300 7 4.5E-06 3.0E-05.E-05 3.E-06 3.2E-05.2E-05 400 7 4.9E-06 3.6E-05.E-05 3.7E-06 4.3E-05.4E-05 500 7 5.E-06 4.4E-05.5E-05 4.2E-06 5.5E-05.9E-05 Table : Example relative errors for approximating ln(a) by the Pade method with = 0?5 and the standard method, both calculated in single precision. not been the case for n 300, due to roundo errors. Nevertheless, our numerical results have the same level of accuracy as the single precision solutions calculated by the standard spectral decomposition method when n is not small. In fact, our numerical approximations are often more accurate than the solutions obtained by the standard method. For small n, we can easily increase the accuracy of our solutions by decreasing the relative error tolerance. As an example, for n = 0 and = 0?6, we have m = 8; e f = 3.2E-07; e = 6.4E-07; e 2 = 4.E-07: Example 2: The n n matrix A is obtained from a second order nite dierence discretization of the negative Laplacian on a unit square with Dirichlet boundary conditions. The (i; ) entry is given by a i = 8 >< >: 4 if i =,? if i? = p;? if i? = and (i + ) mod (2p) 6=, 0 otherwise, where n = p 2. From the studies in section 4, we know that m is mainly proportional to p 4. Since the condition number of this matrix is known to be proportional to n2, we

n m e f e e 2 s f s s 2 4 3 2.6E-06 2.7E-06 2.8E-06 2.3E-07 4.6E-07 3.5E-07 6 5.E-06 2.0E-06 2.E-06 5.4E-07 8.4E-07 6.9E-07 36 6.7E-06 3.8E-06 4.E-06 8.5E-07.8E-06.E-06 64 7.6E-06 4.3E-06 4.2E-06.4E-06 3.9E-06 3.4E-06 00 8.7E-06 5.E-06 5.E-06 2.2E-06 7.E-06 9.0E-06 44 9.6E-06 5.2E-06 4.5E-06 2.0E-06 6.5E-06 5.9E-06 96 9 3.E-06.E-05 8.4E-06 2.8E-06.3E-05.E-05 256 0 2.6E-06.2E-05 8.0E-06 4.4E-06 2.2E-05 2.8E-05 324 0 4.2E-06.6E-05 8.3E-06 4.2E-06 2.E-05 2.0E-05 400 3.2E-06.3E-05 5.6E-06 4.E-06 2.E-05 2.0E-05 484 4.9E-06.9E-05 8.9E-06 4.8E-06 2.6E-05.8E-05 Table 2: Example 2 relative errors for approximating ln(a). have 4p p. It is clear from Table 2 that the integer m is indeed quite small compared with n, or even with p n = p. The relative errors of the two methods are also listed in that table for the given relative error tolerance = 0?5. We observe that the entries in the e 2 column are less than, consistent with the theoretical result (7). From Table 2, it is clear that with this moderate choice of, our numerical solutions have already achieved the same level of accuracy as the full (but single) precision solutions calculated by the standard method. For small n, the accuracy of our solutions can be improved by choosing a smaller. Here are the rst two cases for = 0?6 : n = 4; m = 4; e f =.3E-07; e =.9E-07; e 2 =.8E-07 n = 6; m = 6; e f = 3.6E-07; e = 7.0E-07; e 2 = 4.8E-07: Example 3: We consider the matrix A = BB T, where the entries of B are random numbers from the uniform distribution on [?=2; =2]. In Table 3, the relative errors for the approximate solutions of ln(a) are listed for eleven 0000 random matrices. These eleven cases are ordered according to their spectral condition numbers. The integer m is related to and, but (equals ln(a) 2 ) also depends the extreme eigenvalues. Therefore, for the given = 0?5, two matrices with the same spectral condition number could have dierent values of m. From Table 3, we observe that our method gives more accurate solutions for 6 matrices out of the total of. In some cases, the numerical solutions by both methods do not have a good relative accuracy. In all these calculations, our method is faster than the standard procedure (in single precision). The latter is implemented with a call to the LAPACK routine xsyev for the spectral decomposition () and a routine for evaluating ln(a) from Equation (2) which requires n 3 operations. A signicant reduction in the total execution time is observed for 2

m e f e e 2 s f s s 2 8648. 28.5E-05 2.8E-05 5.0E-05 2.6E-05 5.9E-05 8.3E-05 2806.4 35 3.9E-05 7.5E-05.3E-04 3.2E-05 5.7E-05 9.5E-05 38706.3 40.E-04 2.E-04 3.4E-04 2.3E-04 4.6E-04 7.4E-04 38786. 40 3.5E-05 6.3E-05 8.6E-05 3.0E-05 5.9E-05 8.5E-05 39948.7 40 4.2E-05 7.5E-05.3E-04 4.0E-05 6.2E-05.E-04 74009.5 46 8.2E-05.5E-04 2.4E-04 2.6E-04 5.0E-04 7.9E-04 80962.2 47 3.7E-05 7.4E-05.0E-04.4E-04 2.5E-04 4.0E-04 9775. 52 2.5E-04 5.2E-04 7.2E-04 6.7E-05.4E-04.8E-04 67589. 56 5.E-05 7.6E-05.E-04.5E-04 2.7E-04 3.9E-04 269835. 63 4.3E-04 7.2E-04.E-03.0E-03.9E-03 2.8E-03 444287. 7 2.7E-05 5.5E-05 6.3E-05 3.8E-04 7.9E-04 9.6E-04 Table 3: Example 3 relative errors for random matrices. the rst two examples. In the following table, we list the total execution time in seconds required by the two methods. For the matrices in Example 3, the standard method Example 2 2 2 2 2 n 00 200 300 400 500 00 96 289 400 484 T new 0.05 0.27 0.83 2.03 4.95 0.05 0.25 0.76 2.0 4.29 T old 0.2 0.88 2.90 7.07 4.84 0.2 0.79 2.28 6.5 2.74 Table 4: Execution time in seconds for Example and 2 by the new method (T new ) and the spectral decomposition method (T old ). requires about 0.3 seconds. Our method requires 0.065 to 0.0 seconds depending on the value of m. These results are obtained on a SUN Ultra (model 70) workstation using the compiler f77 (version 4.0) from SUN Microsystems. All programs including LAPACK are compiled with the option \-fast". 6 Conclusion We have developed and implemented a new method for calculating the logarithm of a symmetric positive denite matrix in this paper. When the matrix is not very illconditioned, the new method is more ecient than the standard approach based on the spectral decomposition. The total number of operations required by the new method is 0 3 n3 + 5 2 mn2, where m depends on the spectral condition number and the desired accuracy. An upper bound for m is 4p =4 ln( p =). This compares favorably with the spectral decomposition method which requires about 0n 3 operations, when the condition 3

number if not very large. Theoretically, the approximation S m satises the condition ln(a)? S m 2. References [] Lambert, J. H., \Memoire sur quelques proprietes remarquables des quantites transcendantes circulaires et logarithmiques," Memoires de l'acad. de Berlin, Annee 76, 265-322, 768. [2] Anderson, E., Bai, Z., Bischof, C., Demmel, J., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., Ostrouchov, S. & Sorensen, D., LAPACK Users' Guide, SIAM, 992. [3] Baker, Jr., G. A. & Graves-Morris, P., Pade Approximations, 2nd edition, Cambridge University Press, 996. [4] Borck, A. & Hammarling S., \A Schur method for the square root of a matrix", Linear Algebra Appl. 52/53, 27-40, 983. [5] Dieci, L., \Considerations on computing real logarithms of matrices, Hamiltonian logarithms, and skew-symmetric logarithms", Linear Algebra Appl., 244, 35-54, 996. [6] Davis, P. J. & Rabinowitz, P., Methods of Numerical Integration. 2nd ed. New York, Academic Press, 984. [7] Dieci, L., Morini, B. & Papini, A., \Computing techniques for real logarithms of matrices", SIAM J. Matrix Anal. Appl., 7, 570-593, 996. [8] Gauss, C. F., \Methodus nova integralium valores per approximationem inveniendi", (84); Werke, Vol. 3, Gottingen, 65-96, 876. [9] Golub, G. H. & Van Loan C. F., Matrix Computations, 2nd edition, The Johns Hopkins University Press, 989. [0] Gragg, W. B., \Truncation error bounds for g-fractions", Numer. Math.,, 370-379, 068. [] Higham, N.J., \Newton's method for the matrix square root", Math. Comp. 46, 537-550, 986. [2] Higham, N.J., \Computing real square roots of a real matrix", Linear Algebra Appl. 88/89, 405-430, 987. [3] Jones, W. B. & Thron, W. J., Continued Fractions, Aanlytic Theory and Applications, Addison-Wesley Publishing Company, 980. 4

[4] Kenney, C. & Laub, A. L., \Pade error estimates for the logarithm of a matrix", Int. J. Control, 50, 707-730, 989. [5] Kenney, C. & Laub, A. L., \Condition estimates for matrix functions", SIAM J. Matrix Anal. Appl., 0, 9-209, 989. [6] Lu, Y. Y., \A Pade approximation method for square roots of symmetric positive denite matrices", submitted to SIAM J. Matrix Anal. Appl. [7] Press, W. H., Flannery, B. P., Teukolsky, S. A. & Vetterling, W. T., Numerical Recipes in C, Cambridge University Press, 988. [8] Stickel, E. U., \Fast computation of matrix exponential and logarithm", Analysis, 5, 63-73, 985. [9] Stickel, E. U., \An algorithm for fast high precision computation of matrix exponential and logarithm", Analysis, 0, 85-95, 990. 5