|
kusano |
2b45e8 |
SUBROUTINE DPOTRIF( UPLO, N, A, LDA, INFO )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- LAPACK routine (version 3.1) --
|
|
kusano |
2b45e8 |
* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
|
|
kusano |
2b45e8 |
* November 2006
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Scalar Arguments ..
|
|
kusano |
2b45e8 |
CHARACTER UPLO
|
|
kusano |
2b45e8 |
INTEGER INFO, LDA, N
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Array Arguments ..
|
|
kusano |
2b45e8 |
DOUBLE PRECISION A( LDA, * )
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Purpose
|
|
kusano |
2b45e8 |
* =======
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* DPOTRI computes the inverse of a real symmetric positive definite
|
|
kusano |
2b45e8 |
* matrix A using the Cholesky factorization A = U**T*U or A = L*L**T
|
|
kusano |
2b45e8 |
* computed by DPOTRF.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Arguments
|
|
kusano |
2b45e8 |
* =========
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* UPLO (input) CHARACTER*1
|
|
kusano |
2b45e8 |
* = 'U': Upper triangle of A is stored;
|
|
kusano |
2b45e8 |
* = 'L': Lower triangle of A is stored.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* N (input) INTEGER
|
|
kusano |
2b45e8 |
* The order of the matrix A. N >= 0.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
|
|
kusano |
2b45e8 |
* On entry, the triangular factor U or L from the Cholesky
|
|
kusano |
2b45e8 |
* factorization A = U**T*U or A = L*L**T, as computed by
|
|
kusano |
2b45e8 |
* DPOTRF.
|
|
kusano |
2b45e8 |
* On exit, the upper or lower triangle of the (symmetric)
|
|
kusano |
2b45e8 |
* inverse of A, overwriting the input factor U or L.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDA (input) INTEGER
|
|
kusano |
2b45e8 |
* The leading dimension of the array A. LDA >= max(1,N).
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* INFO (output) INTEGER
|
|
kusano |
2b45e8 |
* = 0: successful exit
|
|
kusano |
2b45e8 |
* < 0: if INFO = -i, the i-th argument had an illegal value
|
|
kusano |
2b45e8 |
* > 0: if INFO = i, the (i,i) element of the factor U or L is
|
|
kusano |
2b45e8 |
* zero, and the inverse could not be computed.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* =====================================================================
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. External Functions ..
|
|
kusano |
2b45e8 |
LOGICAL LSAME
|
|
kusano |
2b45e8 |
EXTERNAL LSAME
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. External Subroutines ..
|
|
kusano |
2b45e8 |
EXTERNAL DLAUUM, DTRTRI, XERBLA
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Intrinsic Functions ..
|
|
kusano |
2b45e8 |
INTRINSIC MAX
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Executable Statements ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Test the input parameters.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
INFO = 0
|
|
kusano |
2b45e8 |
IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
|
|
kusano |
2b45e8 |
INFO = -1
|
|
kusano |
2b45e8 |
ELSE IF( N.LT.0 ) THEN
|
|
kusano |
2b45e8 |
INFO = -2
|
|
kusano |
2b45e8 |
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
|
|
kusano |
2b45e8 |
INFO = -4
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IF( INFO.NE.0 ) THEN
|
|
kusano |
2b45e8 |
CALL XERBLA( 'DPOTRI', -INFO )
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Quick return if possible
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( N.EQ.0 )
|
|
kusano |
2b45e8 |
$ RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Invert the triangular Cholesky factor U or L.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
CALL DTRTRI( UPLO, 'Non-unit', N, A, LDA, INFO )
|
|
kusano |
2b45e8 |
IF( INFO.GT.0 )
|
|
kusano |
2b45e8 |
$ RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Form inv(U)*inv(U)' or inv(L)'*inv(L).
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
CALL DLAUUM( UPLO, N, A, LDA, INFO )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* End of DPOTRI
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
END
|