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