LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sla_gbamv.f
Go to the documentation of this file.
1*> \brief \b SLA_GBAMV performs a matrix-vector operation to calculate error bounds.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download SLA_GBAMV + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sla_gbamv.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_gbamv.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_gbamv.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE SLA_GBAMV( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
22* INCX, BETA, Y, INCY )
23*
24* .. Scalar Arguments ..
25* REAL ALPHA, BETA
26* INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
27* ..
28* .. Array Arguments ..
29* REAL AB( LDAB, * ), X( * ), Y( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> SLA_GBAMV performs one of the matrix-vector operations
39*>
40*> y := alpha*abs(A)*abs(x) + beta*abs(y),
41*> or y := alpha*abs(A)**T*abs(x) + beta*abs(y),
42*>
43*> where alpha and beta are scalars, x and y are vectors and A is an
44*> m by n matrix.
45*>
46*> This function is primarily used in calculating error bounds.
47*> To protect against underflow during evaluation, components in
48*> the resulting vector are perturbed away from zero by (N+1)
49*> times the underflow threshold. To prevent unnecessarily large
50*> errors for block-structure embedded in general matrices,
51*> "symbolically" zero components are not perturbed. A zero
52*> entry is considered "symbolic" if all multiplications involved
53*> in computing that entry have at least one zero multiplicand.
54*> \endverbatim
55*
56* Arguments:
57* ==========
58*
59*> \param[in] TRANS
60*> \verbatim
61*> TRANS is INTEGER
62*> On entry, TRANS specifies the operation to be performed as
63*> follows:
64*>
65*> BLAS_NO_TRANS y := alpha*abs(A)*abs(x) + beta*abs(y)
66*> BLAS_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y)
67*> BLAS_CONJ_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y)
68*>
69*> Unchanged on exit.
70*> \endverbatim
71*>
72*> \param[in] M
73*> \verbatim
74*> M is INTEGER
75*> On entry, M specifies the number of rows of the matrix A.
76*> M must be at least zero.
77*> Unchanged on exit.
78*> \endverbatim
79*>
80*> \param[in] N
81*> \verbatim
82*> N is INTEGER
83*> On entry, N specifies the number of columns of the matrix A.
84*> N must be at least zero.
85*> Unchanged on exit.
86*> \endverbatim
87*>
88*> \param[in] KL
89*> \verbatim
90*> KL is INTEGER
91*> The number of subdiagonals within the band of A. KL >= 0.
92*> \endverbatim
93*>
94*> \param[in] KU
95*> \verbatim
96*> KU is INTEGER
97*> The number of superdiagonals within the band of A. KU >= 0.
98*> \endverbatim
99*>
100*> \param[in] ALPHA
101*> \verbatim
102*> ALPHA is REAL
103*> On entry, ALPHA specifies the scalar alpha.
104*> Unchanged on exit.
105*> \endverbatim
106*>
107*> \param[in] AB
108*> \verbatim
109*> AB is REAL array, dimension ( LDAB, n )
110*> Before entry, the leading m by n part of the array AB must
111*> contain the matrix of coefficients.
112*> Unchanged on exit.
113*> \endverbatim
114*>
115*> \param[in] LDAB
116*> \verbatim
117*> LDAB is INTEGER
118*> On entry, LDA specifies the first dimension of AB as declared
119*> in the calling (sub) program. LDAB must be at least
120*> max( 1, m ).
121*> Unchanged on exit.
122*> \endverbatim
123*>
124*> \param[in] X
125*> \verbatim
126*> X is REAL array, dimension
127*> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
128*> and at least
129*> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
130*> Before entry, the incremented array X must contain the
131*> vector x.
132*> Unchanged on exit.
133*> \endverbatim
134*>
135*> \param[in] INCX
136*> \verbatim
137*> INCX is INTEGER
138*> On entry, INCX specifies the increment for the elements of
139*> X. INCX must not be zero.
140*> Unchanged on exit.
141*> \endverbatim
142*>
143*> \param[in] BETA
144*> \verbatim
145*> BETA is REAL
146*> On entry, BETA specifies the scalar beta. When BETA is
147*> supplied as zero then Y need not be set on input.
148*> Unchanged on exit.
149*> \endverbatim
150*>
151*> \param[in,out] Y
152*> \verbatim
153*> Y is REAL array, dimension
154*> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
155*> and at least
156*> ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
157*> Before entry with BETA non-zero, the incremented array Y
158*> must contain the vector y. On exit, Y is overwritten by the
159*> updated vector y.
160*> If either m or n is zero, then Y not referenced and the function
161*> performs a quick return.
162*> \endverbatim
163*>
164*> \param[in] INCY
165*> \verbatim
166*> INCY is INTEGER
167*> On entry, INCY specifies the increment for the elements of
168*> Y. INCY must not be zero.
169*> Unchanged on exit.
170*>
171*> Level 2 Blas routine.
172*> \endverbatim
173*
174* Authors:
175* ========
176*
177*> \author Univ. of Tennessee
178*> \author Univ. of California Berkeley
179*> \author Univ. of Colorado Denver
180*> \author NAG Ltd.
181*
182*> \ingroup la_gbamv
183*
184* =====================================================================
185 SUBROUTINE sla_gbamv( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
186 $ INCX, BETA, Y, INCY )
187*
188* -- LAPACK computational routine --
189* -- LAPACK is a software package provided by Univ. of Tennessee, --
190* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
191*
192* .. Scalar Arguments ..
193 REAL ALPHA, BETA
194 INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
195* ..
196* .. Array Arguments ..
197 REAL AB( LDAB, * ), X( * ), Y( * )
198* ..
199*
200* =====================================================================
201* .. Parameters ..
202 REAL ONE, ZERO
203 parameter( one = 1.0e+0, zero = 0.0e+0 )
204* ..
205* .. Local Scalars ..
206 LOGICAL SYMB_ZERO
207 REAL TEMP, SAFE1
208 INTEGER I, INFO, IY, J, JX, KX, KY, LENX, LENY, KD, KE
209* ..
210* .. External Subroutines ..
211 EXTERNAL xerbla, slamch
212 REAL SLAMCH
213* ..
214* .. External Functions ..
215 EXTERNAL ilatrans
216 INTEGER ILATRANS
217* ..
218* .. Intrinsic Functions ..
219 INTRINSIC max, abs, sign
220* ..
221* .. Executable Statements ..
222*
223* Test the input parameters.
224*
225 info = 0
226 IF ( .NOT.( ( trans.EQ.ilatrans( 'N' ) )
227 $ .OR. ( trans.EQ.ilatrans( 'T' ) )
228 $ .OR. ( trans.EQ.ilatrans( 'C' ) ) ) ) THEN
229 info = 1
230 ELSE IF( m.LT.0 )THEN
231 info = 2
232 ELSE IF( n.LT.0 )THEN
233 info = 3
234 ELSE IF( kl.LT.0 .OR. kl.GT.m-1 ) THEN
235 info = 4
236 ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
237 info = 5
238 ELSE IF( ldab.LT.kl+ku+1 )THEN
239 info = 6
240 ELSE IF( incx.EQ.0 )THEN
241 info = 8
242 ELSE IF( incy.EQ.0 )THEN
243 info = 11
244 END IF
245 IF( info.NE.0 )THEN
246 CALL xerbla( 'SLA_GBAMV ', info )
247 RETURN
248 END IF
249*
250* Quick return if possible.
251*
252 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
253 $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
254 $ RETURN
255*
256* Set LENX and LENY, the lengths of the vectors x and y, and set
257* up the start points in X and Y.
258*
259 IF( trans.EQ.ilatrans( 'N' ) )THEN
260 lenx = n
261 leny = m
262 ELSE
263 lenx = m
264 leny = n
265 END IF
266 IF( incx.GT.0 )THEN
267 kx = 1
268 ELSE
269 kx = 1 - ( lenx - 1 )*incx
270 END IF
271 IF( incy.GT.0 )THEN
272 ky = 1
273 ELSE
274 ky = 1 - ( leny - 1 )*incy
275 END IF
276*
277* Set SAFE1 essentially to be the underflow threshold times the
278* number of additions in each row.
279*
280 safe1 = slamch( 'Safe minimum' )
281 safe1 = (n+1)*safe1
282*
283* Form y := alpha*abs(A)*abs(x) + beta*abs(y).
284*
285* The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
286* the inexact flag. Still doesn't help change the iteration order
287* to per-column.
288*
289 kd = ku + 1
290 ke = kl + 1
291 iy = ky
292 IF ( incx.EQ.1 ) THEN
293 IF( trans.EQ.ilatrans( 'N' ) )THEN
294 DO i = 1, leny
295 IF ( beta .EQ. zero ) THEN
296 symb_zero = .true.
297 y( iy ) = 0.0
298 ELSE IF ( y( iy ) .EQ. zero ) THEN
299 symb_zero = .true.
300 ELSE
301 symb_zero = .false.
302 y( iy ) = beta * abs( y( iy ) )
303 END IF
304 IF ( alpha .NE. zero ) THEN
305 DO j = max( i-kl, 1 ), min( i+ku, lenx )
306 temp = abs( ab( kd+i-j, j ) )
307 symb_zero = symb_zero .AND.
308 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
309
310 y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
311 END DO
312 END IF
313
314 IF ( .NOT.symb_zero )
315 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
316 iy = iy + incy
317 END DO
318 ELSE
319 DO i = 1, leny
320 IF ( beta .EQ. zero ) THEN
321 symb_zero = .true.
322 y( iy ) = 0.0
323 ELSE IF ( y( iy ) .EQ. zero ) THEN
324 symb_zero = .true.
325 ELSE
326 symb_zero = .false.
327 y( iy ) = beta * abs( y( iy ) )
328 END IF
329 IF ( alpha .NE. zero ) THEN
330 DO j = max( i-kl, 1 ), min( i+ku, lenx )
331 temp = abs( ab( ke-i+j, i ) )
332 symb_zero = symb_zero .AND.
333 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
334
335 y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
336 END DO
337 END IF
338
339 IF ( .NOT.symb_zero )
340 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
341 iy = iy + incy
342 END DO
343 END IF
344 ELSE
345 IF( trans.EQ.ilatrans( 'N' ) )THEN
346 DO i = 1, leny
347 IF ( beta .EQ. zero ) THEN
348 symb_zero = .true.
349 y( iy ) = 0.0
350 ELSE IF ( y( iy ) .EQ. zero ) THEN
351 symb_zero = .true.
352 ELSE
353 symb_zero = .false.
354 y( iy ) = beta * abs( y( iy ) )
355 END IF
356 IF ( alpha .NE. zero ) THEN
357 jx = kx
358 DO j = max( i-kl, 1 ), min( i+ku, lenx )
359 temp = abs( ab( kd+i-j, j ) )
360 symb_zero = symb_zero .AND.
361 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
362
363 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
364 jx = jx + incx
365 END DO
366 END IF
367
368 IF ( .NOT.symb_zero )
369 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
370
371 iy = iy + incy
372 END DO
373 ELSE
374 DO i = 1, leny
375 IF ( beta .EQ. zero ) THEN
376 symb_zero = .true.
377 y( iy ) = 0.0
378 ELSE IF ( y( iy ) .EQ. zero ) THEN
379 symb_zero = .true.
380 ELSE
381 symb_zero = .false.
382 y( iy ) = beta * abs( y( iy ) )
383 END IF
384 IF ( alpha .NE. zero ) THEN
385 jx = kx
386 DO j = max( i-kl, 1 ), min( i+ku, lenx )
387 temp = abs( ab( ke-i+j, i ) )
388 symb_zero = symb_zero .AND.
389 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
390
391 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
392 jx = jx + incx
393 END DO
394 END IF
395
396 IF ( .NOT.symb_zero )
397 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
398
399 iy = iy + incy
400 END DO
401 END IF
402
403 END IF
404*
405 RETURN
406*
407* End of SLA_GBAMV
408*
409 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilatrans(trans)
ILATRANS
Definition ilatrans.f:58
subroutine sla_gbamv(trans, m, n, kl, ku, alpha, ab, ldab, x, incx, beta, y, incy)
SLA_GBAMV performs a matrix-vector operation to calculate error bounds.
Definition sla_gbamv.f:187
real function slamch(cmach)
SLAMCH
Definition slamch.f:68