LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cla_geamv.f
Go to the documentation of this file.
1*> \brief \b CLA_GEAMV computes a matrix-vector product using a general matrix to calculate error bounds.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLA_GEAMV + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_geamv.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_geamv.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_geamv.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CLA_GEAMV( TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA,
20* Y, INCY )
21*
22* .. Scalar Arguments ..
23* REAL ALPHA, BETA
24* INTEGER INCX, INCY, LDA, M, N
25* INTEGER TRANS
26* ..
27* .. Array Arguments ..
28* COMPLEX A( LDA, * ), X( * )
29* REAL Y( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> CLA_GEAMV 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] ALPHA
89*> \verbatim
90*> ALPHA is REAL
91*> On entry, ALPHA specifies the scalar alpha.
92*> Unchanged on exit.
93*> \endverbatim
94*>
95*> \param[in] A
96*> \verbatim
97*> A is COMPLEX array, dimension (LDA,n)
98*> Before entry, the leading m by n part of the array A must
99*> contain the matrix of coefficients.
100*> Unchanged on exit.
101*> \endverbatim
102*>
103*> \param[in] LDA
104*> \verbatim
105*> LDA is INTEGER
106*> On entry, LDA specifies the first dimension of A as declared
107*> in the calling (sub) program. LDA must be at least
108*> max( 1, m ).
109*> Unchanged on exit.
110*> \endverbatim
111*>
112*> \param[in] X
113*> \verbatim
114*> X is COMPLEX array, dimension
115*> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
116*> and at least
117*> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
118*> Before entry, the incremented array X must contain the
119*> vector x.
120*> Unchanged on exit.
121*> \endverbatim
122*>
123*> \param[in] INCX
124*> \verbatim
125*> INCX is INTEGER
126*> On entry, INCX specifies the increment for the elements of
127*> X. INCX must not be zero.
128*> Unchanged on exit.
129*> \endverbatim
130*>
131*> \param[in] BETA
132*> \verbatim
133*> BETA is REAL
134*> On entry, BETA specifies the scalar beta. When BETA is
135*> supplied as zero then Y need not be set on input.
136*> Unchanged on exit.
137*> \endverbatim
138*>
139*> \param[in,out] Y
140*> \verbatim
141*> Y is REAL array, dimension
142*> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
143*> and at least
144*> ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
145*> Before entry with BETA non-zero, the incremented array Y
146*> must contain the vector y. On exit, Y is overwritten by the
147*> updated vector y.
148*> If either m or n is zero, then Y not referenced and the function
149*> performs a quick return.
150*> \endverbatim
151*>
152*> \param[in] INCY
153*> \verbatim
154*> INCY is INTEGER
155*> On entry, INCY specifies the increment for the elements of
156*> Y. INCY must not be zero.
157*> Unchanged on exit.
158*>
159*> Level 2 Blas routine.
160*> \endverbatim
161*
162* Authors:
163* ========
164*
165*> \author Univ. of Tennessee
166*> \author Univ. of California Berkeley
167*> \author Univ. of Colorado Denver
168*> \author NAG Ltd.
169*
170*> \ingroup la_geamv
171*
172* =====================================================================
173 SUBROUTINE cla_geamv( TRANS, M, N, ALPHA, A, LDA, X, INCX,
174 $ BETA,
175 $ Y, INCY )
176*
177* -- LAPACK computational routine --
178* -- LAPACK is a software package provided by Univ. of Tennessee, --
179* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
180*
181* .. Scalar Arguments ..
182 REAL ALPHA, BETA
183 INTEGER INCX, INCY, LDA, M, N
184 INTEGER TRANS
185* ..
186* .. Array Arguments ..
187 COMPLEX A( LDA, * ), X( * )
188 REAL Y( * )
189* ..
190*
191* =====================================================================
192*
193* .. Parameters ..
194 COMPLEX ONE, ZERO
195 PARAMETER ( ONE = 1.0e+0, zero = 0.0e+0 )
196* ..
197* .. Local Scalars ..
198 LOGICAL SYMB_ZERO
199 REAL TEMP, SAFE1
200 INTEGER I, INFO, IY, J, JX, KX, KY, LENX, LENY
201 COMPLEX CDUM
202* ..
203* .. External Subroutines ..
204 EXTERNAL xerbla, slamch
205 REAL SLAMCH
206* ..
207* .. External Functions ..
208 EXTERNAL ilatrans
209 INTEGER ILATRANS
210* ..
211* .. Intrinsic Functions ..
212 INTRINSIC max, abs, real, aimag, sign
213* ..
214* .. Statement Functions ..
215 REAL CABS1
216* ..
217* .. Statement Function Definitions ..
218 cabs1( cdum ) = abs( real( cdum ) ) + abs( aimag( cdum ) )
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( lda.LT.max( 1, m ) )THEN
234 info = 6
235 ELSE IF( incx.EQ.0 )THEN
236 info = 8
237 ELSE IF( incy.EQ.0 )THEN
238 info = 11
239 END IF
240 IF( info.NE.0 )THEN
241 CALL xerbla( 'CLA_GEAMV ', info )
242 RETURN
243 END IF
244*
245* Quick return if possible.
246*
247 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
248 $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
249 $ RETURN
250*
251* Set LENX and LENY, the lengths of the vectors x and y, and set
252* up the start points in X and Y.
253*
254 IF( trans.EQ.ilatrans( 'N' ) )THEN
255 lenx = n
256 leny = m
257 ELSE
258 lenx = m
259 leny = n
260 END IF
261 IF( incx.GT.0 )THEN
262 kx = 1
263 ELSE
264 kx = 1 - ( lenx - 1 )*incx
265 END IF
266 IF( incy.GT.0 )THEN
267 ky = 1
268 ELSE
269 ky = 1 - ( leny - 1 )*incy
270 END IF
271*
272* Set SAFE1 essentially to be the underflow threshold times the
273* number of additions in each row.
274*
275 safe1 = slamch( 'Safe minimum' )
276 safe1 = (n+1)*safe1
277*
278* Form y := alpha*abs(A)*abs(x) + beta*abs(y).
279*
280* The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
281* the inexact flag. Still doesn't help change the iteration order
282* to per-column.
283*
284 iy = ky
285 IF ( incx.EQ.1 ) THEN
286 IF( trans.EQ.ilatrans( 'N' ) )THEN
287 DO i = 1, leny
288 IF ( beta .EQ. 0.0 ) THEN
289 symb_zero = .true.
290 y( iy ) = 0.0
291 ELSE IF ( y( iy ) .EQ. 0.0 ) THEN
292 symb_zero = .true.
293 ELSE
294 symb_zero = .false.
295 y( iy ) = beta * abs( y( iy ) )
296 END IF
297 IF ( alpha .NE. 0.0 ) THEN
298 DO j = 1, lenx
299 temp = cabs1( a( i, j ) )
300 symb_zero = symb_zero .AND.
301 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
302
303 y( iy ) = y( iy ) + alpha*cabs1( x( j ) )*temp
304 END DO
305 END IF
306
307 IF ( .NOT.symb_zero ) y( iy ) =
308 $ y( iy ) + sign( safe1, y( iy ) )
309
310 iy = iy + incy
311 END DO
312 ELSE
313 DO i = 1, leny
314 IF ( beta .EQ. 0.0 ) THEN
315 symb_zero = .true.
316 y( iy ) = 0.0
317 ELSE IF ( y( iy ) .EQ. 0.0 ) THEN
318 symb_zero = .true.
319 ELSE
320 symb_zero = .false.
321 y( iy ) = beta * abs( y( iy ) )
322 END IF
323 IF ( alpha .NE. 0.0 ) THEN
324 DO j = 1, lenx
325 temp = cabs1( a( j, i ) )
326 symb_zero = symb_zero .AND.
327 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
328
329 y( iy ) = y( iy ) + alpha*cabs1( x( j ) )*temp
330 END DO
331 END IF
332
333 IF ( .NOT.symb_zero ) y( iy ) =
334 $ y( iy ) + sign( safe1, y( iy ) )
335
336 iy = iy + incy
337 END DO
338 END IF
339 ELSE
340 IF( trans.EQ.ilatrans( 'N' ) )THEN
341 DO i = 1, leny
342 IF ( beta .EQ. 0.0 ) THEN
343 symb_zero = .true.
344 y( iy ) = 0.0
345 ELSE IF ( y( iy ) .EQ. 0.0 ) THEN
346 symb_zero = .true.
347 ELSE
348 symb_zero = .false.
349 y( iy ) = beta * abs( y( iy ) )
350 END IF
351 IF ( alpha .NE. 0.0 ) THEN
352 jx = kx
353 DO j = 1, lenx
354 temp = cabs1( a( i, j ) )
355 symb_zero = symb_zero .AND.
356 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
357
358 y( iy ) = y( iy ) + alpha*cabs1( x( jx ) )*temp
359 jx = jx + incx
360 END DO
361 END IF
362
363 IF ( .NOT.symb_zero ) y( iy ) =
364 $ y( iy ) + sign( safe1, y( iy ) )
365
366 iy = iy + incy
367 END DO
368 ELSE
369 DO i = 1, leny
370 IF ( beta .EQ. 0.0 ) THEN
371 symb_zero = .true.
372 y( iy ) = 0.0
373 ELSE IF ( y( iy ) .EQ. 0.0 ) THEN
374 symb_zero = .true.
375 ELSE
376 symb_zero = .false.
377 y( iy ) = beta * abs( y( iy ) )
378 END IF
379 IF ( alpha .NE. 0.0 ) THEN
380 jx = kx
381 DO j = 1, lenx
382 temp = cabs1( a( j, i ) )
383 symb_zero = symb_zero .AND.
384 $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
385
386 y( iy ) = y( iy ) + alpha*cabs1( x( jx ) )*temp
387 jx = jx + incx
388 END DO
389 END IF
390
391 IF ( .NOT.symb_zero ) y( iy ) =
392 $ y( iy ) + sign( safe1, y( iy ) )
393
394 iy = iy + incy
395 END DO
396 END IF
397
398 END IF
399*
400 RETURN
401*
402* End of CLA_GEAMV
403*
404 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilatrans(trans)
ILATRANS
Definition ilatrans.f:56
subroutine cla_geamv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CLA_GEAMV computes a matrix-vector product using a general matrix to calculate error bounds.
Definition cla_geamv.f:176
real function slamch(cmach)
SLAMCH
Definition slamch.f:68