NAG Fortran Library Routine Document F07AAF (DGESV).1

Similar documents
NAG Library Routine Document F07MAF (DSYSV).1

NAG Fortran Library Routine Document F04CAF.1

NAG Fortran Library Routine Document F04DHF.1

NAG Fortran Library Routine Document F04BJF.1

NAG Fortran Library Routine Document F04BGF.1

NAG Fortran Library Routine Document F04CJF.1

NAG Fortran Library Routine Document F08KAF (DGELSS).1

NAG Library Routine Document F04BEF.1

NAG Fortran Library Routine Document F08BHF (DTZRZF).1

F04EBFP.1. NAG Parallel Library Routine Document

NAG Library Routine Document F08FAF (DSYEV)

NAG Library Routine Document F08BVF (ZTZRZF)

NAG Fortran Library Routine Document F08FQF (CHEEVD=ZHEEVD).1

NAG Library Routine Document F08FDF (DSYEVR)

NAG Library Routine Document F08ASF (ZGEQRF).1

NAG Fortran Library Routine Document F01CTF.1

NAG Library Routine Document F08ZNF (ZGGLSE)

NAG Library Routine Document F08NGF (DORMHR).1

F02WUF NAG Fortran Library Routine Document

NAG Library Function Document nag_complex_gen_lin_solve (f04cac)

NAG Library Function Document nag_dspsv (f07pac)

NAG Library Function Document nag_dgttrs (f07cec)

NAG Fortran Library Routine Document F01CWF.1

NAG Library Function Document nag_complex_tridiag_lin_solve (f04ccc)

NAG Library Routine Document F07KDF (DPSTRF)

NAG Fortran Library Routine Document F04JAF.1

NAG Library Routine Document F04JAF.1

NAG Fortran Library Routine Document F04JGF.1

NAG Library Function Document nag_real_sym_posdef_tridiag_lin_solve (f04bgc)

NAG Library Routine Document F04MCF.1

NAG Library Function Document nag_herm_posdef_tridiag_lin_solve (f04cgc)

NAG Library Function Document nag_zgelsy (f08bnc)

NAG Library Function Document nag_dgelsd (f08kcc)

NAG Library Function Document nag_zgelss (f08knc)

NAG Fortran Library Routine Document F11ZPF.1

NAG Library Routine Document F08LEF (DGBBRD)

NAG Library Function Document nag_zhpev (f08gnc)

NAG Library Function Document nag_dstev (f08jac)

F01BSF NAG Fortran Library Routine Document

NAG Fortran Library Routine Document X04CBF.1

NAG Library Function Document nag_zheevx (f08fpc)

Module 5.5: nag sym bnd lin sys Symmetric Banded Systems of Linear Equations. Contents

NAG Library Routine Document G02DDF.1

NAG Library Routine Document G02BUF.1

printf("\n\nx = "); for(i=0;i<5;i++) printf("\n%f %f", X[i],X[i+5]); printf("\n\ny = "); for(i=0;i<5;i++) printf("\n%f", Y[i]);

NAG Fortran Library Routine Document G01ADF.1

NAG Library Function Document nag_dgglse (f08zac)

NAG C Library Function Document nag_dgbtrs (f07bec)

NAG Fortran Library Routine Document F11DSF.1

NAG Fortran Library Routine Document G02HKF.1

NAG Library Function Document nag_dsbev (f08hac)

NAG Library Function Document nag_dgetrf (f07adc)

NAG Library Routine Document G02CFF.1

NAG Library Function Document nag_ztzrzf (f08bvc)

F07HDFP (PDPBTRF).1. NAG Parallel Library Routine Document

NAG Library Function Document nag_dsygv (f08sac)

NAG Library Function Document nag_dsytrf (f07mdc)

NAG Fortran Library Routine Document G01ARF.1

NAG Fortran Library Routine Document E02BCF.1

NAG Fortran Library Routine Document G08AJF.1

NAG Library Routine Document G02DAF.1

NAG Fortran Library Routine Document G01AJF.1

NAG Fortran Library Routine Document G05LZF.1

NAG Library Function Document nag_zhbevx (f08hpc)

NAG Fortran Library Routine Document G08AKF.1

NAG Library Routine Document G02BGF.1

NAG Fortran Library Routine Document G05RAF.1

NAG Library Routine Document G02BXF.1

NAG Fortran Library Routine Document G01NBF.1

NAG Library Routine Document H03ADF.1

NAG Library Routine Document G05RGF.1

NAG Library Routine Document G05REF.1

NAG Library Routine Document E02BCF.1

Frequency Scaling and Energy Efficiency regarding the Gauss-Jordan Elimination Scheme on OpenPower 8

NAG Fortran Library Routine Document C05PBF.1

E02ZAF NAG Fortran Library Routine Document

NAG Library Routine Document D02HBF.1

NAG Library Routine Document E04GYF.1

NAG Library Chapter Introduction. F16 Further Linear Algebra Support Routines

NAG Library Function Document nag_ztgsen (f08yuc)

NAG Library Routine Document G02GPF.1

NAG Library Routine Document G01ABF.1

NAG C Library Function Document nag_zhsein (f08pxc)

NAG Library Routine Document D02UCF.1

NAG Library Function Document nag_dgetri (f07ajc)

NAG Library Routine Document D02UAF.1

C05 Roots of One or More Transcendental Equations. C05PCF NAG Fortran Library Routine Document

NAG Library Routine Document C05RBF.1

NAG Library Routine Document C05PBF/C05PBA

AMath 483/583 Lecture 22. Notes: Another Send/Receive example. Notes: Notes: Another Send/Receive example. Outline:

NAG Library Routine Document C05QBF.1

NAG Fortran Library Routine Document E01AEF.1

NAG Library Function Document nag_dtrsyl (f08qhc)

NAG Fortran Library Routine Document D02KAF.1

NAG Library Routine Document G05PZF.1

NAG Library Routine Document G13DPF.1

NAG Fortran Library Routine Document D02MVF.1

NAG Library Function Document nag_dgges (f08xac)

NAG C Library Function Document nag_zsytri (f07nwc)

NAG Library Routine Document D02MWF.1

Transcription:

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 real system of linear equations AX ¼ B, where A is an n by n matrix and X and B are n by r matrices. 2 Specification SUBROUTINE F07AAF (N, NRHS, A, LDA, IPIV, B, LDB, INFO) N, NRHS, LDA, IPIV(), LDB, INFO double precision A(LDA,), B(LDB,) The routine may be called by its LAPACK name dgesv. 3 Description The LU decomposition with partial pivoting and row interchanges is used to factor A as A ¼ PLU, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. 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 Golub G H and Van Loan C F (996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore 5 Parameters : N Input On entry: n, the number of linear equations, i.e., the order of the matrix A. Constraint: N 0. 2: NRHS Input On entry: r, the number of right-hand sides, i.e., the number of columns of the matrix B. Constraint: NRHS 0. 3: AðLDA,Þ double precision array Input/Output Note: the second dimension of the array A must be at least maxð; NÞ. On entry: the n by n coefficient matrix A..

NAG Fortran Library Manual On exit: the factors L and U from the factorization A ¼ PLU; the unit diagonal elements of L are not stored. 4: LDA Input On entry: the first dimension of the array A as declared in the (sub)program from which F07AAF (DGESV) is called. Constraint: LDA maxð; NÞ. 5: IPIVðÞ array Output Note: the dimension of the array IPIV must be at least maxð; NÞ. On exit: ifinfo 0, the pivot indices that define the permutation matrix P; at the ith step row i of the matrix was interchanged with row IPIVðiÞ. IPIVðiÞ ¼i indicates a row interchange was not required. 6: BðLDB,Þ double precision array Input/Output Note: the second dimension of the array B must be at least maxð; NRHSÞ. On entry: the n by r right-hand side matrix B. On exit: if INFO ¼ 0, the n by r solution matrix X. 7: LDB Input On entry: the first dimension of the array B as declared in the (sub)program from which F07AAF (DGESV) is called. Constraint: LDB maxð; NÞ. 8: INFO Output On exit: INFO ¼ 0 unless the routine detects an error (see Section 6). 6 Error Indicators and Warnings Errors or warnings detected by the routine: INFO < 0 If INFO ¼ i, the ith argument had an illegal value. execution of the program is terminated. An explanatory message is output, and INFO > 0 If INFO ¼ i, u ii is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed. 7 Accuracy The computed solution for a single right-hand side, ^x, satisfies the 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.2

where A ð Þ ¼ A kak, the condition number of A with respect to the solution of the linear equations. See Section 4.4 of Anderson et al. (999) for further details. Following the use of, F07AGF (DGECON) can be used to estimate the condition number of A and F07AHF (DGERFS) can be used to obtain approximate error bounds. Alternatives to, which return condition and error estimates directly are F04BAF and F07ABF (DGESVX). 8 Further Comments The total number of floating-point operations is approximately 2 3 n3 þ 2n 2 r, where r is the number of righthand sides. The complex analogue of this routine is F07ANF (ZGESV). 9 Example To solve the equations where A is the general matrix and A ¼ Ax ¼ b, 0 :80 2:88 2:05 0:89 5:25 2:95 0:95 3:80 B C @ :58 2:69 2:90 :04 A : 0:66 0:59 0:80 b ¼ Details of the LU factorization of A are also output. 9. Program Text 0 9:52 24:35 B C @ 0:77 A : 6:22 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. F07AAF Example Program Text Mark 2 Release. NAG Copyright 2004... Parameters.. NIN, NOUT (NIN=5,NOUT=6) NMAX (NMAX=8) LDA (LDA=NMAX).. Local Scalars.. I, IFAIL, INFO, J, N.. Local Arrays.. DOUBLE PRECISION A(LDA,NMAX), B(NMAX) IPIV(NMAX).. External Subroutines.. EXTERNAL DGESV, X04CAF.. Executable Statements.. WRITE (NOUT,) F07AAF Example Program Results WRITE (NOUT,) Skip heading in data file READ (NIN,) READ (NIN,) N IF (N.LE.NMAX) THEN.3

NAG Fortran Library Manual Read A and B from data file READ (NIN,) ((A(I,J),J=,N),I=,N) READ (NIN,) (B(I),I=,N) Solve the equations Ax = b for x CALL DGESV(N,,A,LDA,IPIV,B,N,INFO) IF (INFO.EQ.0) THEN Print solution WRITE (NOUT,) Solution WRITE (NOUT,99999) (B(I),I=,N) Print details of factorization WRITE (NOUT,) IFAIL = 0 CALL X04CAF( General,,N,N,A,LDA, + Details of factorization,ifail) Print pivot indices WRITE (NOUT,) WRITE (NOUT,) Pivot indices WRITE (NOUT,99998) (IPIV(I),I=,N) ELSE WRITE (NOUT,99997) The (, INFO,,, INFO, ), + element of the factor U is zero END IF ELSE WRITE (NOUT,) NMAX too small END IF STOP 99999 FORMAT ((3X,7F.4)) 99998 FORMAT ((3X,7I)) 99997 FORMAT (X,A,I3,A,I3,A,A) END 9.2 Program Data F07AAF Example Program Data 4 :Value of N.80 2.88 2.05-0.89 5.25-2.95-0.95-3.80.58-2.69-2.90 -.04 -. -0.66-0.59 0.80 :End of matrix A 9.52 24.35 0.77-6.22 :End of vector b.4

9.3 Program Results F07AAF Example Program Results Solution.0000 -.0000 3.0000-5.0000 Details of factorization 2 3 4 5.2500-2.9500-0.9500-3.8000 2 0.3429 3.894 2.3757 0.429 3 0.300-0.463 -.539 0.2948 4-0.24-0.3299 0.0047 0.34 Pivot indices 2 2 3 4.5 (last)