LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
stpmv.f
Go to the documentation of this file.
1*> \brief \b STPMV
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 STPMV(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* REAL AP(*),X(*)
19* ..
20*
21*
22*> \par Purpose:
23* =============
24*>
25*> \verbatim
26*>
27*> STPMV performs one of the matrix-vector operations
28*>
29*> x := A*x, or x := A**T*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**T*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 REAL 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 REAL 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 stpmv(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 REAL AP(*),X(*)
153* ..
154*
155* =====================================================================
156*
157* .. Parameters ..
158 REAL ZERO
159 parameter(zero=0.0e+0)
160* ..
161* .. Local Scalars ..
162 REAL TEMP
163 INTEGER I,INFO,IX,J,JX,K,KK,KX
164 LOGICAL NOUNIT
165* ..
166* .. External Functions ..
167 LOGICAL LSAME
168 EXTERNAL lsame
169* ..
170* .. External Subroutines ..
171 EXTERNAL xerbla
172* ..
173*
174* Test the input parameters.
175*
176 info = 0
177 IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
178 info = 1
179 ELSE IF (.NOT.lsame(trans,'N') .AND.
180 + .NOT.lsame(trans,'T') .AND.
181 + .NOT.lsame(trans,'C')) THEN
182 info = 2
183 ELSE IF (.NOT.lsame(diag,'U') .AND.
184 + .NOT.lsame(diag,'N')) THEN
185 info = 3
186 ELSE IF (n.LT.0) THEN
187 info = 4
188 ELSE IF (incx.EQ.0) THEN
189 info = 7
190 END IF
191 IF (info.NE.0) THEN
192 CALL xerbla('STPMV ',info)
193 RETURN
194 END IF
195*
196* Quick return if possible.
197*
198 IF (n.EQ.0) RETURN
199*
200 nounit = lsame(diag,'N')
201*
202* Set up the start point in X if the increment is not unity. This
203* will be ( N - 1 )*INCX too small for descending loops.
204*
205 IF (incx.LE.0) THEN
206 kx = 1 - (n-1)*incx
207 ELSE IF (incx.NE.1) THEN
208 kx = 1
209 END IF
210*
211* Start the operations. In this version the elements of AP are
212* accessed sequentially with one pass through AP.
213*
214 IF (lsame(trans,'N')) THEN
215*
216* Form x:= A*x.
217*
218 IF (lsame(uplo,'U')) THEN
219 kk = 1
220 IF (incx.EQ.1) THEN
221 DO 20 j = 1,n
222 IF (x(j).NE.zero) THEN
223 temp = x(j)
224 k = kk
225 DO 10 i = 1,j - 1
226 x(i) = x(i) + temp*ap(k)
227 k = k + 1
228 10 CONTINUE
229 IF (nounit) x(j) = x(j)*ap(kk+j-1)
230 END IF
231 kk = kk + j
232 20 CONTINUE
233 ELSE
234 jx = kx
235 DO 40 j = 1,n
236 IF (x(jx).NE.zero) THEN
237 temp = x(jx)
238 ix = kx
239 DO 30 k = kk,kk + j - 2
240 x(ix) = x(ix) + temp*ap(k)
241 ix = ix + incx
242 30 CONTINUE
243 IF (nounit) x(jx) = x(jx)*ap(kk+j-1)
244 END IF
245 jx = jx + incx
246 kk = kk + j
247 40 CONTINUE
248 END IF
249 ELSE
250 kk = (n* (n+1))/2
251 IF (incx.EQ.1) THEN
252 DO 60 j = n,1,-1
253 IF (x(j).NE.zero) THEN
254 temp = x(j)
255 k = kk
256 DO 50 i = n,j + 1,-1
257 x(i) = x(i) + temp*ap(k)
258 k = k - 1
259 50 CONTINUE
260 IF (nounit) x(j) = x(j)*ap(kk-n+j)
261 END IF
262 kk = kk - (n-j+1)
263 60 CONTINUE
264 ELSE
265 kx = kx + (n-1)*incx
266 jx = kx
267 DO 80 j = n,1,-1
268 IF (x(jx).NE.zero) THEN
269 temp = x(jx)
270 ix = kx
271 DO 70 k = kk,kk - (n- (j+1)),-1
272 x(ix) = x(ix) + temp*ap(k)
273 ix = ix - incx
274 70 CONTINUE
275 IF (nounit) x(jx) = x(jx)*ap(kk-n+j)
276 END IF
277 jx = jx - incx
278 kk = kk - (n-j+1)
279 80 CONTINUE
280 END IF
281 END IF
282 ELSE
283*
284* Form x := A**T*x.
285*
286 IF (lsame(uplo,'U')) THEN
287 kk = (n* (n+1))/2
288 IF (incx.EQ.1) THEN
289 DO 100 j = n,1,-1
290 temp = x(j)
291 IF (nounit) temp = temp*ap(kk)
292 k = kk - 1
293 DO 90 i = j - 1,1,-1
294 temp = temp + ap(k)*x(i)
295 k = k - 1
296 90 CONTINUE
297 x(j) = temp
298 kk = kk - j
299 100 CONTINUE
300 ELSE
301 jx = kx + (n-1)*incx
302 DO 120 j = n,1,-1
303 temp = x(jx)
304 ix = jx
305 IF (nounit) temp = temp*ap(kk)
306 DO 110 k = kk - 1,kk - j + 1,-1
307 ix = ix - incx
308 temp = temp + ap(k)*x(ix)
309 110 CONTINUE
310 x(jx) = temp
311 jx = jx - incx
312 kk = kk - j
313 120 CONTINUE
314 END IF
315 ELSE
316 kk = 1
317 IF (incx.EQ.1) THEN
318 DO 140 j = 1,n
319 temp = x(j)
320 IF (nounit) temp = temp*ap(kk)
321 k = kk + 1
322 DO 130 i = j + 1,n
323 temp = temp + ap(k)*x(i)
324 k = k + 1
325 130 CONTINUE
326 x(j) = temp
327 kk = kk + (n-j+1)
328 140 CONTINUE
329 ELSE
330 jx = kx
331 DO 160 j = 1,n
332 temp = x(jx)
333 ix = jx
334 IF (nounit) temp = temp*ap(kk)
335 DO 150 k = kk + 1,kk + n - j
336 ix = ix + incx
337 temp = temp + ap(k)*x(ix)
338 150 CONTINUE
339 x(jx) = temp
340 jx = jx + incx
341 kk = kk + (n-j+1)
342 160 CONTINUE
343 END IF
344 END IF
345 END IF
346*
347 RETURN
348*
349* End of STPMV
350*
351 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine stpmv(uplo, trans, diag, n, ap, x, incx)
STPMV
Definition stpmv.f:142