1 SUBROUTINE ZTRMV
( UPLO
, TRANS
, DIAG
, N
, A
, LDA
, X
, INCX
)
2 * .. Scalar Arguments
..
4 CHARACTER*1 DIAG
, TRANS
, UPLO
5 * .. Array Arguments
..
6 COMPLEX*16 A
( LDA
, * ), X
( * )
12 * ZTRMV performs one of the matrix
-vector operations
14 * x
:= A*x
, or x
:= A
'*x, or x := conjg( A' )*x
,
16 * where x is an n element vector and A is an n by n unit
, or non
-unit
,
17 * upper or lower triangular matrix
.
23 * On entry
, UPLO specifies whether the matrix is an upper or
24 * lower triangular matrix as follows
:
26 * UPLO
= 'U' or
'u' A is an upper triangular matrix
.
28 * UPLO
= 'L' or
'l' A is a lower triangular matrix
.
32 * TRANS
- CHARACTER*1
.
33 * On entry
, TRANS specifies the operation
to be performed as
36 * TRANS
= 'N' or
'n' x
:= A*x
.
38 * TRANS
= 'T' or
't' x
:= A
'*x.
40 * TRANS = 'C
' or 'c
' x := conjg( A' )*x
.
45 * On entry
, DIAG specifies whether or not A is unit
46 * triangular as follows
:
48 * DIAG
= 'U' or
'u' A is assumed
to be unit triangular
.
50 * DIAG
= 'N' or
'n' A is not assumed
to be unit
56 * On entry
, N specifies the order of the matrix A
.
57 * N must be at least zero
.
60 * A
- COMPLEX*16 array of
DIMENSION ( LDA
, n
).
61 * Before entry with UPLO
= 'U' or
'u', the leading n by n
62 * upper triangular part of the array A must contain the upper
63 * triangular matrix and the strictly lower triangular part of
64 * A is not referenced
.
65 * Before entry with UPLO
= 'L' or
'l', the leading n by n
66 * lower triangular part of the array A must contain the lower
67 * triangular matrix and the strictly upper triangular part of
68 * A is not referenced
.
69 * Note that when DIAG
= 'U' or
'u', the diagonal elements of
70 * A are not referenced either
, but are assumed
to be unity
.
74 * On entry
, LDA specifies the first
dimension of A as declared
75 * in the calling
(sub
) program. LDA must be at least
79 * X
- COMPLEX*16 array of
dimension at least
80 * ( 1 + ( n
- 1 )*abs
( INCX
) ).
81 * Before entry
, the incremented array X must contain the n
82 * element vector x
. On exit
, X is overwritten with the
83 * tranformed vector x
.
86 * On entry
, INCX specifies the increment
for the elements of
87 * X
. INCX must not be zero
.
91 * Level
2 Blas routine
.
93 * -- Written on
22-October
-1986.
94 * Jack Dongarra
, Argonne National Lab
.
95 * Jeremy Du Croz
, Nag Central Office
.
96 * Sven Hammarling
, Nag Central Office
.
97 * Richard Hanson
, Sandia National Labs
.
102 PARAMETER ( ZERO
= ( 0.0D
+0, 0.0D
+0 ) )
103 * .. Local Scalars
..
105 INTEGER I
, INFO
, IX
, J
, JX
, KX
106 LOGICAL NOCONJ
, NOUNIT
107 * .. External Functions
..
110 * .. External Subroutines
..
112 * .. Intrinsic Functions
..
113 INTRINSIC DCONJG
, MAX
115 * .. Executable Statements
..
117 * Test the input parameters
.
120 IF ( .NOT
.LSAME
( UPLO
, 'U' ).AND
.
121 $
.NOT
.LSAME
( UPLO
, 'L' ) )THEN
123 ELSE IF( .NOT
.LSAME
( TRANS
, 'N' ).AND
.
124 $
.NOT
.LSAME
( TRANS
, 'T' ).AND
.
125 $
.NOT
.LSAME
( TRANS
, 'C' ) )THEN
127 ELSE IF( .NOT
.LSAME
( DIAG
, 'U' ).AND
.
128 $
.NOT
.LSAME
( DIAG
, 'N' ) )THEN
130 ELSE IF( N
.LT
.0 )THEN
132 ELSE IF( LDA
.LT
.MAX
( 1, N
) )THEN
134 ELSE IF( INCX
.EQ
.0 )THEN
138 CALL XERBLA
( 'ZTRMV ', INFO
)
142 * Quick
return if possible
.
147 NOCONJ
= LSAME
( TRANS
, 'T' )
148 NOUNIT
= LSAME
( DIAG
, 'N' )
150 * Set up the start point in X
if the increment is not unity
. This
151 * will be
( N
- 1 )*INCX too small
for descending loops
.
154 KX
= 1 - ( N
- 1 )*INCX
155 ELSE IF( INCX
.NE
.1 )THEN
159 * Start the operations
. In this version the elements of A are
160 * accessed sequentially with one pass through A
.
162 IF( LSAME
( TRANS
, 'N' ) )THEN
166 IF( LSAME
( UPLO
, 'U' ) )THEN
169 IF( X
( J
).NE
.ZERO
)THEN
172 X
( I
) = X
( I
) + TEMP*A
( I
, J
)
175 $ X
( J
) = X
( J
)*A
( J
, J
)
181 IF( X
( JX
).NE
.ZERO
)THEN
185 X
( IX
) = X
( IX
) + TEMP*A
( I
, J
)
189 $ X
( JX
) = X
( JX
)*A
( J
, J
)
197 IF( X
( J
).NE
.ZERO
)THEN
199 DO 50, I
= N
, J
+ 1, -1
200 X
( I
) = X
( I
) + TEMP*A
( I
, J
)
203 $ X
( J
) = X
( J
)*A
( J
, J
)
207 KX
= KX
+ ( N
- 1 )*INCX
210 IF( X
( JX
).NE
.ZERO
)THEN
213 DO 70, I
= N
, J
+ 1, -1
214 X
( IX
) = X
( IX
) + TEMP*A
( I
, J
)
218 $ X
( JX
) = X
( JX
)*A
( J
, J
)
226 * Form x
:= A
'*x or x := conjg( A' )*x
.
228 IF( LSAME
( UPLO
, 'U' ) )THEN
234 $ TEMP
= TEMP*A
( J
, J
)
235 DO 90, I
= J
- 1, 1, -1
236 TEMP
= TEMP
+ A
( I
, J
)*X
( I
)
240 $ TEMP
= TEMP*DCONJG
( A
( J
, J
) )
241 DO 100, I
= J
- 1, 1, -1
242 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( I
)
248 JX
= KX
+ ( N
- 1 )*INCX
254 $ TEMP
= TEMP*A
( J
, J
)
255 DO 120, I
= J
- 1, 1, -1
257 TEMP
= TEMP
+ A
( I
, J
)*X
( IX
)
261 $ TEMP
= TEMP*DCONJG
( A
( J
, J
) )
262 DO 130, I
= J
- 1, 1, -1
264 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( IX
)
277 $ TEMP
= TEMP*A
( J
, J
)
279 TEMP
= TEMP
+ A
( I
, J
)*X
( I
)
283 $ TEMP
= TEMP*DCONJG
( A
( J
, J
) )
285 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( I
)
297 $ TEMP
= TEMP*A
( J
, J
)
300 TEMP
= TEMP
+ A
( I
, J
)*X
( IX
)
304 $ TEMP
= TEMP*DCONJG
( A
( J
, J
) )
307 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( IX
)