LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sla_syamv.f
Go to the documentation of this file.
1*> \brief \b SLA_SYAMV computes a matrix-vector product using a symmetric indefinite 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_SYAMV + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sla_syamv.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_syamv.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_syamv.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SLA_SYAMV( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y,
20* INCY )
21*
22* .. Scalar Arguments ..
23* REAL ALPHA, BETA
24* INTEGER INCX, INCY, LDA, N, UPLO
25* ..
26* .. Array Arguments ..
27* REAL A( LDA, * ), X( * ), Y( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> SLA_SYAMV performs the matrix-vector operation
37*>
38*> y := alpha*abs(A)*abs(x) + beta*abs(y),
39*>
40*> where alpha and beta are scalars, x and y are vectors and A is an
41*> n by n symmetric matrix.
42*>
43*> This function is primarily used in calculating error bounds.
44*> To protect against underflow during evaluation, components in
45*> the resulting vector are perturbed away from zero by (N+1)
46*> times the underflow threshold. To prevent unnecessarily large
47*> errors for block-structure embedded in general matrices,
48*> "symbolically" zero components are not perturbed. A zero
49*> entry is considered "symbolic" if all multiplications involved
50*> in computing that entry have at least one zero multiplicand.
51*> \endverbatim
52*
53* Arguments:
54* ==========
55*
56*> \param[in] UPLO
57*> \verbatim
58*> UPLO is INTEGER
59*> On entry, UPLO specifies whether the upper or lower
60*> triangular part of the array A is to be referenced as
61*> follows:
62*>
63*> UPLO = BLAS_UPPER Only the upper triangular part of A
64*> is to be referenced.
65*>
66*> UPLO = BLAS_LOWER Only the lower triangular part of A
67*> is to be referenced.
68*>
69*> Unchanged on exit.
70*> \endverbatim
71*>
72*> \param[in] N
73*> \verbatim
74*> N is INTEGER
75*> On entry, N specifies the number of columns of the matrix A.
76*> N must be at least zero.
77*> Unchanged on exit.
78*> \endverbatim
79*>
80*> \param[in] ALPHA
81*> \verbatim
82*> ALPHA is REAL .
83*> On entry, ALPHA specifies the scalar alpha.
84*> Unchanged on exit.
85*> \endverbatim
86*>
87*> \param[in] A
88*> \verbatim
89*> A is REAL array, dimension ( LDA, n ).
90*> Before entry, the leading m by n part of the array A must
91*> contain the matrix of coefficients.
92*> Unchanged on exit.
93*> \endverbatim
94*>
95*> \param[in] LDA
96*> \verbatim
97*> LDA is INTEGER
98*> On entry, LDA specifies the first dimension of A as declared
99*> in the calling (sub) program. LDA must be at least
100*> max( 1, n ).
101*> Unchanged on exit.
102*> \endverbatim
103*>
104*> \param[in] X
105*> \verbatim
106*> X is REAL array, dimension
107*> ( 1 + ( n - 1 )*abs( INCX ) )
108*> Before entry, the incremented array X must contain the
109*> vector x.
110*> Unchanged on exit.
111*> \endverbatim
112*>
113*> \param[in] INCX
114*> \verbatim
115*> INCX is INTEGER
116*> On entry, INCX specifies the increment for the elements of
117*> X. INCX must not be zero.
118*> Unchanged on exit.
119*> \endverbatim
120*>
121*> \param[in] BETA
122*> \verbatim
123*> BETA is REAL .
124*> On entry, BETA specifies the scalar beta. When BETA is
125*> supplied as zero then Y need not be set on input.
126*> Unchanged on exit.
127*> \endverbatim
128*>
129*> \param[in,out] Y
130*> \verbatim
131*> Y is REAL array, dimension
132*> ( 1 + ( n - 1 )*abs( INCY ) )
133*> Before entry with BETA non-zero, the incremented array Y
134*> must contain the vector y. On exit, Y is overwritten by the
135*> updated vector y.
136*> \endverbatim
137*>
138*> \param[in] INCY
139*> \verbatim
140*> INCY is INTEGER
141*> On entry, INCY specifies the increment for the elements of
142*> Y. INCY must not be zero.
143*> Unchanged on exit.
144*> \endverbatim
145*
146* Authors:
147* ========
148*
149*> \author Univ. of Tennessee
150*> \author Univ. of California Berkeley
151*> \author Univ. of Colorado Denver
152*> \author NAG Ltd.
153*
154*> \ingroup la_heamv
155*
156*> \par Further Details:
157* =====================
158*>
159*> \verbatim
160*>
161*> Level 2 Blas routine.
162*>
163*> -- Written on 22-October-1986.
164*> Jack Dongarra, Argonne National Lab.
165*> Jeremy Du Croz, Nag Central Office.
166*> Sven Hammarling, Nag Central Office.
167*> Richard Hanson, Sandia National Labs.
168*> -- Modified for the absolute-value product, April 2006
169*> Jason Riedy, UC Berkeley
170*> \endverbatim
171*>
172* =====================================================================
173 SUBROUTINE sla_syamv( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y,
174 $ 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, N, UPLO
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
198* ..
199* .. External Subroutines ..
200 EXTERNAL xerbla, slamch
201 REAL SLAMCH
202* ..
203* .. External Functions ..
204 EXTERNAL ilauplo
205 INTEGER ILAUPLO
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 ( uplo.NE.ilauplo( 'U' ) .AND.
216 $ uplo.NE.ilauplo( 'L' ) ) THEN
217 info = 1
218 ELSE IF( n.LT.0 )THEN
219 info = 2
220 ELSE IF( lda.LT.max( 1, n ) )THEN
221 info = 5
222 ELSE IF( incx.EQ.0 )THEN
223 info = 7
224 ELSE IF( incy.EQ.0 )THEN
225 info = 10
226 END IF
227 IF( info.NE.0 )THEN
228 CALL xerbla( 'SLA_SYAMV', info )
229 RETURN
230 END IF
231*
232* Quick return if possible.
233*
234 IF( ( n.EQ.0 ).OR.( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
235 $ RETURN
236*
237* Set up the start points in X and Y.
238*
239 IF( incx.GT.0 )THEN
240 kx = 1
241 ELSE
242 kx = 1 - ( n - 1 )*incx
243 END IF
244 IF( incy.GT.0 )THEN
245 ky = 1
246 ELSE
247 ky = 1 - ( n - 1 )*incy
248 END IF
249*
250* Set SAFE1 essentially to be the underflow threshold times the
251* number of additions in each row.
252*
253 safe1 = slamch( 'Safe minimum' )
254 safe1 = (n+1)*safe1
255*
256* Form y := alpha*abs(A)*abs(x) + beta*abs(y).
257*
258* The O(N^2) SYMB_ZERO tests could be replaced by O(N) queries to
259* the inexact flag. Still doesn't help change the iteration order
260* to per-column.
261*
262 iy = ky
263 IF ( incx.EQ.1 ) THEN
264 IF ( uplo .EQ. ilauplo( 'U' ) ) THEN
265 DO i = 1, n
266 IF ( beta .EQ. zero ) THEN
267 symb_zero = .true.
268 y( iy ) = 0.0
269 ELSE IF ( y( iy ) .EQ. zero ) THEN
270 symb_zero = .true.
271 ELSE
272 symb_zero = .false.
273 y( iy ) = beta * abs( y( iy ) )
274 END IF
275 IF ( alpha .NE. zero ) THEN
276 DO j = 1, i
277 temp = abs( a( j, i ) )
278 symb_zero = symb_zero .AND.
279 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
280
281 y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
282 END DO
283 DO j = i+1, n
284 temp = abs( a( i, j ) )
285 symb_zero = symb_zero .AND.
286 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
287
288 y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
289 END DO
290 END IF
291
292 IF ( .NOT.symb_zero )
293 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
294
295 iy = iy + incy
296 END DO
297 ELSE
298 DO i = 1, n
299 IF ( beta .EQ. zero ) THEN
300 symb_zero = .true.
301 y( iy ) = 0.0
302 ELSE IF ( y( iy ) .EQ. zero ) THEN
303 symb_zero = .true.
304 ELSE
305 symb_zero = .false.
306 y( iy ) = beta * abs( y( iy ) )
307 END IF
308 IF ( alpha .NE. zero ) THEN
309 DO j = 1, i
310 temp = abs( a( i, j ) )
311 symb_zero = symb_zero .AND.
312 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
313
314 y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
315 END DO
316 DO j = i+1, n
317 temp = abs( a( j, i ) )
318 symb_zero = symb_zero .AND.
319 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
320
321 y( iy ) = y( iy ) + alpha*abs( 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 END IF
331 ELSE
332 IF ( uplo .EQ. ilauplo( 'U' ) ) THEN
333 DO i = 1, n
334 IF ( beta .EQ. zero ) THEN
335 symb_zero = .true.
336 y( iy ) = 0.0
337 ELSE IF ( y( iy ) .EQ. zero ) THEN
338 symb_zero = .true.
339 ELSE
340 symb_zero = .false.
341 y( iy ) = beta * abs( y( iy ) )
342 END IF
343 jx = kx
344 IF ( alpha .NE. zero ) THEN
345 DO j = 1, i
346 temp = abs( a( j, i ) )
347 symb_zero = symb_zero .AND.
348 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
349
350 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
351 jx = jx + incx
352 END DO
353 DO j = i+1, n
354 temp = abs( a( i, j ) )
355 symb_zero = symb_zero .AND.
356 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
357
358 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
359 jx = jx + incx
360 END DO
361 END IF
362
363 IF ( .NOT.symb_zero )
364 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
365
366 iy = iy + incy
367 END DO
368 ELSE
369 DO i = 1, n
370 IF ( beta .EQ. zero ) THEN
371 symb_zero = .true.
372 y( iy ) = 0.0
373 ELSE IF ( y( iy ) .EQ. zero ) THEN
374 symb_zero = .true.
375 ELSE
376 symb_zero = .false.
377 y( iy ) = beta * abs( y( iy ) )
378 END IF
379 jx = kx
380 IF ( alpha .NE. zero ) THEN
381 DO j = 1, i
382 temp = abs( a( i, j ) )
383 symb_zero = symb_zero .AND.
384 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
385
386 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
387 jx = jx + incx
388 END DO
389 DO j = i+1, n
390 temp = abs( a( j, i ) )
391 symb_zero = symb_zero .AND.
392 $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
393
394 y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
395 jx = jx + incx
396 END DO
397 END IF
398
399 IF ( .NOT.symb_zero )
400 $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
401
402 iy = iy + incy
403 END DO
404 END IF
405
406 END IF
407*
408 RETURN
409*
410* End of SLA_SYAMV
411*
412 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilauplo(uplo)
ILAUPLO
Definition ilauplo.f:56
subroutine sla_syamv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
SLA_SYAMV computes a matrix-vector product using a symmetric indefinite matrix to calculate error bou...
Definition sla_syamv.f:175
real function slamch(cmach)
SLAMCH
Definition slamch.f:68