LAPACK 3.3.0

dposv.f

Go to the documentation of this file.
00001       SUBROUTINE DPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO )
00002 *
00003 *  -- LAPACK driver routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            INFO, LDA, LDB, N, NRHS
00011 *     ..
00012 *     .. Array Arguments ..
00013       DOUBLE PRECISION   A( LDA, * ), B( LDB, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  DPOSV computes the solution to a real system of linear equations
00020 *     A * X = B,
00021 *  where A is an N-by-N symmetric positive definite matrix and X and B
00022 *  are N-by-NRHS matrices.
00023 *
00024 *  The Cholesky decomposition is used to factor A as
00025 *     A = U**T* U,  if UPLO = 'U', or
00026 *     A = L * L**T,  if UPLO = 'L',
00027 *  where U is an upper triangular matrix and L is a lower triangular
00028 *  matrix.  The factored form of A is then used to solve the system of
00029 *  equations A * X = B.
00030 *
00031 *  Arguments
00032 *  =========
00033 *
00034 *  UPLO    (input) CHARACTER*1
00035 *          = 'U':  Upper triangle of A is stored;
00036 *          = 'L':  Lower triangle of A is stored.
00037 *
00038 *  N       (input) INTEGER
00039 *          The number of linear equations, i.e., the order of the
00040 *          matrix A.  N >= 0.
00041 *
00042 *  NRHS    (input) INTEGER
00043 *          The number of right hand sides, i.e., the number of columns
00044 *          of the matrix B.  NRHS >= 0.
00045 *
00046 *  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
00047 *          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
00048 *          N-by-N upper triangular part of A contains the upper
00049 *          triangular part of the matrix A, and the strictly lower
00050 *          triangular part of A is not referenced.  If UPLO = 'L', the
00051 *          leading N-by-N lower triangular part of A contains the lower
00052 *          triangular part of the matrix A, and the strictly upper
00053 *          triangular part of A is not referenced.
00054 *
00055 *          On exit, if INFO = 0, the factor U or L from the Cholesky
00056 *          factorization A = U**T*U or A = L*L**T.
00057 *
00058 *  LDA     (input) INTEGER
00059 *          The leading dimension of the array A.  LDA >= max(1,N).
00060 *
00061 *  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
00062 *          On entry, the N-by-NRHS right hand side matrix B.
00063 *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00064 *
00065 *  LDB     (input) INTEGER
00066 *          The leading dimension of the array B.  LDB >= max(1,N).
00067 *
00068 *  INFO    (output) INTEGER
00069 *          = 0:  successful exit
00070 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00071 *          > 0:  if INFO = i, the leading minor of order i of A is not
00072 *                positive definite, so the factorization could not be
00073 *                completed, and the solution has not been computed.
00074 *
00075 *  =====================================================================
00076 *
00077 *     .. External Functions ..
00078       LOGICAL            LSAME
00079       EXTERNAL           LSAME
00080 *     ..
00081 *     .. External Subroutines ..
00082       EXTERNAL           DPOTRF, DPOTRS, XERBLA
00083 *     ..
00084 *     .. Intrinsic Functions ..
00085       INTRINSIC          MAX
00086 *     ..
00087 *     .. Executable Statements ..
00088 *
00089 *     Test the input parameters.
00090 *
00091       INFO = 0
00092       IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00093          INFO = -1
00094       ELSE IF( N.LT.0 ) THEN
00095          INFO = -2
00096       ELSE IF( NRHS.LT.0 ) THEN
00097          INFO = -3
00098       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00099          INFO = -5
00100       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00101          INFO = -7
00102       END IF
00103       IF( INFO.NE.0 ) THEN
00104          CALL XERBLA( 'DPOSV ', -INFO )
00105          RETURN
00106       END IF
00107 *
00108 *     Compute the Cholesky factorization A = U'*U or A = L*L'.
00109 *
00110       CALL DPOTRF( UPLO, N, A, LDA, INFO )
00111       IF( INFO.EQ.0 ) THEN
00112 *
00113 *        Solve the system A*X = B, overwriting B with X.
00114 *
00115          CALL DPOTRS( UPLO, N, NRHS, A, LDA, B, LDB, INFO )
00116 *
00117       END IF
00118       RETURN
00119 *
00120 *     End of DPOSV
00121 *
00122       END
 All Files Functions