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