SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pzerrnrm2()

subroutine pzerrnrm2 ( double precision  errbnd,
integer  n,
double precision  usclr,
complex*16, dimension( * )  x,
integer  incx,
double precision  prec 
)

Definition at line 3424 of file pzblas1tst.f.

3425*
3426* -- PBLAS test routine (version 2.0) --
3427* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
3428* and University of California, Berkeley.
3429* April 1, 1998
3430*
3431* .. Scalar Arguments ..
3432 INTEGER INCX, N
3433 DOUBLE PRECISION ERRBND, PREC, USCLR
3434* ..
3435* .. Array Arguments ..
3436 COMPLEX*16 X( * )
3437* ..
3438*
3439* Purpose
3440* =======
3441*
3442* PZERRNRM2 serially computes the 2-norm the vector X and returns a
3443* scaled relative acceptable error bound on the result.
3444*
3445* Notes
3446* =====
3447*
3448* If norm1 = SCLR and norm2 are two different computed results, and
3449* norm1 being assumed to be correct, we require
3450*
3451* abs( norm1 - norm2 ) <= ERRBND = ERRFACT * abs( norm1 ),
3452*
3453* where ERRFACT is computed as the maximum of the positive and negative
3454* partial sums multiplied by a constant proportional to the machine
3455* precision.
3456*
3457* Arguments
3458* =========
3459*
3460* ERRBND (global output) DOUBLE PRECISION
3461* On exit, ERRBND specifies the scaled relative acceptable er-
3462* ror bound.
3463*
3464* N (global input) INTEGER
3465* On entry, N specifies the length of the vector operand.
3466*
3467* USCLR (global output) DOUBLE PRECISION
3468* On exit, USCLR specifies the 2-norm of the vector X.
3469*
3470* X (global input) COMPLEX*16 array
3471* On entry, X is an array of dimension at least
3472* ( 1 + ( n - 1 )*abs( INCX ) ). Before entry, the incremen-
3473* ted array X must contain the vector x.
3474*
3475* INCX (global input) INTEGER.
3476* On entry, INCX specifies the increment for the elements of X.
3477* INCX must not be zero.
3478*
3479* PREC (global input) DOUBLE PRECISION
3480* On entry, PREC specifies the machine precision.
3481*
3482* -- Written on April 1, 1998 by
3483* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
3484*
3485* =====================================================================
3486*
3487* .. Parameters ..
3488 DOUBLE PRECISION ONE, TWO, ZERO
3489 parameter( one = 1.0d+0, two = 2.0d+0,
3490 $ zero = 0.0d+0 )
3491* ..
3492* .. Local Scalars ..
3493 INTEGER IX
3494 DOUBLE PRECISION ABSXI, ADDBND, FACT, SCALE, SSQ, SUMSCA, SUMSSQ
3495* ..
3496* .. Intrinsic Functions ..
3497 INTRINSIC abs, dble, dimag
3498* ..
3499* .. Executable Statements ..
3500*
3501 usclr = zero
3502 sumssq = one
3503 sumsca = zero
3504 addbnd = two * two * two * prec
3505 fact = one + two * ( ( one + prec )**3 - one )
3506*
3507 scale = zero
3508 ssq = one
3509 DO 10 ix = 1, 1 + ( n - 1 )*incx, incx
3510 IF( dble( x( ix ) ).NE.zero ) THEN
3511 absxi = abs( dble( x( ix ) ) )
3512 IF( scale.LT.absxi )THEN
3513 sumssq = one + ( ssq*( scale/absxi )**2 ) * fact
3514 errbnd = addbnd * sumssq
3515 sumssq = sumssq + errbnd
3516 ssq = one + ssq*( scale/absxi )**2
3517 sumsca = absxi
3518 scale = absxi
3519 ELSE
3520 sumssq = ssq + ( ( absxi/scale )**2 ) * fact
3521 errbnd = addbnd * sumssq
3522 sumssq = sumssq + errbnd
3523 ssq = ssq + ( absxi/scale )**2
3524 END IF
3525 END IF
3526 IF( dimag( x( ix ) ).NE.zero ) THEN
3527 absxi = abs( dimag( x( ix ) ) )
3528 IF( scale.LT.absxi )THEN
3529 sumssq = one + ( ssq*( scale/absxi )**2 ) * fact
3530 errbnd = addbnd * sumssq
3531 sumssq = sumssq + errbnd
3532 ssq = one + ssq*( scale/absxi )**2
3533 sumsca = absxi
3534 scale = absxi
3535 ELSE
3536 sumssq = ssq + ( ( absxi/scale )**2 ) * fact
3537 errbnd = addbnd * sumssq
3538 sumssq = sumssq + errbnd
3539 ssq = ssq + ( absxi/scale )**2
3540 END IF
3541 END IF
3542 10 CONTINUE
3543*
3544 usclr = scale * sqrt( ssq )
3545*
3546* Error on square root
3547*
3548 errbnd = sqrt( sumssq ) * ( one + two * ( 1.00001d+0 * prec ) )
3549*
3550 errbnd = ( sumsca * errbnd ) - usclr
3551*
3552 RETURN
3553*
3554* End of PZERRNRM2
3555*
Here is the caller graph for this function: