1 *> \brief \b CLA_HEAMV computes a matrix-vector product using a Hermitian indefinite matrix to calculate error bounds.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CLA_HEAMV + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_heamv.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_heamv.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_heamv.f">
21 * SUBROUTINE CLA_HEAMV( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y,
24 * .. Scalar Arguments ..
26 * INTEGER INCX, INCY, LDA, N, UPLO
28 * .. Array Arguments ..
29 * COMPLEX A( LDA, * ), X( * )
39 *> CLA_SYAMV performs the matrix-vector operation
41 *> y := alpha*abs(A)*abs(x) + beta*abs(y),
43 *> where alpha and beta are scalars, x and y are vectors and A is an
44 *> n by n symmetric matrix.
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.
62 *> On entry, UPLO specifies whether the upper or lower
63 *> triangular part of the array A is to be referenced as
66 *> UPLO = BLAS_UPPER Only the upper triangular part of A
67 *> is to be referenced.
69 *> UPLO = BLAS_LOWER Only the lower triangular part of A
70 *> is to be referenced.
78 *> On entry, N specifies the number of columns of the matrix A.
79 *> N must be at least zero.
86 *> On entry, ALPHA specifies the scalar alpha.
92 *> A is COMPLEX array of DIMENSION ( LDA, n ).
93 *> Before entry, the leading m by n part of the array A must
94 *> contain the matrix of coefficients.
101 *> On entry, LDA specifies the first dimension of A as declared
102 *> in the calling (sub) program. LDA must be at least
104 *> Unchanged on exit.
109 *> X is COMPLEX array, dimension
110 *> ( 1 + ( n - 1 )*abs( INCX ) )
111 *> Before entry, the incremented array X must contain the
113 *> Unchanged on exit.
119 *> On entry, INCX specifies the increment for the elements of
120 *> X. INCX must not be zero.
121 *> Unchanged on exit.
127 *> On entry, BETA specifies the scalar beta. When BETA is
128 *> supplied as zero then Y need not be set on input.
129 *> Unchanged on exit.
134 *> Y is REAL array, dimension
135 *> ( 1 + ( n - 1 )*abs( INCY ) )
136 *> Before entry with BETA non-zero, the incremented array Y
137 *> must contain the vector y. On exit, Y is overwritten by the
144 *> On entry, INCY specifies the increment for the elements of
145 *> Y. INCY must not be zero.
146 *> Unchanged on exit.
152 *> \author Univ. of Tennessee
153 *> \author Univ. of California Berkeley
154 *> \author Univ. of Colorado Denver
157 *> \date September 2012
159 *> \ingroup complexHEcomputational
161 *> \par Further Details:
162 * =====================
166 *> Level 2 Blas routine.
168 *> -- Written on 22-October-1986.
169 *> Jack Dongarra, Argonne National Lab.
170 *> Jeremy Du Croz, Nag Central Office.
171 *> Sven Hammarling, Nag Central Office.
172 *> Richard Hanson, Sandia National Labs.
173 *> -- Modified for the absolute-value product, April 2006
174 *> Jason Riedy, UC Berkeley
177 * =====================================================================
178 SUBROUTINE CLA_HEAMV( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y,
181 * -- LAPACK computational routine (version 3.4.2) --
182 * -- LAPACK is a software package provided by Univ. of Tennessee, --
183 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
186 * .. Scalar Arguments ..
188 INTEGER INCX, INCY, LDA, N, UPLO
190 * .. Array Arguments ..
191 COMPLEX A( LDA, * ), X( * )
195 * =====================================================================
199 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
201 * .. Local Scalars ..
204 INTEGER I, INFO, IY, J, JX, KX, KY
207 * .. External Subroutines ..
208 EXTERNAL XERBLA, SLAMCH
211 * .. External Functions ..
215 * .. Intrinsic Functions ..
216 INTRINSIC MAX, ABS, SIGN, REAL, AIMAG
218 * .. Statement Functions ..
221 * .. Statement Function Definitions ..
222 CABS1( ZDUM ) = ABS( REAL ( ZDUM ) ) + ABS( AIMAG ( ZDUM ) )
224 * .. Executable Statements ..
226 * Test the input parameters.
229 IF ( UPLO.NE.ILAUPLO( 'U' ) .AND.
230 $ UPLO.NE.ILAUPLO( 'L' ) )THEN
232 ELSE IF( N.LT.0 )THEN
234 ELSE IF( LDA.LT.MAX( 1, N ) )THEN
236 ELSE IF( INCX.EQ.0 )THEN
238 ELSE IF( INCY.EQ.0 )THEN
242 CALL XERBLA( 'CHEMV ', INFO )
246 * Quick return if possible.
248 IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
251 * Set up the start points in X and Y.
256 KX = 1 - ( N - 1 )*INCX
261 KY = 1 - ( N - 1 )*INCY
264 * Set SAFE1 essentially to be the underflow threshold times the
265 * number of additions in each row.
267 SAFE1 = SLAMCH( 'Safe minimum' )
270 * Form y := alpha*abs(A)*abs(x) + beta*abs(y).
272 * The O(N^2) SYMB_ZERO tests could be replaced by O(N) queries to
273 * the inexact flag. Still doesn't help change the iteration order
277 IF ( INCX.EQ.1 ) THEN
278 IF ( UPLO .EQ. ILAUPLO( 'U' ) ) THEN
280 IF ( BETA .EQ. ZERO ) THEN
283 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
287 Y( IY ) = BETA * ABS( Y( IY ) )
289 IF ( ALPHA .NE. ZERO ) THEN
291 TEMP = CABS1( A( J, I ) )
292 SYMB_ZERO = SYMB_ZERO .AND.
293 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
295 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( J ) )*TEMP
298 TEMP = CABS1( A( I, J ) )
299 SYMB_ZERO = SYMB_ZERO .AND.
300 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
302 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( J ) )*TEMP
307 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
313 IF ( BETA .EQ. ZERO ) THEN
316 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
320 Y( IY ) = BETA * ABS( Y( IY ) )
322 IF ( ALPHA .NE. ZERO ) THEN
324 TEMP = CABS1( A( I, J ) )
325 SYMB_ZERO = SYMB_ZERO .AND.
326 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
328 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( J ) )*TEMP
331 TEMP = CABS1( A( J, I ) )
332 SYMB_ZERO = SYMB_ZERO .AND.
333 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
335 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( J ) )*TEMP
340 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
346 IF ( UPLO .EQ. ILAUPLO( 'U' ) ) THEN
348 IF ( BETA .EQ. ZERO ) THEN
351 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
355 Y( IY ) = BETA * ABS( Y( IY ) )
358 IF ( ALPHA .NE. ZERO ) THEN
360 TEMP = CABS1( A( J, I ) )
361 SYMB_ZERO = SYMB_ZERO .AND.
362 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
364 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( JX ) )*TEMP
368 TEMP = CABS1( A( I, J ) )
369 SYMB_ZERO = SYMB_ZERO .AND.
370 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
372 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( JX ) )*TEMP
377 IF ( .NOT.SYMB_ZERO )
378 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
384 IF ( BETA .EQ. ZERO ) THEN
387 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
391 Y( IY ) = BETA * ABS( Y( IY ) )
394 IF ( ALPHA .NE. ZERO ) THEN
396 TEMP = CABS1( A( I, J ) )
397 SYMB_ZERO = SYMB_ZERO .AND.
398 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
400 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( JX ) )*TEMP
404 TEMP = CABS1( A( J, I ) )
405 SYMB_ZERO = SYMB_ZERO .AND.
406 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
408 Y( IY ) = Y( IY ) + ALPHA*CABS1( X( JX ) )*TEMP
413 IF ( .NOT.SYMB_ZERO )
414 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )