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