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

◆ pderrnrm2()

subroutine pderrnrm2 ( double precision  errbnd,
integer  n,
double precision  usclr,
double precision, dimension( * )  x,
integer  incx,
double precision  prec 
)

Definition at line 3046 of file pdblas1tst.f.

3047*
3048* -- PBLAS test routine (version 2.0) --
3049* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
3050* and University of California, Berkeley.
3051* April 1, 1998
3052*
3053* .. Scalar Arguments ..
3054 INTEGER INCX, N
3055 DOUBLE PRECISION ERRBND, PREC, USCLR
3056* ..
3057* .. Array Arguments ..
3058 DOUBLE PRECISION X( * )
3059* ..
3060*
3061* Purpose
3062* =======
3063*
3064* PDERRNRM2 serially computes the 2-norm the vector X and returns a
3065* scaled relative acceptable error bound on the result.
3066*
3067* Notes
3068* =====
3069*
3070* If norm1 = SCLR and norm2 are two different computed results, and
3071* norm1 being assumed to be correct, we require
3072*
3073* abs( norm1 - norm2 ) <= ERRBND = ERRFACT * abs( norm1 ),
3074*
3075* where ERRFACT is computed as the maximum of the positive and negative
3076* partial sums multiplied by a constant proportional to the machine
3077* precision.
3078*
3079* Arguments
3080* =========
3081*
3082* ERRBND (global output) DOUBLE PRECISION
3083* On exit, ERRBND specifies the scaled relative acceptable er-
3084* ror bound.
3085*
3086* N (global input) INTEGER
3087* On entry, N specifies the length of the vector operand.
3088*
3089* USCLR (global output) DOUBLE PRECISION
3090* On exit, USCLR specifies the 2-norm of the vector X.
3091*
3092* X (global input) DOUBLE PRECISION array
3093* On entry, X is an array of dimension at least
3094* ( 1 + ( n - 1 )*abs( INCX ) ). Before entry, the incremen-
3095* ted array X must contain the vector x.
3096*
3097* INCX (global input) INTEGER.
3098* On entry, INCX specifies the increment for the elements of X.
3099* INCX must not be zero.
3100*
3101* PREC (global input) DOUBLE PRECISION
3102* On entry, PREC specifies the machine precision.
3103*
3104* -- Written on April 1, 1998 by
3105* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
3106*
3107* =====================================================================
3108*
3109* .. Parameters ..
3110 DOUBLE PRECISION ONE, TWO, ZERO
3111 parameter( one = 1.0d+0, two = 2.0d+0,
3112 $ zero = 0.0d+0 )
3113* ..
3114* .. Local Scalars ..
3115 INTEGER IX
3116 DOUBLE PRECISION ABSXI, ADDBND, FACT, SCALE, SSQ, SUMSCA, SUMSSQ
3117* ..
3118* .. Intrinsic Functions ..
3119 INTRINSIC abs
3120* ..
3121* .. Executable Statements ..
3122*
3123 usclr = zero
3124 sumssq = one
3125 sumsca = zero
3126 addbnd = two * two * two * prec
3127 fact = one + two * ( ( one + prec )**3 - one )
3128*
3129 scale = zero
3130 ssq = one
3131 DO 10 ix = 1, 1 + ( n - 1 )*incx, incx
3132 IF( x( ix ).NE.zero ) THEN
3133 absxi = abs( x( ix ) )
3134 IF( scale.LT.absxi )THEN
3135 sumssq = one + ( ssq*( scale/absxi )**2 ) * fact
3136 errbnd = addbnd * sumssq
3137 sumssq = sumssq + errbnd
3138 ssq = one + ssq*( scale/absxi )**2
3139 sumsca = absxi
3140 scale = absxi
3141 ELSE
3142 sumssq = ssq + ( ( absxi/scale )**2 ) * fact
3143 errbnd = addbnd * sumssq
3144 sumssq = sumssq + errbnd
3145 ssq = ssq + ( absxi/scale )**2
3146 END IF
3147 END IF
3148 10 CONTINUE
3149*
3150 usclr = scale * sqrt( ssq )
3151*
3152* Error on square root
3153*
3154 errbnd = sqrt( sumssq ) * ( one + two * ( 1.00001d+0 * prec ) )
3155*
3156 errbnd = ( sumsca * errbnd ) - usclr
3157*
3158 RETURN
3159*
3160* End of PDERRNRM2
3161*
Here is the caller graph for this function: