1 SUBROUTINE DTPMV
(UPLO
,TRANS
,DIAG
,N
,AP
,X
,INCX
)
2 * .. Scalar Arguments
..
4 CHARACTER DIAG
,TRANS
,UPLO
6 * .. Array Arguments
..
7 DOUBLE PRECISION AP
(*),X
(*)
13 * DTPMV performs one of the matrix
-vector operations
15 * x
:= A*x
, or x
:= A
'*x,
17 * where x is an n element vector and A is an n by n unit, or non-unit,
18 * upper or lower triangular matrix, supplied in packed form.
24 * On entry, UPLO specifies whether the matrix is an upper or
25 * lower triangular matrix as follows:
27 * UPLO = 'U
' or 'u
' A is an upper triangular matrix.
29 * UPLO = 'L
' or 'l
' A is a lower triangular matrix.
33 * TRANS - CHARACTER*1.
34 * On entry, TRANS specifies the operation to be performed as
37 * TRANS = 'N
' or 'n
' x := A*x.
39 * TRANS = 'T
' or 't
' x := A'*x
.
41 * TRANS
= 'C' or
'c' x
:= A
'*x.
46 * On entry, DIAG specifies whether or not A is unit
47 * triangular as follows:
49 * DIAG = 'U
' or 'u
' A is assumed to be unit triangular.
51 * DIAG = 'N
' or 'n
' A is not assumed to be unit
57 * On entry, N specifies the order of the matrix A.
58 * N must be at least zero.
61 * AP - DOUBLE PRECISION array of DIMENSION at least
62 * ( ( n*( n + 1 ) )/2 ).
63 * Before entry with UPLO = 'U
' or 'u
', the array AP must
64 * contain the upper triangular matrix packed sequentially,
65 * column by column, so that AP( 1 ) contains a( 1, 1 ),
66 * AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 )
67 * respectively, and so on.
68 * Before entry with UPLO = 'L
' or 'l
', the array AP must
69 * contain the lower triangular matrix packed sequentially,
70 * column by column, so that AP( 1 ) contains a( 1, 1 ),
71 * AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 )
72 * respectively, and so on.
73 * Note that when DIAG = 'U
' or 'u
', the diagonal elements of
74 * A are not referenced, but are assumed to be unity.
77 * X - DOUBLE PRECISION array of dimension at least
78 * ( 1 + ( n - 1 )*abs( INCX ) ).
79 * Before entry, the incremented array X must contain the n
80 * element vector x. On exit, X is overwritten with the
81 * tranformed vector x.
84 * On entry, INCX specifies the increment for the elements of
85 * X. INCX must not be zero.
89 * Level 2 Blas routine.
91 * -- Written on 22-October-1986.
92 * Jack Dongarra, Argonne National Lab.
93 * Jeremy Du Croz, Nag Central Office.
94 * Sven Hammarling, Nag Central Office.
95 * Richard Hanson, Sandia National Labs.
100 PARAMETER (ZERO=0.0D+0)
102 * .. Local Scalars ..
103 DOUBLE PRECISION TEMP
104 INTEGER I,INFO,IX,J,JX,K,KK,KX
107 * .. External Functions ..
111 * .. External Subroutines ..
115 * Test the input parameters.
118 IF (.NOT.LSAME(UPLO,'U
') .AND. .NOT.LSAME(UPLO,'L
')) THEN
120 ELSE IF (.NOT.LSAME(TRANS,'N
') .AND. .NOT.LSAME(TRANS,'T
') .AND.
121 + .NOT.LSAME(TRANS,'C
')) THEN
123 ELSE IF (.NOT.LSAME(DIAG,'U
') .AND. .NOT.LSAME(DIAG,'N
')) THEN
125 ELSE IF (N.LT.0) THEN
127 ELSE IF (INCX.EQ.0) THEN
131 CALL XERBLA('DTPMV
',INFO)
135 * Quick return if possible.
139 NOUNIT = LSAME(DIAG,'N
')
141 * Set up the start point in X if the increment is not unity. This
142 * will be ( N - 1 )*INCX too small for descending loops.
146 ELSE IF (INCX.NE.1) THEN
150 * Start the operations. In this version the elements of AP are
151 * accessed sequentially with one pass through AP.
153 IF (LSAME(TRANS,'N
')) THEN
157 IF (LSAME(UPLO,'U
')) THEN
161 IF (X(J).NE.ZERO) THEN
165 X(I) = X(I) + TEMP*AP(K)
168 IF (NOUNIT) X(J) = X(J)*AP(KK+J-1)
175 IF (X(JX).NE.ZERO) THEN
178 DO 30 K = KK,KK + J - 2
179 X(IX) = X(IX) + TEMP*AP(K)
182 IF (NOUNIT) X(JX) = X(JX)*AP(KK+J-1)
192 IF (X(J).NE.ZERO) THEN
196 X(I) = X(I) + TEMP*AP(K)
199 IF (NOUNIT) X(J) = X(J)*AP(KK-N+J)
207 IF (X(JX).NE.ZERO) THEN
210 DO 70 K = KK,KK - (N- (J+1)),-1
211 X(IX) = X(IX) + TEMP*AP(K)
214 IF (NOUNIT) X(JX) = X(JX)*AP(KK-N+J)
225 IF (LSAME
(UPLO
,'U')) THEN
230 IF (NOUNIT
) TEMP
= TEMP*AP
(KK
)
233 TEMP
= TEMP
+ AP
(K
)*X
(I
)
244 IF (NOUNIT
) TEMP
= TEMP*AP
(KK
)
245 DO 110 K
= KK
- 1,KK
- J
+ 1,-1
247 TEMP
= TEMP
+ AP
(K
)*X
(IX
)
259 IF (NOUNIT
) TEMP
= TEMP*AP
(KK
)
262 TEMP
= TEMP
+ AP
(K
)*X
(I
)
273 IF (NOUNIT
) TEMP
= TEMP*AP
(KK
)
274 DO 150 K
= KK
+ 1,KK
+ N
- J
276 TEMP
= TEMP
+ AP
(K
)*X
(IX
)