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