OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
strmv.f
Go to the documentation of this file.
1*> \brief \b STRMV
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 STRMV(UPLO,TRANS,DIAG,N,A,LDA,X,INCX)
12*
13* .. Scalar Arguments ..
14* INTEGER INCX,LDA,N
15* CHARACTER DIAG,TRANS,UPLO
16* ..
17* .. Array Arguments ..
18* REAL A(LDA,*),X(*)
19* ..
20*
21*
22*> \par Purpose:
23* =============
24*>
25*> \verbatim
26*>
27*> STRMV 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.
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] A
82*> \verbatim
83*> A is REAL array, dimension ( LDA, N )
84*> Before entry with UPLO = 'U' or 'u', the leading n by n
85*> upper triangular part of the array A must contain the upper
86*> triangular matrix and the strictly lower triangular part of
87*> A is not referenced.
88*> Before entry with UPLO = 'L' or 'l', the leading n by n
89*> lower triangular part of the array A must contain the lower
90*> triangular matrix and the strictly upper triangular part of
91*> A is not referenced.
92*> Note that when DIAG = 'U' or 'u', the diagonal elements of
93*> A are not referenced either, but are assumed to be unity.
94*> \endverbatim
95*>
96*> \param[in] LDA
97*> \verbatim
98*> LDA is INTEGER
99*> On entry, LDA specifies the first dimension of A as declared
100*> in the calling (sub) program. LDA must be at least
101*> max( 1, n ).
102*> \endverbatim
103*>
104*> \param[in,out] X
105*> \verbatim
106*> X is REAL array, dimension at least
107*> ( 1 + ( n - 1 )*abs( INCX ) ).
108*> Before entry, the incremented array X must contain the n
109*> element vector x. On exit, X is overwritten with the
110*> transformed vector x.
111*> \endverbatim
112*>
113*> \param[in] INCX
114*> \verbatim
115*> INCX is INTEGER
116*> On entry, INCX specifies the increment for the elements of
117*> X. INCX must not be zero.
118*> \endverbatim
119*
120* Authors:
121* ========
122*
123*> \author Univ. of Tennessee
124*> \author Univ. of California Berkeley
125*> \author Univ. of Colorado Denver
126*> \author NAG Ltd.
127*
128*> \ingroup single_blas_level2
129*
130*> \par Further Details:
131* =====================
132*>
133*> \verbatim
134*>
135*> Level 2 Blas routine.
136*> The vector and matrix arguments are not referenced when N = 0, or M = 0
137*>
138*> -- Written on 22-October-1986.
139*> Jack Dongarra, Argonne National Lab.
140*> Jeremy Du Croz, Nag Central Office.
141*> Sven Hammarling, Nag Central Office.
142*> Richard Hanson, Sandia National Labs.
143*> \endverbatim
144*>
145* =====================================================================
146 SUBROUTINE strmv(UPLO,TRANS,DIAG,N,A,LDA,X,INCX)
147*
148* -- Reference BLAS level2 routine --
149* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
150* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
151*
152* .. Scalar Arguments ..
153 INTEGER INCX,LDA,N
154 CHARACTER DIAG,TRANS,UPLO
155* ..
156* .. Array Arguments ..
157 REAL A(LDA,*),X(*)
158* ..
159*
160* =====================================================================
161*
162* .. Parameters ..
163 REAL ZERO
164 parameter(zero=0.0e+0)
165* ..
166* .. Local Scalars ..
167 REAL TEMP
168 INTEGER I,INFO,IX,J,JX,KX
169 LOGICAL NOUNIT
170* ..
171* .. External Functions ..
172 LOGICAL LSAME
173 EXTERNAL lsame
174* ..
175* .. External Subroutines ..
176 EXTERNAL xerbla
177* ..
178* .. Intrinsic Functions ..
179 INTRINSIC max
180* ..
181*
182* Test the input parameters.
183*
184 info = 0
185 IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
186 info = 1
187 ELSE IF (.NOT.lsame(trans,'N') .AND. .NOT.lsame(trans,'T') .AND.
188 + .NOT.lsame(trans,'C')) THEN
189 info = 2
190 ELSE IF (.NOT.lsame(diag,'u.AND..NOT.') LSAME(DIAG,'n')) THEN
191 INFO = 3
192.LT. ELSE IF (N0) THEN
193 INFO = 4
194.LT. ELSE IF (LDAMAX(1,N)) THEN
195 INFO = 6
196.EQ. ELSE IF (INCX0) THEN
197 INFO = 8
198 END IF
199.NE. IF (INFO0) THEN
200 CALL XERBLA('strmv ',INFO)
201 RETURN
202 END IF
203*
204* Quick return if possible.
205*
206.EQ. IF (N0) RETURN
207*
208 NOUNIT = LSAME(DIAG,'n')
209*
210* Set up the start point in X if the increment is not unity. This
211* will be ( N - 1 )*INCX too small for descending loops.
212*
213.LE. IF (INCX0) THEN
214 KX = 1 - (N-1)*INCX
215.NE. ELSE IF (INCX1) THEN
216 KX = 1
217 END IF
218*
219* Start the operations. In this version the elements of A are
220* accessed sequentially with one pass through A.
221*
222 IF (LSAME(TRANS,'n')) THEN
223*
224* Form x := A*x.
225*
226 IF (LSAME(UPLO,'u')) THEN
227.EQ. IF (INCX1) THEN
228 DO 20 J = 1,N
229.NE. IF (X(J)ZERO) THEN
230 TEMP = X(J)
231 DO 10 I = 1,J - 1
232 X(I) = X(I) + TEMP*A(I,J)
233 10 CONTINUE
234 IF (NOUNIT) X(J) = X(J)*A(J,J)
235 END IF
236 20 CONTINUE
237 ELSE
238 JX = KX
239 DO 40 J = 1,N
240.NE. IF (X(JX)ZERO) THEN
241 TEMP = X(JX)
242 IX = KX
243 DO 30 I = 1,J - 1
244 X(IX) = X(IX) + TEMP*A(I,J)
245 IX = IX + INCX
246 30 CONTINUE
247 IF (NOUNIT) X(JX) = X(JX)*A(J,J)
248 END IF
249 JX = JX + INCX
250 40 CONTINUE
251 END IF
252 ELSE
253.EQ. IF (INCX1) THEN
254 DO 60 J = N,1,-1
255.NE. IF (X(J)ZERO) THEN
256 TEMP = X(J)
257 DO 50 I = N,J + 1,-1
258 X(I) = X(I) + TEMP*A(I,J)
259 50 CONTINUE
260 IF (NOUNIT) X(J) = X(J)*A(J,J)
261 END IF
262 60 CONTINUE
263 ELSE
264 KX = KX + (N-1)*INCX
265 JX = KX
266 DO 80 J = N,1,-1
267.NE. IF (X(JX)ZERO) THEN
268 TEMP = X(JX)
269 IX = KX
270 DO 70 I = N,J + 1,-1
271 X(IX) = X(IX) + TEMP*A(I,J)
272 IX = IX - INCX
273 70 CONTINUE
274 IF (NOUNIT) X(JX) = X(JX)*A(J,J)
275 END IF
276 JX = JX - INCX
277 80 CONTINUE
278 END IF
279 END IF
280 ELSE
281*
282* Form x := A**T*x.
283*
284 IF (LSAME(UPLO,'u')) THEN
285.EQ. IF (INCX1) THEN
286 DO 100 J = N,1,-1
287 TEMP = X(J)
288 IF (NOUNIT) TEMP = TEMP*A(J,J)
289 DO 90 I = J - 1,1,-1
290 TEMP = TEMP + A(I,J)*X(I)
291 90 CONTINUE
292 X(J) = TEMP
293 100 CONTINUE
294 ELSE
295 JX = KX + (N-1)*INCX
296 DO 120 J = N,1,-1
297 TEMP = X(JX)
298 IX = JX
299 IF (NOUNIT) TEMP = TEMP*A(J,J)
300 DO 110 I = J - 1,1,-1
301 IX = IX - INCX
302 TEMP = TEMP + A(I,J)*X(IX)
303 110 CONTINUE
304 X(JX) = TEMP
305 JX = JX - INCX
306 120 CONTINUE
307 END IF
308 ELSE
309.EQ. IF (INCX1) THEN
310 DO 140 J = 1,N
311 TEMP = X(J)
312 IF (NOUNIT) TEMP = TEMP*A(J,J)
313 DO 130 I = J + 1,N
314 TEMP = TEMP + A(I,J)*X(I)
315 130 CONTINUE
316 X(J) = TEMP
317 140 CONTINUE
318 ELSE
319 JX = KX
320 DO 160 J = 1,N
321 TEMP = X(JX)
322 IX = JX
323 IF (NOUNIT) TEMP = TEMP*A(J,J)
324 DO 150 I = J + 1,N
325 IX = IX + INCX
326 TEMP = TEMP + A(I,J)*X(IX)
327 150 CONTINUE
328 X(JX) = TEMP
329 JX = JX + INCX
330 160 CONTINUE
331 END IF
332 END IF
333 END IF
334*
335 RETURN
336*
337* End of STRMV
338*
339 END
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
subroutine strmv(uplo, trans, diag, n, a, lda, x, incx)
STRMV
Definition strmv.f:147
#define max(a, b)
Definition macros.h:21