LAPACK 3.3.0

# spotri.f

Go to the documentation of this file.
```00001       SUBROUTINE SPOTRI( UPLO, N, A, LDA, INFO )
00002 *
00003 *  -- LAPACK 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, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       REAL               A( LDA, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  SPOTRI computes the inverse of a real symmetric positive definite
00020 *  matrix A using the Cholesky factorization A = U**T*U or A = L*L**T
00021 *  computed by SPOTRF.
00022 *
00023 *  Arguments
00024 *  =========
00025 *
00026 *  UPLO    (input) CHARACTER*1
00027 *          = 'U':  Upper triangle of A is stored;
00028 *          = 'L':  Lower triangle of A is stored.
00029 *
00030 *  N       (input) INTEGER
00031 *          The order of the matrix A.  N >= 0.
00032 *
00033 *  A       (input/output) REAL array, dimension (LDA,N)
00034 *          On entry, the triangular factor U or L from the Cholesky
00035 *          factorization A = U**T*U or A = L*L**T, as computed by
00036 *          SPOTRF.
00037 *          On exit, the upper or lower triangle of the (symmetric)
00038 *          inverse of A, overwriting the input factor U or L.
00039 *
00040 *  LDA     (input) INTEGER
00041 *          The leading dimension of the array A.  LDA >= max(1,N).
00042 *
00043 *  INFO    (output) INTEGER
00044 *          = 0:  successful exit
00045 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00046 *          > 0:  if INFO = i, the (i,i) element of the factor U or L is
00047 *                zero, and the inverse could not be computed.
00048 *
00049 *  =====================================================================
00050 *
00051 *     .. External Functions ..
00052       LOGICAL            LSAME
00053       EXTERNAL           LSAME
00054 *     ..
00055 *     .. External Subroutines ..
00056       EXTERNAL           SLAUUM, STRTRI, XERBLA
00057 *     ..
00058 *     .. Intrinsic Functions ..
00059       INTRINSIC          MAX
00060 *     ..
00061 *     .. Executable Statements ..
00062 *
00063 *     Test the input parameters.
00064 *
00065       INFO = 0
00066       IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00067          INFO = -1
00068       ELSE IF( N.LT.0 ) THEN
00069          INFO = -2
00070       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00071          INFO = -4
00072       END IF
00073       IF( INFO.NE.0 ) THEN
00074          CALL XERBLA( 'SPOTRI', -INFO )
00075          RETURN
00076       END IF
00077 *
00078 *     Quick return if possible
00079 *
00080       IF( N.EQ.0 )
00081      \$   RETURN
00082 *
00083 *     Invert the triangular Cholesky factor U or L.
00084 *
00085       CALL STRTRI( UPLO, 'Non-unit', N, A, LDA, INFO )
00086       IF( INFO.GT.0 )
00087      \$   RETURN
00088 *
00089 *     Form inv(U)*inv(U)' or inv(L)'*inv(L).
00090 *
00091       CALL SLAUUM( UPLO, N, A, LDA, INFO )
00092 *
00093       RETURN
00094 *
00095 *     End of SPOTRI
00096 *
00097       END
```