Update to 2.0.0 tree from current Fremantle build
[opencv] / 3rdparty / lapack / spotri.c
1 #include "clapack.h"
2
3 /* Subroutine */ int spotri_(char *uplo, integer *n, real *a, integer *lda, 
4         integer *info)
5 {
6     /* System generated locals */
7     integer a_dim1, a_offset, i__1;
8
9     /* Local variables */
10     extern logical lsame_(char *, char *);
11     extern /* Subroutine */ int xerbla_(char *, integer *), slauum_(
12             char *, integer *, real *, integer *, integer *), strtri_(
13             char *, char *, integer *, real *, integer *, integer *);
14
15
16 /*  -- LAPACK routine (version 3.1) -- */
17 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
18 /*     November 2006 */
19
20 /*     .. Scalar Arguments .. */
21 /*     .. */
22 /*     .. Array Arguments .. */
23 /*     .. */
24
25 /*  Purpose */
26 /*  ======= */
27
28 /*  SPOTRI computes the inverse of a real symmetric positive definite */
29 /*  matrix A using the Cholesky factorization A = U**T*U or A = L*L**T */
30 /*  computed by SPOTRF. */
31
32 /*  Arguments */
33 /*  ========= */
34
35 /*  UPLO    (input) CHARACTER*1 */
36 /*          = 'U':  Upper triangle of A is stored; */
37 /*          = 'L':  Lower triangle of A is stored. */
38
39 /*  N       (input) INTEGER */
40 /*          The order of the matrix A.  N >= 0. */
41
42 /*  A       (input/output) REAL array, dimension (LDA,N) */
43 /*          On entry, the triangular factor U or L from the Cholesky */
44 /*          factorization A = U**T*U or A = L*L**T, as computed by */
45 /*          SPOTRF. */
46 /*          On exit, the upper or lower triangle of the (symmetric) */
47 /*          inverse of A, overwriting the input factor U or L. */
48
49 /*  LDA     (input) INTEGER */
50 /*          The leading dimension of the array A.  LDA >= max(1,N). */
51
52 /*  INFO    (output) INTEGER */
53 /*          = 0:  successful exit */
54 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
55 /*          > 0:  if INFO = i, the (i,i) element of the factor U or L is */
56 /*                zero, and the inverse could not be computed. */
57
58 /*  ===================================================================== */
59
60 /*     .. External Functions .. */
61 /*     .. */
62 /*     .. External Subroutines .. */
63 /*     .. */
64 /*     .. Intrinsic Functions .. */
65 /*     .. */
66 /*     .. Executable Statements .. */
67
68 /*     Test the input parameters. */
69
70     /* Parameter adjustments */
71     a_dim1 = *lda;
72     a_offset = 1 + a_dim1;
73     a -= a_offset;
74
75     /* Function Body */
76     *info = 0;
77     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
78         *info = -1;
79     } else if (*n < 0) {
80         *info = -2;
81     } else if (*lda < max(1,*n)) {
82         *info = -4;
83     }
84     if (*info != 0) {
85         i__1 = -(*info);
86         xerbla_("SPOTRI", &i__1);
87         return 0;
88     }
89
90 /*     Quick return if possible */
91
92     if (*n == 0) {
93         return 0;
94     }
95
96 /*     Invert the triangular Cholesky factor U or L. */
97
98     strtri_(uplo, "Non-unit", n, &a[a_offset], lda, info);
99     if (*info > 0) {
100         return 0;
101     }
102
103 /*     Form inv(U)*inv(U)' or inv(L)'*inv(L). */
104
105     slauum_(uplo, n, &a[a_offset], lda, info);
106
107     return 0;
108
109 /*     End of SPOTRI */
110
111 } /* spotri_ */