LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cla_heamv()

subroutine cla_heamv ( integer uplo,
integer n,
real alpha,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( * ) x,
integer incx,
real beta,
real, dimension( * ) y,
integer incy )

CLA_HEAMV computes a matrix-vector product using a Hermitian indefinite matrix to calculate error bounds.

Download CLA_HEAMV + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> CLA_SYAMV  performs the matrix-vector operation
!>
!>         y := alpha*abs(A)*abs(x) + beta*abs(y),
!>
!> where alpha and beta are scalars, x and y are vectors and A is an
!> n by n symmetric matrix.
!>
!> This function is primarily used in calculating error bounds.
!> To protect against underflow during evaluation, components in
!> the resulting vector are perturbed away from zero by (N+1)
!> times the underflow threshold.  To prevent unnecessarily large
!> errors for block-structure embedded in general matrices,
!>  zero components are not perturbed.  A zero
!> entry is considered  if all multiplications involved
!> in computing that entry have at least one zero multiplicand.
!> 
Parameters
[in]UPLO
!>          UPLO is INTEGER
!>           On entry, UPLO specifies whether the upper or lower
!>           triangular part of the array A is to be referenced as
!>           follows:
!>
!>              UPLO = BLAS_UPPER   Only the upper triangular part of A
!>                                  is to be referenced.
!>
!>              UPLO = BLAS_LOWER   Only the lower triangular part of A
!>                                  is to be referenced.
!>
!>           Unchanged on exit.
!> 
[in]N
!>          N is INTEGER
!>           On entry, N specifies the number of columns of the matrix A.
!>           N must be at least zero.
!>           Unchanged on exit.
!> 
[in]ALPHA
!>          ALPHA is REAL .
!>           On entry, ALPHA specifies the scalar alpha.
!>           Unchanged on exit.
!> 
[in]A
!>          A is COMPLEX array, dimension ( LDA, n ).
!>           Before entry, the leading m by n part of the array A must
!>           contain the matrix of coefficients.
!>           Unchanged on exit.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in the calling (sub) program. LDA must be at least
!>           max( 1, n ).
!>           Unchanged on exit.
!> 
[in]X
!>          X is COMPLEX array, dimension
!>           ( 1 + ( n - 1 )*abs( INCX ) )
!>           Before entry, the incremented array X must contain the
!>           vector x.
!>           Unchanged on exit.
!> 
[in]INCX
!>          INCX is INTEGER
!>           On entry, INCX specifies the increment for the elements of
!>           X. INCX must not be zero.
!>           Unchanged on exit.
!> 
[in]BETA
!>          BETA is REAL .
!>           On entry, BETA specifies the scalar beta. When BETA is
!>           supplied as zero then Y need not be set on input.
!>           Unchanged on exit.
!> 
[in,out]Y
!>          Y is REAL array, dimension
!>           ( 1 + ( n - 1 )*abs( INCY ) )
!>           Before entry with BETA non-zero, the incremented array Y
!>           must contain the vector y. On exit, Y is overwritten by the
!>           updated vector y.
!> 
[in]INCY
!>          INCY is INTEGER
!>           On entry, INCY specifies the increment for the elements of
!>           Y. INCY must not be zero.
!>           Unchanged on exit.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  Level 2 Blas routine.
!>
!>  -- Written on 22-October-1986.
!>     Jack Dongarra, Argonne National Lab.
!>     Jeremy Du Croz, Nag Central Office.
!>     Sven Hammarling, Nag Central Office.
!>     Richard Hanson, Sandia National Labs.
!>  -- Modified for the absolute-value product, April 2006
!>     Jason Riedy, UC Berkeley
!> 

Definition at line 174 of file cla_heamv.f.

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*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilauplo(uplo)
ILAUPLO
Definition ilauplo.f:56
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: