Annotation of rpl/lapack/lapack/dtptri.f, revision 1.12
1.8 bertrand 1: *> \brief \b DTPTRI
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: *> \htmlonly
9: *> Download DTPTRI + dependencies
10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtptri.f">
11: *> [TGZ]</a>
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtptri.f">
13: *> [ZIP]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtptri.f">
15: *> [TXT]</a>
16: *> \endhtmlonly
17: *
18: * Definition:
19: * ===========
20: *
21: * SUBROUTINE DTPTRI( UPLO, DIAG, N, AP, INFO )
22: *
23: * .. Scalar Arguments ..
24: * CHARACTER DIAG, UPLO
25: * INTEGER INFO, N
26: * ..
27: * .. Array Arguments ..
28: * DOUBLE PRECISION AP( * )
29: * ..
30: *
31: *
32: *> \par Purpose:
33: * =============
34: *>
35: *> \verbatim
36: *>
37: *> DTPTRI computes the inverse of a real upper or lower triangular
38: *> matrix A stored in packed format.
39: *> \endverbatim
40: *
41: * Arguments:
42: * ==========
43: *
44: *> \param[in] UPLO
45: *> \verbatim
46: *> UPLO is CHARACTER*1
47: *> = 'U': A is upper triangular;
48: *> = 'L': A is lower triangular.
49: *> \endverbatim
50: *>
51: *> \param[in] DIAG
52: *> \verbatim
53: *> DIAG is CHARACTER*1
54: *> = 'N': A is non-unit triangular;
55: *> = 'U': A is unit triangular.
56: *> \endverbatim
57: *>
58: *> \param[in] N
59: *> \verbatim
60: *> N is INTEGER
61: *> The order of the matrix A. N >= 0.
62: *> \endverbatim
63: *>
64: *> \param[in,out] AP
65: *> \verbatim
66: *> AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
67: *> On entry, the upper or lower triangular matrix A, stored
68: *> columnwise in a linear array. The j-th column of A is stored
69: *> in the array AP as follows:
70: *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
71: *> if UPLO = 'L', AP(i + (j-1)*((2*n-j)/2) = A(i,j) for j<=i<=n.
72: *> See below for further details.
73: *> On exit, the (triangular) inverse of the original matrix, in
74: *> the same packed storage format.
75: *> \endverbatim
76: *>
77: *> \param[out] INFO
78: *> \verbatim
79: *> INFO is INTEGER
80: *> = 0: successful exit
81: *> < 0: if INFO = -i, the i-th argument had an illegal value
82: *> > 0: if INFO = i, A(i,i) is exactly zero. The triangular
83: *> matrix is singular and its inverse can not be computed.
84: *> \endverbatim
85: *
86: * Authors:
87: * ========
88: *
89: *> \author Univ. of Tennessee
90: *> \author Univ. of California Berkeley
91: *> \author Univ. of Colorado Denver
92: *> \author NAG Ltd.
93: *
94: *> \date November 2011
95: *
96: *> \ingroup doubleOTHERcomputational
97: *
98: *> \par Further Details:
99: * =====================
100: *>
101: *> \verbatim
102: *>
103: *> A triangular matrix A can be transferred to packed storage using one
104: *> of the following program segments:
105: *>
106: *> UPLO = 'U': UPLO = 'L':
107: *>
108: *> JC = 1 JC = 1
109: *> DO 2 J = 1, N DO 2 J = 1, N
110: *> DO 1 I = 1, J DO 1 I = J, N
111: *> AP(JC+I-1) = A(I,J) AP(JC+I-J) = A(I,J)
112: *> 1 CONTINUE 1 CONTINUE
113: *> JC = JC + J JC = JC + N - J + 1
114: *> 2 CONTINUE 2 CONTINUE
115: *> \endverbatim
116: *>
117: * =====================================================================
1.1 bertrand 118: SUBROUTINE DTPTRI( UPLO, DIAG, N, AP, INFO )
119: *
1.8 bertrand 120: * -- LAPACK computational routine (version 3.4.0) --
1.1 bertrand 121: * -- LAPACK is a software package provided by Univ. of Tennessee, --
122: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.8 bertrand 123: * November 2011
1.1 bertrand 124: *
125: * .. Scalar Arguments ..
126: CHARACTER DIAG, UPLO
127: INTEGER INFO, N
128: * ..
129: * .. Array Arguments ..
130: DOUBLE PRECISION AP( * )
131: * ..
132: *
133: * =====================================================================
134: *
135: * .. Parameters ..
136: DOUBLE PRECISION ONE, ZERO
137: PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
138: * ..
139: * .. Local Scalars ..
140: LOGICAL NOUNIT, UPPER
141: INTEGER J, JC, JCLAST, JJ
142: DOUBLE PRECISION AJJ
143: * ..
144: * .. External Functions ..
145: LOGICAL LSAME
146: EXTERNAL LSAME
147: * ..
148: * .. External Subroutines ..
149: EXTERNAL DSCAL, DTPMV, XERBLA
150: * ..
151: * .. Executable Statements ..
152: *
153: * Test the input parameters.
154: *
155: INFO = 0
156: UPPER = LSAME( UPLO, 'U' )
157: NOUNIT = LSAME( DIAG, 'N' )
158: IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
159: INFO = -1
160: ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
161: INFO = -2
162: ELSE IF( N.LT.0 ) THEN
163: INFO = -3
164: END IF
165: IF( INFO.NE.0 ) THEN
166: CALL XERBLA( 'DTPTRI', -INFO )
167: RETURN
168: END IF
169: *
170: * Check for singularity if non-unit.
171: *
172: IF( NOUNIT ) THEN
173: IF( UPPER ) THEN
174: JJ = 0
175: DO 10 INFO = 1, N
176: JJ = JJ + INFO
177: IF( AP( JJ ).EQ.ZERO )
178: $ RETURN
179: 10 CONTINUE
180: ELSE
181: JJ = 1
182: DO 20 INFO = 1, N
183: IF( AP( JJ ).EQ.ZERO )
184: $ RETURN
185: JJ = JJ + N - INFO + 1
186: 20 CONTINUE
187: END IF
188: INFO = 0
189: END IF
190: *
191: IF( UPPER ) THEN
192: *
193: * Compute inverse of upper triangular matrix.
194: *
195: JC = 1
196: DO 30 J = 1, N
197: IF( NOUNIT ) THEN
198: AP( JC+J-1 ) = ONE / AP( JC+J-1 )
199: AJJ = -AP( JC+J-1 )
200: ELSE
201: AJJ = -ONE
202: END IF
203: *
204: * Compute elements 1:j-1 of j-th column.
205: *
206: CALL DTPMV( 'Upper', 'No transpose', DIAG, J-1, AP,
207: $ AP( JC ), 1 )
208: CALL DSCAL( J-1, AJJ, AP( JC ), 1 )
209: JC = JC + J
210: 30 CONTINUE
211: *
212: ELSE
213: *
214: * Compute inverse of lower triangular matrix.
215: *
216: JC = N*( N+1 ) / 2
217: DO 40 J = N, 1, -1
218: IF( NOUNIT ) THEN
219: AP( JC ) = ONE / AP( JC )
220: AJJ = -AP( JC )
221: ELSE
222: AJJ = -ONE
223: END IF
224: IF( J.LT.N ) THEN
225: *
226: * Compute elements j+1:n of j-th column.
227: *
228: CALL DTPMV( 'Lower', 'No transpose', DIAG, N-J,
229: $ AP( JCLAST ), AP( JC+1 ), 1 )
230: CALL DSCAL( N-J, AJJ, AP( JC+1 ), 1 )
231: END IF
232: JCLAST = JC
233: JC = JC - N + J - 2
234: 40 CONTINUE
235: END IF
236: *
237: RETURN
238: *
239: * End of DTPTRI
240: *
241: END
CVSweb interface <joel.bertrand@systella.fr>