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

◆ pcerrnrm2()

subroutine pcerrnrm2 ( real  errbnd,
integer  n,
real  usclr,
complex, dimension( * )  x,
integer  incx,
real  prec 
)

Definition at line 3425 of file pcblas1tst.f.

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