LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
dla_gbamv.f
Go to the documentation of this file.
1 *> \brief \b DLA_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 DLA_GBAMV + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_gbamv.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_gbamv.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_gbamv.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE DLA_GBAMV( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
22 * INCX, BETA, Y, INCY )
23 *
24 * .. Scalar Arguments ..
25 * DOUBLE PRECISION ALPHA, BETA
26 * INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
27 * ..
28 * .. Array Arguments ..
29 * DOUBLE PRECISION AB( LDAB, * ), X( * ), Y( * )
30 * ..
31 *
32 *
33 *> \par Purpose:
34 * =============
35 *>
36 *> \verbatim
37 *>
38 *> DLA_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 DOUBLE PRECISION
103 *> On entry, ALPHA specifies the scalar alpha.
104 *> Unchanged on exit.
105 *> \endverbatim
106 *>
107 *> \param[in] AB
108 *> \verbatim
109 *> AB is DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION
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 DOUBLE PRECISION 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 *> \endverbatim
161 *>
162 *> \param[in] INCY
163 *> \verbatim
164 *> INCY is INTEGER
165 *> On entry, INCY specifies the increment for the elements of
166 *> Y. INCY must not be zero.
167 *> Unchanged on exit.
168 *>
169 *> Level 2 Blas routine.
170 *> \endverbatim
171 *
172 * Authors:
173 * ========
174 *
175 *> \author Univ. of Tennessee
176 *> \author Univ. of California Berkeley
177 *> \author Univ. of Colorado Denver
178 *> \author NAG Ltd.
179 *
180 *> \ingroup doubleGBcomputational
181 *
182 * =====================================================================
183  SUBROUTINE dla_gbamv( TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X,
184  $ INCX, BETA, Y, INCY )
185 *
186 * -- LAPACK computational routine --
187 * -- LAPACK is a software package provided by Univ. of Tennessee, --
188 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
189 *
190 * .. Scalar Arguments ..
191  DOUBLE PRECISION ALPHA, BETA
192  INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
193 * ..
194 * .. Array Arguments ..
195  DOUBLE PRECISION AB( LDAB, * ), X( * ), Y( * )
196 * ..
197 *
198 * =====================================================================
199 *
200 * .. Parameters ..
201  DOUBLE PRECISION ONE, ZERO
202  parameter( one = 1.0d+0, zero = 0.0d+0 )
203 * ..
204 * .. Local Scalars ..
205  LOGICAL SYMB_ZERO
206  DOUBLE PRECISION TEMP, SAFE1
207  INTEGER I, INFO, IY, J, JX, KX, KY, LENX, LENY, KD, KE
208 * ..
209 * .. External Subroutines ..
210  EXTERNAL xerbla, dlamch
211  DOUBLE PRECISION DLAMCH
212 * ..
213 * .. External Functions ..
214  EXTERNAL ilatrans
215  INTEGER ILATRANS
216 * ..
217 * .. Intrinsic Functions ..
218  INTRINSIC max, abs, sign
219 * ..
220 * .. Executable Statements ..
221 *
222 * Test the input parameters.
223 *
224  info = 0
225  IF ( .NOT.( ( trans.EQ.ilatrans( 'N' ) )
226  $ .OR. ( trans.EQ.ilatrans( 'T' ) )
227  $ .OR. ( trans.EQ.ilatrans( 'C' ) ) ) ) THEN
228  info = 1
229  ELSE IF( m.LT.0 )THEN
230  info = 2
231  ELSE IF( n.LT.0 )THEN
232  info = 3
233  ELSE IF( kl.LT.0 .OR. kl.GT.m-1 ) THEN
234  info = 4
235  ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
236  info = 5
237  ELSE IF( ldab.LT.kl+ku+1 )THEN
238  info = 6
239  ELSE IF( incx.EQ.0 )THEN
240  info = 8
241  ELSE IF( incy.EQ.0 )THEN
242  info = 11
243  END IF
244  IF( info.NE.0 )THEN
245  CALL xerbla( 'DLA_GBAMV ', info )
246  RETURN
247  END IF
248 *
249 * Quick return if possible.
250 *
251  IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
252  $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
253  $ RETURN
254 *
255 * Set LENX and LENY, the lengths of the vectors x and y, and set
256 * up the start points in X and Y.
257 *
258  IF( trans.EQ.ilatrans( 'N' ) )THEN
259  lenx = n
260  leny = m
261  ELSE
262  lenx = m
263  leny = n
264  END IF
265  IF( incx.GT.0 )THEN
266  kx = 1
267  ELSE
268  kx = 1 - ( lenx - 1 )*incx
269  END IF
270  IF( incy.GT.0 )THEN
271  ky = 1
272  ELSE
273  ky = 1 - ( leny - 1 )*incy
274  END IF
275 *
276 * Set SAFE1 essentially to be the underflow threshold times the
277 * number of additions in each row.
278 *
279  safe1 = dlamch( 'Safe minimum' )
280  safe1 = (n+1)*safe1
281 *
282 * Form y := alpha*abs(A)*abs(x) + beta*abs(y).
283 *
284 * The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
285 * the inexact flag. Still doesn't help change the iteration order
286 * to per-column.
287 *
288  kd = ku + 1
289  ke = kl + 1
290  iy = ky
291  IF ( incx.EQ.1 ) THEN
292  IF( trans.EQ.ilatrans( 'N' ) )THEN
293  DO i = 1, leny
294  IF ( beta .EQ. zero ) THEN
295  symb_zero = .true.
296  y( iy ) = 0.0d+0
297  ELSE IF ( y( iy ) .EQ. zero ) THEN
298  symb_zero = .true.
299  ELSE
300  symb_zero = .false.
301  y( iy ) = beta * abs( y( iy ) )
302  END IF
303  IF ( alpha .NE. zero ) THEN
304  DO j = max( i-kl, 1 ), min( i+ku, lenx )
305  temp = abs( ab( kd+i-j, j ) )
306  symb_zero = symb_zero .AND.
307  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
308 
309  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
310  END DO
311  END IF
312 
313  IF ( .NOT.symb_zero )
314  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
315  iy = iy + incy
316  END DO
317  ELSE
318  DO i = 1, leny
319  IF ( beta .EQ. zero ) THEN
320  symb_zero = .true.
321  y( iy ) = 0.0d+0
322  ELSE IF ( y( iy ) .EQ. zero ) THEN
323  symb_zero = .true.
324  ELSE
325  symb_zero = .false.
326  y( iy ) = beta * abs( y( iy ) )
327  END IF
328  IF ( alpha .NE. zero ) THEN
329  DO j = max( i-kl, 1 ), min( i+ku, lenx )
330  temp = abs( ab( ke-i+j, i ) )
331  symb_zero = symb_zero .AND.
332  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
333 
334  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
335  END DO
336  END IF
337 
338  IF ( .NOT.symb_zero )
339  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
340  iy = iy + incy
341  END DO
342  END IF
343  ELSE
344  IF( trans.EQ.ilatrans( 'N' ) )THEN
345  DO i = 1, leny
346  IF ( beta .EQ. zero ) THEN
347  symb_zero = .true.
348  y( iy ) = 0.0d+0
349  ELSE IF ( y( iy ) .EQ. zero ) THEN
350  symb_zero = .true.
351  ELSE
352  symb_zero = .false.
353  y( iy ) = beta * abs( y( iy ) )
354  END IF
355  IF ( alpha .NE. zero ) THEN
356  jx = kx
357  DO j = max( i-kl, 1 ), min( i+ku, lenx )
358  temp = abs( ab( kd+i-j, j ) )
359  symb_zero = symb_zero .AND.
360  $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
361 
362  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
363  jx = jx + incx
364  END DO
365  END IF
366 
367  IF ( .NOT.symb_zero )
368  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
369 
370  iy = iy + incy
371  END DO
372  ELSE
373  DO i = 1, leny
374  IF ( beta .EQ. zero ) THEN
375  symb_zero = .true.
376  y( iy ) = 0.0d+0
377  ELSE IF ( y( iy ) .EQ. zero ) THEN
378  symb_zero = .true.
379  ELSE
380  symb_zero = .false.
381  y( iy ) = beta * abs( y( iy ) )
382  END IF
383  IF ( alpha .NE. zero ) THEN
384  jx = kx
385  DO j = max( i-kl, 1 ), min( i+ku, lenx )
386  temp = abs( ab( ke-i+j, i ) )
387  symb_zero = symb_zero .AND.
388  $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
389 
390  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
391  jx = jx + incx
392  END DO
393  END IF
394 
395  IF ( .NOT.symb_zero )
396  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
397 
398  iy = iy + incy
399  END DO
400  END IF
401 
402  END IF
403 *
404  RETURN
405 *
406 * End of DLA_GBAMV
407 *
408  END
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:58
subroutine dla_gbamv(TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X, INCX, BETA, Y, INCY)
DLA_GBAMV performs a matrix-vector operation to calculate error bounds.
Definition: dla_gbamv.f:185