LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
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, 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*> If either m or n is zero, then Y not referenced and the function
162*> performs a quick return.
163*> \endverbatim
164*>
165*> \param[in] INCY
166*> \verbatim
167*> INCY is INTEGER
168*> On entry, INCY specifies the increment for the elements of
169*> Y. INCY must not be zero.
170*> Unchanged on exit.
171*>
172*> Level 2 Blas routine.
173*> \endverbatim
174*
175* Authors:
176* ========
177*
178*> \author Univ. of Tennessee
179*> \author Univ. of California Berkeley
180*> \author Univ. of Colorado Denver
181*> \author NAG Ltd.
182*
183*> \ingroup la_gbamv
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 --
190* -- LAPACK is a software package provided by Univ. of Tennessee, --
191* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
192*
193* .. Scalar Arguments ..
194 DOUBLE PRECISION ALPHA, BETA
195 INTEGER INCX, INCY, LDAB, M, N, KL, KU, TRANS
196* ..
197* .. Array Arguments ..
198 COMPLEX*16 AB( LDAB, * ), X( * )
199 DOUBLE PRECISION Y( * )
200* ..
201*
202* =====================================================================
203*
204* .. Parameters ..
205 COMPLEX*16 ONE, ZERO
206 parameter( one = 1.0d+0, zero = 0.0d+0 )
207* ..
208* .. Local Scalars ..
209 LOGICAL SYMB_ZERO
210 DOUBLE PRECISION TEMP, SAFE1
211 INTEGER I, INFO, IY, J, JX, KX, KY, LENX, LENY, KD, KE
212 COMPLEX*16 CDUM
213* ..
214* .. External Subroutines ..
215 EXTERNAL xerbla, dlamch
216 DOUBLE PRECISION DLAMCH
217* ..
218* .. External Functions ..
219 EXTERNAL ilatrans
220 INTEGER ILATRANS
221* ..
222* .. Intrinsic Functions ..
223 INTRINSIC max, abs, real, dimag, sign
224* ..
225* .. Statement Functions
226 DOUBLE PRECISION CABS1
227* ..
228* .. Statement Function Definitions ..
229 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
230* ..
231* .. Executable Statements ..
232*
233* Test the input parameters.
234*
235 info = 0
236 IF ( .NOT.( ( trans.EQ.ilatrans( 'N' ) )
237 $ .OR. ( trans.EQ.ilatrans( 'T' ) )
238 $ .OR. ( trans.EQ.ilatrans( 'C' ) ) ) ) THEN
239 info = 1
240 ELSE IF( m.LT.0 )THEN
241 info = 2
242 ELSE IF( n.LT.0 )THEN
243 info = 3
244 ELSE IF( kl.LT.0 .OR. kl.GT.m-1 ) THEN
245 info = 4
246 ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
247 info = 5
248 ELSE IF( ldab.LT.kl+ku+1 )THEN
249 info = 6
250 ELSE IF( incx.EQ.0 )THEN
251 info = 8
252 ELSE IF( incy.EQ.0 )THEN
253 info = 11
254 END IF
255 IF( info.NE.0 )THEN
256 CALL xerbla( 'ZLA_GBAMV ', info )
257 RETURN
258 END IF
259*
260* Quick return if possible.
261*
262 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
263 $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
264 $ RETURN
265*
266* Set LENX and LENY, the lengths of the vectors x and y, and set
267* up the start points in X and Y.
268*
269 IF( trans.EQ.ilatrans( 'N' ) )THEN
270 lenx = n
271 leny = m
272 ELSE
273 lenx = m
274 leny = n
275 END IF
276 IF( incx.GT.0 )THEN
277 kx = 1
278 ELSE
279 kx = 1 - ( lenx - 1 )*incx
280 END IF
281 IF( incy.GT.0 )THEN
282 ky = 1
283 ELSE
284 ky = 1 - ( leny - 1 )*incy
285 END IF
286*
287* Set SAFE1 essentially to be the underflow threshold times the
288* number of additions in each row.
289*
290 safe1 = dlamch( 'Safe minimum' )
291 safe1 = (n+1)*safe1
292*
293* Form y := alpha*abs(A)*abs(x) + beta*abs(y).
294*
295* The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
296* the inexact flag. Still doesn't help change the iteration order
297* to per-column.
298*
299 kd = ku + 1
300 ke = kl + 1
301 iy = ky
302 IF ( incx.EQ.1 ) THEN
303 IF( trans.EQ.ilatrans( 'N' ) )THEN
304 DO i = 1, leny
305 IF ( beta .EQ. 0.0d+0 ) THEN
306 symb_zero = .true.
307 y( iy ) = 0.0d+0
308 ELSE IF ( y( iy ) .EQ. 0.0d+0 ) THEN
309 symb_zero = .true.
310 ELSE
311 symb_zero = .false.
312 y( iy ) = beta * abs( y( iy ) )
313 END IF
314 IF ( alpha .NE. 0.0d+0 ) THEN
315 DO j = max( i-kl, 1 ), min( i+ku, lenx )
316 temp = cabs1( ab( kd+i-j, j ) )
317 symb_zero = symb_zero .AND.
318 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
319
320 y( iy ) = y( iy ) + alpha*cabs1( x( j ) )*temp
321 END DO
322 END IF
323
324 IF ( .NOT.symb_zero)
325 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
326
327 iy = iy + incy
328 END DO
329 ELSE
330 DO i = 1, leny
331 IF ( beta .EQ. 0.0d+0 ) THEN
332 symb_zero = .true.
333 y( iy ) = 0.0d+0
334 ELSE IF ( y( iy ) .EQ. 0.0d+0 ) THEN
335 symb_zero = .true.
336 ELSE
337 symb_zero = .false.
338 y( iy ) = beta * abs( y( iy ) )
339 END IF
340 IF ( alpha .NE. 0.0d+0 ) THEN
341 DO j = max( i-kl, 1 ), min( i+ku, lenx )
342 temp = cabs1( ab( ke-i+j, i ) )
343 symb_zero = symb_zero .AND.
344 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
345
346 y( iy ) = y( iy ) + alpha*cabs1( x( j ) )*temp
347 END DO
348 END IF
349
350 IF ( .NOT.symb_zero)
351 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
352
353 iy = iy + incy
354 END DO
355 END IF
356 ELSE
357 IF( trans.EQ.ilatrans( 'N' ) )THEN
358 DO i = 1, leny
359 IF ( beta .EQ. 0.0d+0 ) THEN
360 symb_zero = .true.
361 y( iy ) = 0.0d+0
362 ELSE IF ( y( iy ) .EQ. 0.0d+0 ) THEN
363 symb_zero = .true.
364 ELSE
365 symb_zero = .false.
366 y( iy ) = beta * abs( y( iy ) )
367 END IF
368 IF ( alpha .NE. 0.0d+0 ) THEN
369 jx = kx
370 DO j = max( i-kl, 1 ), min( i+ku, lenx )
371 temp = cabs1( ab( kd+i-j, j ) )
372 symb_zero = symb_zero .AND.
373 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
374
375 y( iy ) = y( iy ) + alpha*cabs1( x( jx ) )*temp
376 jx = jx + incx
377 END DO
378 END IF
379
380 IF ( .NOT.symb_zero )
381 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
382
383 iy = iy + incy
384 END DO
385 ELSE
386 DO i = 1, leny
387 IF ( beta .EQ. 0.0d+0 ) THEN
388 symb_zero = .true.
389 y( iy ) = 0.0d+0
390 ELSE IF ( y( iy ) .EQ. 0.0d+0 ) THEN
391 symb_zero = .true.
392 ELSE
393 symb_zero = .false.
394 y( iy ) = beta * abs( y( iy ) )
395 END IF
396 IF ( alpha .NE. 0.0d+0 ) THEN
397 jx = kx
398 DO j = max( i-kl, 1 ), min( i+ku, lenx )
399 temp = cabs1( ab( ke-i+j, i ) )
400 symb_zero = symb_zero .AND.
401 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
402
403 y( iy ) = y( iy ) + alpha*cabs1( x( jx ) )*temp
404 jx = jx + incx
405 END DO
406 END IF
407
408 IF ( .NOT.symb_zero )
409 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
410
411 iy = iy + incy
412 END DO
413 END IF
414
415 END IF
416*
417 RETURN
418*
419* End of ZLA_GBAMV
420*
421 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilatrans(trans)
ILATRANS
Definition ilatrans.f:58
subroutine zla_gbamv(trans, m, n, kl, ku, alpha, ab, ldab, x, incx, beta, y, incy)
ZLA_GBAMV performs a matrix-vector operation to calculate error bounds.
Definition zla_gbamv.f:188
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69