LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
ztpmv.f
Go to the documentation of this file.
1*> \brief \b ZTPMV
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE ZTPMV(UPLO,TRANS,DIAG,N,AP,X,INCX)
12*
13* .. Scalar Arguments ..
14* INTEGER INCX,N
15* CHARACTER DIAG,TRANS,UPLO
16* ..
17* .. Array Arguments ..
18* COMPLEX*16 AP(*),X(*)
19* ..
20*
21*
22*> \par Purpose:
23* =============
24*>
25*> \verbatim
26*>
27*> ZTPMV performs one of the matrix-vector operations
28*>
29*> x := A*x, or x := A**T*x, or x := A**H*x,
30*>
31*> where x is an n element vector and A is an n by n unit, or non-unit,
32*> upper or lower triangular matrix, supplied in packed form.
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] UPLO
39*> \verbatim
40*> UPLO is CHARACTER*1
41*> On entry, UPLO specifies whether the matrix is an upper or
42*> lower triangular matrix as follows:
43*>
44*> UPLO = 'U' or 'u' A is an upper triangular matrix.
45*>
46*> UPLO = 'L' or 'l' A is a lower triangular matrix.
47*> \endverbatim
48*>
49*> \param[in] TRANS
50*> \verbatim
51*> TRANS is CHARACTER*1
52*> On entry, TRANS specifies the operation to be performed as
53*> follows:
54*>
55*> TRANS = 'N' or 'n' x := A*x.
56*>
57*> TRANS = 'T' or 't' x := A**T*x.
58*>
59*> TRANS = 'C' or 'c' x := A**H*x.
60*> \endverbatim
61*>
62*> \param[in] DIAG
63*> \verbatim
64*> DIAG is CHARACTER*1
65*> On entry, DIAG specifies whether or not A is unit
66*> triangular as follows:
67*>
68*> DIAG = 'U' or 'u' A is assumed to be unit triangular.
69*>
70*> DIAG = 'N' or 'n' A is not assumed to be unit
71*> triangular.
72*> \endverbatim
73*>
74*> \param[in] N
75*> \verbatim
76*> N is INTEGER
77*> On entry, N specifies the order of the matrix A.
78*> N must be at least zero.
79*> \endverbatim
80*>
81*> \param[in] AP
82*> \verbatim
83*> AP is COMPLEX*16 array, dimension at least
84*> ( ( n*( n + 1 ) )/2 ).
85*> Before entry with UPLO = 'U' or 'u', the array AP must
86*> contain the upper triangular matrix packed sequentially,
87*> column by column, so that AP( 1 ) contains a( 1, 1 ),
88*> AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 )
89*> respectively, and so on.
90*> Before entry with UPLO = 'L' or 'l', the array AP must
91*> contain the lower triangular matrix packed sequentially,
92*> column by column, so that AP( 1 ) contains a( 1, 1 ),
93*> AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 )
94*> respectively, and so on.
95*> Note that when DIAG = 'U' or 'u', the diagonal elements of
96*> A are not referenced, but are assumed to be unity.
97*> \endverbatim
98*>
99*> \param[in,out] X
100*> \verbatim
101*> X is COMPLEX*16 array, dimension at least
102*> ( 1 + ( n - 1 )*abs( INCX ) ).
103*> Before entry, the incremented array X must contain the n
104*> element vector x. On exit, X is overwritten with the
105*> transformed vector x.
106*> \endverbatim
107*>
108*> \param[in] INCX
109*> \verbatim
110*> INCX is INTEGER
111*> On entry, INCX specifies the increment for the elements of
112*> X. INCX must not be zero.
113*> \endverbatim
114*
115* Authors:
116* ========
117*
118*> \author Univ. of Tennessee
119*> \author Univ. of California Berkeley
120*> \author Univ. of Colorado Denver
121*> \author NAG Ltd.
122*
123*> \ingroup tpmv
124*
125*> \par Further Details:
126* =====================
127*>
128*> \verbatim
129*>
130*> Level 2 Blas routine.
131*> The vector and matrix arguments are not referenced when N = 0, or M = 0
132*>
133*> -- Written on 22-October-1986.
134*> Jack Dongarra, Argonne National Lab.
135*> Jeremy Du Croz, Nag Central Office.
136*> Sven Hammarling, Nag Central Office.
137*> Richard Hanson, Sandia National Labs.
138*> \endverbatim
139*>
140* =====================================================================
141 SUBROUTINE ztpmv(UPLO,TRANS,DIAG,N,AP,X,INCX)
142*
143* -- Reference BLAS level2 routine --
144* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
145* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
146*
147* .. Scalar Arguments ..
148 INTEGER INCX,N
149 CHARACTER DIAG,TRANS,UPLO
150* ..
151* .. Array Arguments ..
152 COMPLEX*16 AP(*),X(*)
153* ..
154*
155* =====================================================================
156*
157* .. Parameters ..
158 COMPLEX*16 ZERO
159 parameter(zero= (0.0d+0,0.0d+0))
160* ..
161* .. Local Scalars ..
162 COMPLEX*16 TEMP
163 INTEGER I,INFO,IX,J,JX,K,KK,KX
164 LOGICAL NOCONJ,NOUNIT
165* ..
166* .. External Functions ..
167 LOGICAL LSAME
168 EXTERNAL lsame
169* ..
170* .. External Subroutines ..
171 EXTERNAL xerbla
172* ..
173* .. Intrinsic Functions ..
174 INTRINSIC dconjg
175* ..
176*
177* Test the input parameters.
178*
179 info = 0
180 IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
181 info = 1
182 ELSE IF (.NOT.lsame(trans,'N') .AND.
183 + .NOT.lsame(trans,'T') .AND.
184 + .NOT.lsame(trans,'C')) THEN
185 info = 2
186 ELSE IF (.NOT.lsame(diag,'U') .AND.
187 + .NOT.lsame(diag,'N')) THEN
188 info = 3
189 ELSE IF (n.LT.0) THEN
190 info = 4
191 ELSE IF (incx.EQ.0) THEN
192 info = 7
193 END IF
194 IF (info.NE.0) THEN
195 CALL xerbla('ZTPMV ',info)
196 RETURN
197 END IF
198*
199* Quick return if possible.
200*
201 IF (n.EQ.0) RETURN
202*
203 noconj = lsame(trans,'T')
204 nounit = lsame(diag,'N')
205*
206* Set up the start point in X if the increment is not unity. This
207* will be ( N - 1 )*INCX too small for descending loops.
208*
209 IF (incx.LE.0) THEN
210 kx = 1 - (n-1)*incx
211 ELSE IF (incx.NE.1) THEN
212 kx = 1
213 END IF
214*
215* Start the operations. In this version the elements of AP are
216* accessed sequentially with one pass through AP.
217*
218 IF (lsame(trans,'N')) THEN
219*
220* Form x:= A*x.
221*
222 IF (lsame(uplo,'U')) THEN
223 kk = 1
224 IF (incx.EQ.1) THEN
225 DO 20 j = 1,n
226 IF (x(j).NE.zero) THEN
227 temp = x(j)
228 k = kk
229 DO 10 i = 1,j - 1
230 x(i) = x(i) + temp*ap(k)
231 k = k + 1
232 10 CONTINUE
233 IF (nounit) x(j) = x(j)*ap(kk+j-1)
234 END IF
235 kk = kk + j
236 20 CONTINUE
237 ELSE
238 jx = kx
239 DO 40 j = 1,n
240 IF (x(jx).NE.zero) THEN
241 temp = x(jx)
242 ix = kx
243 DO 30 k = kk,kk + j - 2
244 x(ix) = x(ix) + temp*ap(k)
245 ix = ix + incx
246 30 CONTINUE
247 IF (nounit) x(jx) = x(jx)*ap(kk+j-1)
248 END IF
249 jx = jx + incx
250 kk = kk + j
251 40 CONTINUE
252 END IF
253 ELSE
254 kk = (n* (n+1))/2
255 IF (incx.EQ.1) THEN
256 DO 60 j = n,1,-1
257 IF (x(j).NE.zero) THEN
258 temp = x(j)
259 k = kk
260 DO 50 i = n,j + 1,-1
261 x(i) = x(i) + temp*ap(k)
262 k = k - 1
263 50 CONTINUE
264 IF (nounit) x(j) = x(j)*ap(kk-n+j)
265 END IF
266 kk = kk - (n-j+1)
267 60 CONTINUE
268 ELSE
269 kx = kx + (n-1)*incx
270 jx = kx
271 DO 80 j = n,1,-1
272 IF (x(jx).NE.zero) THEN
273 temp = x(jx)
274 ix = kx
275 DO 70 k = kk,kk - (n- (j+1)),-1
276 x(ix) = x(ix) + temp*ap(k)
277 ix = ix - incx
278 70 CONTINUE
279 IF (nounit) x(jx) = x(jx)*ap(kk-n+j)
280 END IF
281 jx = jx - incx
282 kk = kk - (n-j+1)
283 80 CONTINUE
284 END IF
285 END IF
286 ELSE
287*
288* Form x := A**T*x or x := A**H*x.
289*
290 IF (lsame(uplo,'U')) THEN
291 kk = (n* (n+1))/2
292 IF (incx.EQ.1) THEN
293 DO 110 j = n,1,-1
294 temp = x(j)
295 k = kk - 1
296 IF (noconj) THEN
297 IF (nounit) temp = temp*ap(kk)
298 DO 90 i = j - 1,1,-1
299 temp = temp + ap(k)*x(i)
300 k = k - 1
301 90 CONTINUE
302 ELSE
303 IF (nounit) temp = temp*dconjg(ap(kk))
304 DO 100 i = j - 1,1,-1
305 temp = temp + dconjg(ap(k))*x(i)
306 k = k - 1
307 100 CONTINUE
308 END IF
309 x(j) = temp
310 kk = kk - j
311 110 CONTINUE
312 ELSE
313 jx = kx + (n-1)*incx
314 DO 140 j = n,1,-1
315 temp = x(jx)
316 ix = jx
317 IF (noconj) THEN
318 IF (nounit) temp = temp*ap(kk)
319 DO 120 k = kk - 1,kk - j + 1,-1
320 ix = ix - incx
321 temp = temp + ap(k)*x(ix)
322 120 CONTINUE
323 ELSE
324 IF (nounit) temp = temp*dconjg(ap(kk))
325 DO 130 k = kk - 1,kk - j + 1,-1
326 ix = ix - incx
327 temp = temp + dconjg(ap(k))*x(ix)
328 130 CONTINUE
329 END IF
330 x(jx) = temp
331 jx = jx - incx
332 kk = kk - j
333 140 CONTINUE
334 END IF
335 ELSE
336 kk = 1
337 IF (incx.EQ.1) THEN
338 DO 170 j = 1,n
339 temp = x(j)
340 k = kk + 1
341 IF (noconj) THEN
342 IF (nounit) temp = temp*ap(kk)
343 DO 150 i = j + 1,n
344 temp = temp + ap(k)*x(i)
345 k = k + 1
346 150 CONTINUE
347 ELSE
348 IF (nounit) temp = temp*dconjg(ap(kk))
349 DO 160 i = j + 1,n
350 temp = temp + dconjg(ap(k))*x(i)
351 k = k + 1
352 160 CONTINUE
353 END IF
354 x(j) = temp
355 kk = kk + (n-j+1)
356 170 CONTINUE
357 ELSE
358 jx = kx
359 DO 200 j = 1,n
360 temp = x(jx)
361 ix = jx
362 IF (noconj) THEN
363 IF (nounit) temp = temp*ap(kk)
364 DO 180 k = kk + 1,kk + n - j
365 ix = ix + incx
366 temp = temp + ap(k)*x(ix)
367 180 CONTINUE
368 ELSE
369 IF (nounit) temp = temp*dconjg(ap(kk))
370 DO 190 k = kk + 1,kk + n - j
371 ix = ix + incx
372 temp = temp + dconjg(ap(k))*x(ix)
373 190 CONTINUE
374 END IF
375 x(jx) = temp
376 jx = jx + incx
377 kk = kk + (n-j+1)
378 200 CONTINUE
379 END IF
380 END IF
381 END IF
382*
383 RETURN
384*
385* End of ZTPMV
386*
387 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ztpmv(uplo, trans, diag, n, ap, x, incx)
ZTPMV
Definition ztpmv.f:142