1 *> \brief \b SLA_GBAMV performs a matrix-vector operation to calculate error bounds.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
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">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_gbamv.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_gbamv.f">
21 * SUBROUTINE SLA_GBAMV( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
22 * INCX, BETA, Y, INCY )
24 * .. Scalar Arguments ..
26 * INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
28 * .. Array Arguments ..
29 * REAL AB( LDAB, * ), X( * ), Y( * )
38 *> SLA_GBAMV performs one of the matrix-vector operations
40 *> y := alpha*abs(A)*abs(x) + beta*abs(y),
41 *> or y := alpha*abs(A)**T*abs(x) + beta*abs(y),
43 *> where alpha and beta are scalars, x and y are vectors and A is an
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.
62 *> On entry, TRANS specifies the operation to be performed as
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)
75 *> On entry, M specifies the number of rows of the matrix A.
76 *> M must be at least zero.
83 *> On entry, N specifies the number of columns of the matrix A.
84 *> N must be at least zero.
91 *> The number of subdiagonals within the band of A. KL >= 0.
97 *> The number of superdiagonals within the band of A. KU >= 0.
103 *> On entry, ALPHA specifies the scalar alpha.
104 *> Unchanged on exit.
109 *> AB is REAL array of 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.
118 *> On entry, LDA specifies the first dimension of AB as declared
119 *> in the calling (sub) program. LDAB must be at least
121 *> Unchanged on exit.
126 *> X is REAL array, dimension
127 *> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
129 *> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
130 *> Before entry, the incremented array X must contain the
132 *> Unchanged on exit.
138 *> On entry, INCX specifies the increment for the elements of
139 *> X. INCX must not be zero.
140 *> Unchanged on exit.
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.
153 *> Y is REAL array, dimension
154 *> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
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
165 *> On entry, INCY specifies the increment for the elements of
166 *> Y. INCY must not be zero.
167 *> Unchanged on exit.
169 *> Level 2 Blas routine.
175 *> \author Univ. of Tennessee
176 *> \author Univ. of California Berkeley
177 *> \author Univ. of Colorado Denver
180 *> \date September 2012
182 *> \ingroup realGBcomputational
184 * =====================================================================
185 SUBROUTINE SLA_GBAMV( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
186 $ INCX, BETA, Y, INCY )
188 * -- LAPACK computational routine (version 3.4.2) --
189 * -- LAPACK is a software package provided by Univ. of Tennessee, --
190 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
193 * .. Scalar Arguments ..
195 INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
197 * .. Array Arguments ..
198 REAL AB( LDAB, * ), X( * ), Y( * )
201 * =====================================================================
204 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
206 * .. Local Scalars ..
209 INTEGER I, INFO, IY, J, JX, KX, KY, LENX, LENY, KD, KE
211 * .. External Subroutines ..
212 EXTERNAL XERBLA, SLAMCH
215 * .. External Functions ..
219 * .. Intrinsic Functions ..
220 INTRINSIC MAX, ABS, SIGN
222 * .. Executable Statements ..
224 * Test the input parameters.
227 IF ( .NOT.( ( TRANS.EQ.ILATRANS( 'N' ) )
228 $ .OR. ( TRANS.EQ.ILATRANS( 'T' ) )
229 $ .OR. ( TRANS.EQ.ILATRANS( 'C' ) ) ) ) THEN
231 ELSE IF( M.LT.0 )THEN
233 ELSE IF( N.LT.0 )THEN
235 ELSE IF( KL.LT.0 .OR. KL.GT.M-1 ) THEN
237 ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
239 ELSE IF( LDAB.LT.KL+KU+1 )THEN
241 ELSE IF( INCX.EQ.0 )THEN
243 ELSE IF( INCY.EQ.0 )THEN
247 CALL XERBLA( 'SLA_GBAMV ', INFO )
251 * Quick return if possible.
253 IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
254 $ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
257 * Set LENX and LENY, the lengths of the vectors x and y, and set
258 * up the start points in X and Y.
260 IF( TRANS.EQ.ILATRANS( 'N' ) )THEN
270 KX = 1 - ( LENX - 1 )*INCX
275 KY = 1 - ( LENY - 1 )*INCY
278 * Set SAFE1 essentially to be the underflow threshold times the
279 * number of additions in each row.
281 SAFE1 = SLAMCH( 'Safe minimum' )
284 * Form y := alpha*abs(A)*abs(x) + beta*abs(y).
286 * The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
287 * the inexact flag. Still doesn't help change the iteration order
293 IF ( INCX.EQ.1 ) THEN
294 IF( TRANS.EQ.ILATRANS( 'N' ) )THEN
296 IF ( BETA .EQ. ZERO ) THEN
299 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
303 Y( IY ) = BETA * ABS( Y( IY ) )
305 IF ( ALPHA .NE. ZERO ) THEN
306 DO J = MAX( I-KL, 1 ), MIN( I+KU, LENX )
307 TEMP = ABS( AB( KD+I-J, J ) )
308 SYMB_ZERO = SYMB_ZERO .AND.
309 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
311 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
315 IF ( .NOT.SYMB_ZERO )
316 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
321 IF ( BETA .EQ. ZERO ) THEN
324 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
328 Y( IY ) = BETA * ABS( Y( IY ) )
330 IF ( ALPHA .NE. ZERO ) THEN
331 DO J = MAX( I-KL, 1 ), MIN( I+KU, LENX )
332 TEMP = ABS( AB( KE-I+J, I ) )
333 SYMB_ZERO = SYMB_ZERO .AND.
334 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
336 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
340 IF ( .NOT.SYMB_ZERO )
341 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
346 IF( TRANS.EQ.ILATRANS( 'N' ) )THEN
348 IF ( BETA .EQ. ZERO ) THEN
351 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
355 Y( IY ) = BETA * ABS( Y( IY ) )
357 IF ( ALPHA .NE. ZERO ) THEN
359 DO J = MAX( I-KL, 1 ), MIN( I+KU, LENX )
360 TEMP = ABS( AB( KD+I-J, J ) )
361 SYMB_ZERO = SYMB_ZERO .AND.
362 $ ( X( JX ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
364 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
369 IF ( .NOT.SYMB_ZERO )
370 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
376 IF ( BETA .EQ. ZERO ) THEN
379 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
383 Y( IY ) = BETA * ABS( Y( IY ) )
385 IF ( ALPHA .NE. ZERO ) THEN
387 DO J = MAX( I-KL, 1 ), MIN( I+KU, LENX )
388 TEMP = ABS( AB( KE-I+J, I ) )
389 SYMB_ZERO = SYMB_ZERO .AND.
390 $ ( X( JX ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
392 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
397 IF ( .NOT.SYMB_ZERO )
398 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )