NAG Fortran Library Routine Document F04CFF.1

Similar documents
NAG Library Routine Document F07HAF (DPBSV)

NAG Library Routine Document F02HDF.1

NAG Library Routine Document F08UBF (DSBGVX)

NAG Library Routine Document F08FNF (ZHEEV).1

NAG Library Routine Document F08FAF (DSYEV)

NAG Library Routine Document F08FPF (ZHEEVX)

NAG Library Routine Document F08YUF (ZTGSEN).1

NAG Library Routine Document F08VAF (DGGSVD)

NAG Library Routine Document F08PNF (ZGEES)

NAG Library Routine Document F08JDF (DSTEVR)

NAG Library Routine Document F08QVF (ZTRSYL)

NAG Library Routine Document F08ZFF (DGGRQF).1

NAG Library Routine Document F08QUF (ZTRSEN)

F08BEF (SGEQPF/DGEQPF) NAG Fortran Library Routine Document

NAG Fortran Library Routine Document D02JAF.1

NAG Library Routine Document D02JAF.1

F04JGF NAG Fortran Library Routine Document

G03ACF NAG Fortran Library Routine Document

G01NBF NAG Fortran Library Routine Document

NAG Toolbox for Matlab nag_lapack_dggev (f08wa)

Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents

G13CCF NAG Fortran Library Routine Document

NAG Library Routine Document C02AGF.1

G13DSF NAG Fortran Library Routine Document

G13DCF NAG Fortran Library Routine Document

G13BAF NAG Fortran Library Routine Document

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

G13CGF NAG Fortran Library Routine Document

G13BHF NAG Fortran Library Routine Document

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

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

D02TYF NAG Fortran Library Routine Document

D03PEF NAG Fortran Library Routine Document

LAPACK-Style Codes for Level 2 and 3 Pivoted Cholesky Factorizations. C. Lucas. Numerical Analysis Report No February 2004

G13DJF NAG Fortran Library Routine Document

NAG Toolbox for Matlab. g03aa.1

NAG C Library Function Document nag_dtrevc (f08qkc)

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

Aasen s Symmetric Indefinite Linear Solvers in LAPACK

Computing least squares condition numbers on hybrid multicore/gpu systems

Generalized interval arithmetic on compact matrix Lie groups

NAG Fortran Library Routine Document D02KDF.1

NAG Library Routine Document D02KDF.1

Exponentials of Symmetric Matrices through Tridiagonal Reductions

NAG Toolbox for MATLAB Chapter Introduction. F02 Eigenvalues and Eigenvectors

Intel Math Kernel Library (Intel MKL) LAPACK

Symmetric Pivoting in ScaLAPACK Craig Lucas University of Manchester Cray User Group 8 May 2006, Lugano

NAG Fortran Library Routine Document D01BBF.1

Implementation for LAPACK of a Block Algorithm for Matrix 1-Norm Estimation

Unsupervised Data Discretization of Mixed Data Types

Porting a Sphere Optimization Program from lapack to scalapack

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

More Gaussian Elimination and Matrix Inversion

Stability of a method for multiplying complex matrices with three real matrix multiplications. Higham, Nicholas J. MIMS EPrint: 2006.

Week6. Gaussian Elimination. 6.1 Opening Remarks Solving Linear Systems. View at edx

A hybrid Hermitian general eigenvalue solver

Algebraic Equations. 2.0 Introduction. Nonsingular versus Singular Sets of Equations. A set of linear algebraic equations looks like this:

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

7.5 Operations with Matrices. Copyright Cengage Learning. All rights reserved.

arxiv: v1 [math.na] 7 May 2009

A.l INTRODUCTORY CONCEPTS AND OPERATIONS umnx, = b, az3z3 = b, i = 1,... m (A.l-2)

CVXOPT Documentation. Release 1.2. Martin S. Andersen, Joachim Dahl, and Lieven Vandenberghe

Computation of a canonical form for linear differential-algebraic equations

Lecture 13 Stability of LU Factorization; Cholesky Factorization. Songting Luo. Department of Mathematics Iowa State University

The LINPACK Benchmark in Co-Array Fortran J. K. Reid Atlas Centre, Rutherford Appleton Laboratory, Chilton, Didcot, Oxon OX11 0QX, UK J. M. Rasmussen

Testing Linear Algebra Software

COMPUTING THE CONDITION NUMBER OF TRIDIAGONAL AND DIAGONAL-PLUS-SEMISEPARABLE MATRICES IN LINEAR TIME

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

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

Matrix operations Linear Algebra with Computer Science Application

Module 10.1: nag polynom eqn Roots of Polynomials. Contents

Theoretical Computer Science

Numerical Solution of Generalized Lyapunov Equations. Thilo Penzl. March 13, Abstract

Linear Algebra and Matrices

Numerical Linear Algebra

MPI Implementations for Solving Dot - Product on Heterogeneous Platforms

Matrix Basic Concepts

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

3.2 Gaussian (Normal) Random Numbers and Vectors

Syntax Description Remarks and examples Conformability Diagnostics References Also see. symeigenvalues(a)

NAG Library Chapter Introduction. f08 Least-squares and Eigenvalue Problems (LAPACK)

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

Direct Methods for Matrix Sylvester and Lyapunov Equations

Review Questions REVIEW QUESTIONS 71

LAPACK Introduction. Zhaojun Bai University of California/Davis. James Demmel University of California/Berkeley

Numerical Linear Algebra

Gaussian Elimination and Back Substitution

Introduction to Matrices

D01BBF NAG Fortran Library Routine Document

On aggressive early deflation in parallel variants of the QR algorithm

Parallel tools for solving incremental dense least squares problems. Application to space geodesy. LAPACK Working Note 179

Matrices. Chapter Definitions and Notations

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

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

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

Numerical Linear Algebra

Scientific Computing: An Introductory Survey

Section 4.5 Eigenvalues of Symmetric Tridiagonal Matrices

CS412: Lecture #17. Mridul Aanjaneya. March 19, 2015

On a quadratic matrix equation associated with an M-matrix

Transcription:

F04 Simultaneous Linear Equations NAG Fortran Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details. Purpose computes the solution to a complex system of linear equations AX ¼ B, where A is an n by n Hermitian positive-definite band matrix of band width 2k þ, and X and B are n by r matrices. An estimate of the condition number of A and an error bound for the computed solution are also returned. 2 Specification SUBROUTINE (UPLO, N, KD, NRHS, AB, LDAB, B, LDB, RCOND, ERRBND, IFAIL) INTEGER N, KD, NRHS, LDAB, LDB, IFAIL double precision RCOND, ERRBND complex6 AB(LDAB,), B(LDB,) CHARACTER UPLO 3 Description The Cholesky factorization is used to factor A as A ¼ U H U, if UPLO ¼ U,orA ¼ LL H, if UPLO ¼ L, where U is an upper triangular band matrix with k super-diagonals, and L is a lower triangular band matrix with k sub-diagonals. The factored form of A is then used to solve the system of equations AX ¼ B. 4 References Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (999) LAPACK Users Guide (3rd Edition) SIAM, Philadelphia URL: http://www.netlib.org/lapack/lug Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia 5 Parameters : UPLO CHARACTER Input On entry: if UPLO ¼ U, the upper triangle of the matrix A is stored, if UPLO ¼ L, the lower triangle of the matrix A is stored. Constraint: UPLO ¼ UorL. 2: N INTEGER Input On entry: the number of linear equations n, i.e., the order of the matrix A. Constraint: N 0. 3: KD INTEGER Input On entry: the number of super-diagonals k (and the number of sub-diagonals) of the band matrix A. Constraint: KD 0..

NAG Fortran Library Manual 4: NRHS INTEGER Input On entry: the number of right-hand sides r, i.e., the number of columns of the matrix B. Constraint: NRHS 0. 5: ABðLDAB,Þ complex6 array Input/Output Note: the second dimension of the array AB must be at least maxð; NÞ. On entry: the n by n symmetric band matrix A. The upper or lower triangular part of the Hermitian matrix is stored in the first KD þ rows of the array. The jth column of A is stored in the jth column of the array AB as follows: if UPLO ¼ U, ABðk þ þ i jjþ ¼ a ij for maxð;j kþ i j; if UPLO ¼ L, ABð þ i jjþ ¼ a ij for j i minðn; j þ kþ. See Section 8 below for further details. On exit: ififail ¼ 0orN þ, the factor U or L from the Cholesky factorization A ¼ U H U or A ¼ LL H, in the same storage format as A. 6: LDAB INTEGER Input On entry: the first dimension of the array AB as declared in the (sub)program from which is called. Constraint: LDAB KD þ. 7: BðLDB,Þ complex6 array Input/Output Note: the second dimension of the array B must be at least maxð; NRHSÞ. To solve the equations Ax ¼ b, where b is a single right-hand side, B may be supplied as a one-dimensional array with length LDB ¼ maxð; NÞ. On entry: the n by r matrix of right-hand sides B. On exit: ififail ¼ 0orNþ, the n by r solution matrix X. 8: LDB INTEGER Input On entry: the first dimension of the array B as declared in the (sub)program from which is called. Constraint: LDB maxð; NÞ. 9: RCOND double precision Output On exit: ififail ¼ 0orNþ, an estimate of the reciprocal of the condition number of the matrix A, computed as RCOND ¼ = kak A. 0: ERRBND double precision Output On exit: ififail ¼ 0orNþ, an estimate of the forward error bound for a computed solution ^x, such that k^x xk =x k k ERRBND, where ^x is a column of the computed solution returned in the array B and x is the corresponding column of the exact solution X. If RCOND is less than machine precision, then ERRBND is returned as unity. : IFAIL INTEGER Input/Output On entry: IFAIL must be set to 0, or. Users who are unfamiliar with this parameter should refer to Chapter P0 for details. On exit: IFAIL ¼ 0 unless the routine detects an error (see Section 6). For environments where it might be inappropriate to halt program execution when an error is detected, the value or is recommended. If the output of error messages is undesirable, then.2

F04 Simultaneous Linear Equations the value is recommended. Otherwise, for users not familiar with this parameter the recommended value is 0. When the value or is used it is essential to test the value of IFAIL on exit. 6 Error Indicators and Warnings If on entry IFAIL ¼ 0or, explanatory error messages are output on the current error message unit (as defined by X04AAF). Errors or warnings detected by the routine: IFAIL < 0 and IFAIL 6¼ 999 If IFAIL ¼ i, the ith argument had an illegal value. IFAIL ¼ 999 Allocation of memory failed. The double precision allocatable memory required is N, and the complex6 allocatable memory required is 2 N. Allocation failed before the solution could be computed. IFAIL > 0 and IFAIL N If IFAIL ¼ i, the leading minor of order i of A is not positive-definite. The factorization could not be completed, and the solution has not been computed. IFAIL ¼ N þ RCOND is less than machine precision, so that the matrix A is numerically singular. A solution to the equations AX ¼ B has nevertheless been computed. 7 Accuracy The computed solution for a single right-hand side, ^x, satisfies an equation of the form ða þ EÞ^x ¼ b, where kek ¼ O ðþa k k and is the machine precision. An approximate error bound for the computed solution is given by k^x xk A ð Þ kek, kxk kak where A ð Þ ¼ A kak, the condition number of A with respect to the solution of the linear equations. uses the approximation kek ¼ A k k to estimate ERRBND. See Section 4.4 of Anderson et al. (999) for further details. 8 Further Comments The band storage scheme for the array AB is illustrated by the following example, when n ¼ 6, k ¼ 2, and UPLO ¼ U: On entry: a 3 a 24 a 35 a 46 a 2 a 23 a 34 a 45 a 56 a a 22 a 33 a 44 a 55 a 66.3

NAG Fortran Library Manual On exit: u 3 u 24 u 35 u 46 u 2 u 23 u 34 u 45 u 56 u u 22 u 33 u 44 u 55 u 66 Similarly, if UPLO ¼ L the format of AB is as follows: On entry: On exit: a a 22 a 33 a 44 a 55 a 66 a 2 a 32 a 43 a 54 a 65 a 3 a 42 a 53 a 64 l l 22 l 33 l 44 l 55 l 66 l 2 l 32 l 43 l 54 l 65 l 3 l 42 l 53 l 64 Array elements marked need not be set and are not referenced by the routine. Assuming that n k, the total number of floating-point operations required to solve the equations AX ¼ B is approximately nðkþ Þ for the factorization and 4nkr for the solution following the factorization. The condition number estimation typically requires between four and five solves and never more than eleven solves, following the factorization. In practice the condition number estimator is very reliable, but it can underestimate the true condition number; see Section 5.3 of Higham (2002) for further details. The real analogue of is F04BFF. 9 Example To solve the equations AX ¼ B, where A is the Hermitian positive-definite band matrix 0 9:39 :08 :73i 0 0 :08 þ :73i :69 0:04 þ 0:29i 0 A ¼ B C @ 0 0:04 0:29i 2:65 0:33 þ 2:24i A 0 0 0:33 2:24i 2:7 and 0 2:42 þ 68:42i 54:30 56:56i 9:93 þ 0:88i 8:32 þ 4:76i B ¼ B C @ 27:30 0:0i 4:40 þ 9:97i A. 5:3 þ 23:63i 9:43 þ :4i An estimate of the condition number of A and an approximate error bound for the computed solutions are also printed. 9. Program Text Note: the listing of the example program presented below uses bold italicised terms to denote precision-dependent details. Please read the Users Note for your implementation to check the interpretation of these terms. As explained in the Essential Introduction to this manual, the results produced may not be identical for all implementations. Example Program Text Mark 2 Release. NAG Copyright 2004... Parameters.. INTEGER NIN, NOUT (NIN=5,NOUT=6) INTEGER KDMAX, NMAX, NRHSMX (KDMAX=4,NMAX=8,NRHSMX=2).4

F04 Simultaneous Linear Equations INTEGER LDAB, LDB (LDAB=KDMAX+,LDB=NMAX) CHARACTER UPLO (UPLO= U ).. Local Scalars.. DOUBLE PRECISION ERRBND, RCOND INTEGER I, IERR, IFAIL, J, KD, N, NRHS.. Local Arrays.. COMPLEX 6 AB(LDAB,NMAX), B(LDB,NRHSMX) CHARACTER CLABS(), RLABS().. External Subroutines.. EXTERNAL, X04DBF.. Intrinsic Functions.. INTRINSIC MAX, MIN.. Executable Statements.. WRITE (NOUT,) Example Program Results WRITE (NOUT,) Skip heading in data file READ (NIN,) READ (NIN,) N, KD, NRHS IF (N.LE.NMAX.AND. KD.LE.KDMAX.AND. NRHS.LE.NRHSMX) THEN Read the upper or lower triangular part of the band matrix A from data file IF (UPLO.EQ. U ) THEN DO 20 I =, N READ (NIN,) (AB(KD++I-J,J),J=I,MIN(N,I+KD)) 20 CONTINUE ELSE IF (UPLO.EQ. L ) THEN DO 40 I =, N READ (NIN,) (AB(+I-J,J),J=MAX(,I-KD),I) 40 CONTINUE END IF Read B from data file READ (NIN,) ((B(I,J),J=,NRHS),I=,N) Solve the equations AX = B for X IFAIL = - CALL (UPLO,N,KD,NRHS,AB,LDAB,B,LDB,RCOND,ERRBND,IFAIL) IF (IFAIL.EQ.0) THEN Print solution, estimate of condition number and approximate error bound IERR = 0 CALL X04DBF( General,,N,NRHS,B,LDB, Bracketed, F7.4, + Solution, Integer,RLABS, Integer,CLABS,80,0, + IERR) WRITE (NOUT,) WRITE (NOUT,) Estimate of condition number WRITE (NOUT,99999).0D0/RCOND WRITE (NOUT,) WRITE (NOUT,) + Estimate of error bound for computed solutions WRITE (NOUT,99999) ERRBND ELSE IF (IFAIL.EQ.N+) THEN Matrix A is numerically singular. Print estimate of reciprocal of condition number and solution WRITE (NOUT,) WRITE (NOUT,) Estimate of reciprocal of condition number WRITE (NOUT,99999) RCOND WRITE (NOUT,).5

NAG Fortran Library Manual IERR = 0 CALL X04DBF( General,,N,NRHS,B,LDB, Bracketed, F7.4, + Solution, Integer,RLABS, Integer,CLABS,80,0, + IERR) ELSE IF (IFAIL.GT.0.AND. IFAIL.LE.N) THEN The matrix A is not positive definite to working precision WRITE (NOUT,99998) The leading minor of order, IFAIL, + is not positive definite END IF ELSE WRITE (NOUT,) + One or more of NMAX, KDMAX and NRHSMX is too small END IF STOP 99999 FORMAT (4X,P,E9.) 99998 FORMAT (X,A,I3,A) END 9.2 Program Data Example Program Data 4 2 :Values of N, KD and NRHS ( 9.39, 0.00) (.08, -.73) (.69, 0.00) ( -0.04, 0.29) ( 2.65, 0.00) ( -0.33, 2.24) ( 2.7, 0.00) :End of A (-2.42, 68.42) ( 54.30,-56.56) ( -9.93, 0.88) ( 8.32, 4.76) (-27.30, -0.0) ( -4.40, 9.97) ( 5.3, 23.63) ( 9.43,.4) :End of B 9.3 Program Results Example Program Results Solution 2 (-.0000, 8.0000) ( 5.0000,-6.0000) 2 ( 2.0000,-3.0000) ( 2.0000, 3.0000) 3 (-4.0000,-5.0000) (-8.0000, 4.0000) 4 ( 7.0000, 6.0000) (-.0000,-7.0000) Estimate of condition number.3e+02 Estimate of error bound for computed solutions.5e-4.6 (last)