00001 /* spotri.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int spotri_(char *uplo, integer *n, real *a, integer *lda, 00017 integer *info) 00018 { 00019 /* System generated locals */ 00020 integer a_dim1, a_offset, i__1; 00021 00022 /* Local variables */ 00023 extern logical lsame_(char *, char *); 00024 extern /* Subroutine */ int xerbla_(char *, integer *), slauum_( 00025 char *, integer *, real *, integer *, integer *), strtri_( 00026 char *, char *, integer *, real *, integer *, integer *); 00027 00028 00029 /* -- LAPACK routine (version 3.2) -- */ 00030 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00031 /* November 2006 */ 00032 00033 /* .. Scalar Arguments .. */ 00034 /* .. */ 00035 /* .. Array Arguments .. */ 00036 /* .. */ 00037 00038 /* Purpose */ 00039 /* ======= */ 00040 00041 /* SPOTRI computes the inverse of a real symmetric positive definite */ 00042 /* matrix A using the Cholesky factorization A = U**T*U or A = L*L**T */ 00043 /* computed by SPOTRF. */ 00044 00045 /* Arguments */ 00046 /* ========= */ 00047 00048 /* UPLO (input) CHARACTER*1 */ 00049 /* = 'U': Upper triangle of A is stored; */ 00050 /* = 'L': Lower triangle of A is stored. */ 00051 00052 /* N (input) INTEGER */ 00053 /* The order of the matrix A. N >= 0. */ 00054 00055 /* A (input/output) REAL array, dimension (LDA,N) */ 00056 /* On entry, the triangular factor U or L from the Cholesky */ 00057 /* factorization A = U**T*U or A = L*L**T, as computed by */ 00058 /* SPOTRF. */ 00059 /* On exit, the upper or lower triangle of the (symmetric) */ 00060 /* inverse of A, overwriting the input factor U or L. */ 00061 00062 /* LDA (input) INTEGER */ 00063 /* The leading dimension of the array A. LDA >= max(1,N). */ 00064 00065 /* INFO (output) INTEGER */ 00066 /* = 0: successful exit */ 00067 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00068 /* > 0: if INFO = i, the (i,i) element of the factor U or L is */ 00069 /* zero, and the inverse could not be computed. */ 00070 00071 /* ===================================================================== */ 00072 00073 /* .. External Functions .. */ 00074 /* .. */ 00075 /* .. External Subroutines .. */ 00076 /* .. */ 00077 /* .. Intrinsic Functions .. */ 00078 /* .. */ 00079 /* .. Executable Statements .. */ 00080 00081 /* Test the input parameters. */ 00082 00083 /* Parameter adjustments */ 00084 a_dim1 = *lda; 00085 a_offset = 1 + a_dim1; 00086 a -= a_offset; 00087 00088 /* Function Body */ 00089 *info = 0; 00090 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) { 00091 *info = -1; 00092 } else if (*n < 0) { 00093 *info = -2; 00094 } else if (*lda < max(1,*n)) { 00095 *info = -4; 00096 } 00097 if (*info != 0) { 00098 i__1 = -(*info); 00099 xerbla_("SPOTRI", &i__1); 00100 return 0; 00101 } 00102 00103 /* Quick return if possible */ 00104 00105 if (*n == 0) { 00106 return 0; 00107 } 00108 00109 /* Invert the triangular Cholesky factor U or L. */ 00110 00111 strtri_(uplo, "Non-unit", n, &a[a_offset], lda, info); 00112 if (*info > 0) { 00113 return 0; 00114 } 00115 00116 /* Form inv(U)*inv(U)' or inv(L)'*inv(L). */ 00117 00118 slauum_(uplo, n, &a[a_offset], lda, info); 00119 00120 return 0; 00121 00122 /* End of SPOTRI */ 00123 00124 } /* spotri_ */