3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download STPTRI + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stptri.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stptri.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stptri.f">
21 * SUBROUTINE STPTRI( UPLO, DIAG, N, AP, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER DIAG, UPLO
27 * .. Array Arguments ..
37 *> STPTRI computes the inverse of a real upper or lower triangular
38 *> matrix A stored in packed format.
46 *> UPLO is CHARACTER*1
47 *> = 'U': A is upper triangular;
48 *> = 'L': A is lower triangular.
53 *> DIAG is CHARACTER*1
54 *> = 'N': A is non-unit triangular;
55 *> = 'U': A is unit triangular.
61 *> The order of the matrix A. N >= 0.
66 *> AP is REAL 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.
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.
89 *> \author Univ. of Tennessee
90 *> \author Univ. of California Berkeley
91 *> \author Univ. of Colorado Denver
94 *> \date November 2011
96 *> \ingroup realOTHERcomputational
98 *> \par Further Details:
99 * =====================
103 *> A triangular matrix A can be transferred to packed storage using one
104 *> of the following program segments:
106 *> UPLO = 'U': UPLO = 'L':
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
117 * =====================================================================
118 SUBROUTINE STPTRI( UPLO, DIAG, N, AP, INFO )
120 * -- LAPACK computational routine (version 3.4.0) --
121 * -- LAPACK is a software package provided by Univ. of Tennessee, --
122 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 * .. Scalar Arguments ..
129 * .. Array Arguments ..
133 * =====================================================================
137 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
139 * .. Local Scalars ..
140 LOGICAL NOUNIT, UPPER
141 INTEGER J, JC, JCLAST, JJ
144 * .. External Functions ..
148 * .. External Subroutines ..
149 EXTERNAL SSCAL, STPMV, XERBLA
151 * .. Executable Statements ..
153 * Test the input parameters.
156 UPPER = LSAME( UPLO, 'U' )
157 NOUNIT = LSAME( DIAG, 'N' )
158 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
160 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
162 ELSE IF( N.LT.0 ) THEN
166 CALL XERBLA( 'STPTRI', -INFO )
170 * Check for singularity if non-unit.
177 IF( AP( JJ ).EQ.ZERO )
183 IF( AP( JJ ).EQ.ZERO )
185 JJ = JJ + N - INFO + 1
193 * Compute inverse of upper triangular matrix.
198 AP( JC+J-1 ) = ONE / AP( JC+J-1 )
204 * Compute elements 1:j-1 of j-th column.
206 CALL STPMV( 'Upper', 'No transpose', DIAG, J-1, AP,
208 CALL SSCAL( J-1, AJJ, AP( JC ), 1 )
214 * Compute inverse of lower triangular matrix.
219 AP( JC ) = ONE / AP( JC )
226 * Compute elements j+1:n of j-th column.
228 CALL STPMV( 'Lower', 'No transpose', DIAG, N-J,
229 $ AP( JCLAST ), AP( JC+1 ), 1 )
230 CALL SSCAL( N-J, AJJ, AP( JC+1 ), 1 )