LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
spptri.f
Go to the documentation of this file.
1*> \brief \b SPPTRI
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download SPPTRI + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spptri.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spptri.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spptri.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE SPPTRI( UPLO, N, AP, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER UPLO
25* INTEGER INFO, N
26* ..
27* .. Array Arguments ..
28* REAL AP( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> SPPTRI computes the inverse of a real symmetric positive definite
38*> matrix A using the Cholesky factorization A = U**T*U or A = L*L**T
39*> computed by SPPTRF.
40*> \endverbatim
41*
42* Arguments:
43* ==========
44*
45*> \param[in] UPLO
46*> \verbatim
47*> UPLO is CHARACTER*1
48*> = 'U': Upper triangular factor is stored in AP;
49*> = 'L': Lower triangular factor is stored in AP.
50*> \endverbatim
51*>
52*> \param[in] N
53*> \verbatim
54*> N is INTEGER
55*> The order of the matrix A. N >= 0.
56*> \endverbatim
57*>
58*> \param[in,out] AP
59*> \verbatim
60*> AP is REAL array, dimension (N*(N+1)/2)
61*> On entry, the triangular factor U or L from the Cholesky
62*> factorization A = U**T*U or A = L*L**T, packed columnwise as
63*> a linear array. The j-th column of U or L is stored in the
64*> array AP as follows:
65*> if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j;
66*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n.
67*>
68*> On exit, the upper or lower triangle of the (symmetric)
69*> inverse of A, overwriting the input factor U or L.
70*> \endverbatim
71*>
72*> \param[out] INFO
73*> \verbatim
74*> INFO is INTEGER
75*> = 0: successful exit
76*> < 0: if INFO = -i, the i-th argument had an illegal value
77*> > 0: if INFO = i, the (i,i) element of the factor U or L is
78*> zero, and the inverse could not be computed.
79*> \endverbatim
80*
81* Authors:
82* ========
83*
84*> \author Univ. of Tennessee
85*> \author Univ. of California Berkeley
86*> \author Univ. of Colorado Denver
87*> \author NAG Ltd.
88*
89*> \ingroup pptri
90*
91* =====================================================================
92 SUBROUTINE spptri( UPLO, N, AP, INFO )
93*
94* -- LAPACK computational routine --
95* -- LAPACK is a software package provided by Univ. of Tennessee, --
96* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
97*
98* .. Scalar Arguments ..
99 CHARACTER UPLO
100 INTEGER INFO, N
101* ..
102* .. Array Arguments ..
103 REAL AP( * )
104* ..
105*
106* =====================================================================
107*
108* .. Parameters ..
109 REAL ONE
110 parameter( one = 1.0e+0 )
111* ..
112* .. Local Scalars ..
113 LOGICAL UPPER
114 INTEGER J, JC, JJ, JJN
115 REAL AJJ
116* ..
117* .. External Functions ..
118 LOGICAL LSAME
119 REAL SDOT
120 EXTERNAL lsame, sdot
121* ..
122* .. External Subroutines ..
123 EXTERNAL sscal, sspr, stpmv, stptri, xerbla
124* ..
125* .. Executable Statements ..
126*
127* Test the input parameters.
128*
129 info = 0
130 upper = lsame( uplo, 'U' )
131 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
132 info = -1
133 ELSE IF( n.LT.0 ) THEN
134 info = -2
135 END IF
136 IF( info.NE.0 ) THEN
137 CALL xerbla( 'SPPTRI', -info )
138 RETURN
139 END IF
140*
141* Quick return if possible
142*
143 IF( n.EQ.0 )
144 $ RETURN
145*
146* Invert the triangular Cholesky factor U or L.
147*
148 CALL stptri( uplo, 'Non-unit', n, ap, info )
149 IF( info.GT.0 )
150 $ RETURN
151*
152 IF( upper ) THEN
153*
154* Compute the product inv(U) * inv(U)**T.
155*
156 jj = 0
157 DO 10 j = 1, n
158 jc = jj + 1
159 jj = jj + j
160 IF( j.GT.1 )
161 $ CALL sspr( 'Upper', j-1, one, ap( jc ), 1, ap )
162 ajj = ap( jj )
163 CALL sscal( j, ajj, ap( jc ), 1 )
164 10 CONTINUE
165*
166 ELSE
167*
168* Compute the product inv(L)**T * inv(L).
169*
170 jj = 1
171 DO 20 j = 1, n
172 jjn = jj + n - j + 1
173 ap( jj ) = sdot( n-j+1, ap( jj ), 1, ap( jj ), 1 )
174 IF( j.LT.n )
175 $ CALL stpmv( 'Lower', 'Transpose', 'Non-unit', n-j,
176 $ ap( jjn ), ap( jj+1 ), 1 )
177 jj = jjn
178 20 CONTINUE
179 END IF
180*
181 RETURN
182*
183* End of SPPTRI
184*
185 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sspr(uplo, n, alpha, x, incx, ap)
SSPR
Definition sspr.f:127
subroutine spptri(uplo, n, ap, info)
SPPTRI
Definition spptri.f:93
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine stpmv(uplo, trans, diag, n, ap, x, incx)
STPMV
Definition stpmv.f:142
subroutine stptri(uplo, diag, n, ap, info)
STPTRI
Definition stptri.f:117