📄 pdsteqr.f
字号:
* .. Executable Statements ..* PDLAMC3 = A + B* RETURN** End of DLAMC3* END************************************************************************** SUBROUTINE PDLAMC4( EMIN, START, BASE )** -- LAPACK auxiliary routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* October 31, 1992** .. Scalar Arguments .. INTEGER BASE, EMIN DOUBLE PRECISION START* ..** Purpose* =======** DLAMC4 is a service routine for DLAMC2.** Arguments* =========** EMIN (output) EMIN* The minimum exponent before (gradual) underflow, computed by* setting A = START and dividing by BASE until the previous A* can not be recovered.** START (input) DOUBLE PRECISION* The starting point for determining EMIN.** BASE (input) INTEGER* The base of the machine.** =====================================================================** .. Local Scalars .. INTEGER I DOUBLE PRECISION A, B1, B2, C1, C2, D1, D2, ONE, RBASE, ZERO* ..* .. External Functions .. DOUBLE PRECISION PDLAMC3 EXTERNAL PDLAMC3* ..* .. Executable Statements ..* A = START ONE = 1 RBASE = ONE / BASE ZERO = 0 EMIN = 1 B1 = PDLAMC3( A*RBASE, ZERO ) C1 = A C2 = A D1 = A D2 = A*+ WHILE( ( C1.EQ.A ).AND.( C2.EQ.A ).AND.* $ ( D1.EQ.A ).AND.( D2.EQ.A ) )LOOP 10 CONTINUE IF( ( C1.EQ.A ) .AND. ( C2.EQ.A ) .AND. ( D1.EQ.A ) .AND. $ ( D2.EQ.A ) ) THEN EMIN = EMIN - 1 A = B1 B1 = PDLAMC3( A / BASE, ZERO ) C1 = PDLAMC3( B1*BASE, ZERO ) D1 = ZERO DO 20 I = 1, BASE D1 = D1 + B1 20 CONTINUE B2 = PDLAMC3( A*RBASE, ZERO ) C2 = PDLAMC3( B2 / RBASE, ZERO ) D2 = ZERO DO 30 I = 1, BASE D2 = D2 + B2 30 CONTINUE GO TO 10 END IF*+ END WHILE* RETURN** End of DLAMC4* END************************************************************************** SUBROUTINE PDLAMC5( BETA, P, EMIN, IEEE, EMAX, RMAX )** -- LAPACK auxiliary routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* October 31, 1992** .. Scalar Arguments .. LOGICAL IEEE INTEGER BETA, EMAX, EMIN, P DOUBLE PRECISION RMAX* ..** Purpose* =======** DLAMC5 attempts to compute RMAX, the largest machine floating-point* number, without overflow. It assumes that EMAX + abs(EMIN) sum* approximately to a power of 2. It will fail on machines where this* assumption does not hold, for example, the Cyber 205 (EMIN = -28625,* EMAX = 28718). It will also fail if the value supplied for EMIN is* too large (i.e. too close to zero), probably with overflow.** Arguments* =========** BETA (input) INTEGER* The base of floating-point arithmetic.** P (input) INTEGER* The number of base BETA digits in the mantissa of a* floating-point value.** EMIN (input) INTEGER* The minimum exponent before (gradual) underflow.** IEEE (input) LOGICAL* A logical flag specifying whether or not the arithmetic* system is thought to comply with the IEEE standard.** EMAX (output) INTEGER* The largest exponent before overflow** RMAX (output) DOUBLE PRECISION* The largest machine floating-point number.** =====================================================================** .. Parameters .. DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )* ..* .. Local Scalars .. INTEGER EXBITS, EXPSUM, I, LEXP, NBITS, TRY, UEXP DOUBLE PRECISION OLDY, RECBAS, Y, Z* ..* .. External Functions .. DOUBLE PRECISION PDLAMC3 EXTERNAL PDLAMC3* ..* .. Intrinsic Functions .. INTRINSIC MOD* ..* .. Executable Statements ..** First compute LEXP and UEXP, two powers of 2 that bound* abs(EMIN). We then assume that EMAX + abs(EMIN) will sum* approximately to the bound that is closest to abs(EMIN).* (EMAX is the exponent of the required number RMAX).* LEXP = 1 EXBITS = 1 10 CONTINUE TRY = LEXP*2 IF( TRY.LE.( -EMIN ) ) THEN LEXP = TRY EXBITS = EXBITS + 1 GO TO 10 END IF IF( LEXP.EQ.-EMIN ) THEN UEXP = LEXP ELSE UEXP = TRY EXBITS = EXBITS + 1 END IF** Now -LEXP is less than or equal to EMIN, and -UEXP is greater* than or equal to EMIN. EXBITS is the number of bits needed to* store the exponent.* IF( ( UEXP+EMIN ).GT.( -LEXP-EMIN ) ) THEN EXPSUM = 2*LEXP ELSE EXPSUM = 2*UEXP END IF** EXPSUM is the exponent range, approximately equal to* EMAX - EMIN + 1 .* EMAX = EXPSUM + EMIN - 1 NBITS = 1 + EXBITS + P** NBITS is the total number of bits needed to store a* floating-point number.* IF( ( MOD( NBITS, 2 ).EQ.1 ) .AND. ( BETA.EQ.2 ) ) THEN** Either there are an odd number of bits used to store a* floating-point number, which is unlikely, or some bits are* not used in the representation of numbers, which is possible,* (e.g. Cray machines) or the mantissa has an implicit bit,* (e.g. IEEE machines, Dec Vax machines), which is perhaps the* most likely. We have to assume the last alternative.* If this is true, then we need to reduce EMAX by one because* there must be some way of representing zero in an implicit-bit* system. On machines like Cray, we are reducing EMAX by one* unnecessarily.* EMAX = EMAX - 1 END IF* IF( IEEE ) THEN** Assume we are on an IEEE machine which reserves one exponent* for infinity and NaN.* EMAX = EMAX - 1 END IF** Now create RMAX, the largest machine number, which should* be equal to (1.0 - BETA**(-P)) * BETA**EMAX .** First compute 1.0 - BETA**(-P), being careful that the* result is less than 1.0 .* RECBAS = ONE / BETA Z = BETA - ONE Y = ZERO DO 20 I = 1, P Z = Z*RECBAS IF( Y.LT.ONE ) $ OLDY = Y Y = PDLAMC3( Y, Z ) 20 CONTINUE IF( Y.GE.ONE ) $ Y = OLDY** Now multiply by BETA**EMAX to get RMAX.* DO 30 I = 1, EMAX Y = PDLAMC3( Y*BETA, ZERO ) 30 CONTINUE* RMAX = Y RETURN** End of DLAMC5* END DOUBLE PRECISION FUNCTION PDLANST( NORM, N, D, E )** -- LAPACK auxiliary routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* February 29, 1992** .. Scalar Arguments .. CHARACTER NORM INTEGER N* ..* .. Array Arguments .. DOUBLE PRECISION D( * ), E( * )* ..** Purpose* =======** DLANST returns the value of the one norm, or the Frobenius norm, or* the infinity norm, or the element of largest absolute value of a* real symmetric tridiagonal matrix A.** Description* ===========** DLANST returns the value** DLANST = ( max(abs(A(i,j))), NORM = 'M' or 'm'* (* ( norm1(A), NORM = '1', 'O' or 'o'* (* ( normI(A), NORM = 'I' or 'i'* (* ( normF(A), NORM = 'F', 'f', 'E' or 'e'** where norm1 denotes the one norm of a matrix (maximum column sum),* normI denotes the infinity norm of a matrix (maximum row sum) and* normF denotes the Frobenius norm of a matrix (square root of sum of* squares). Note that max(abs(A(i,j))) is not a matrix norm.** Arguments* =========** NORM (input) CHARACTER*1* Specifies the value to be returned in DLANST as described* above.** N (input) INTEGER* The order of the matrix A. N >= 0. When N = 0, DLANST is* set to zero.** D (input) DOUBLE PRECISION array, dimension (N)* The diagonal elements of A.** E (input) DOUBLE PRECISION array, dimension (N-1)* The (n-1) sub-diagonal or super-diagonal elements of A.** =====================================================================** .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* ..* .. Local Scalars .. INTEGER I DOUBLE PRECISION ANORM, SCALE, SUM* ..* .. External Functions .. LOGICAL PLSAME EXTERNAL PLSAME* ..* .. External Subroutines .. EXTERNAL PDLASSQ* ..* .. Intrinsic Functions .. INTRINSIC ABS, MAX, SQRT* ..* .. Executable Statements ..* IF( N.LE.0 ) THEN ANORM = ZERO ELSE IF( PLSAME( NORM, 'M' ) ) THEN** Find max(abs(A(i,j))).* ANORM = ABS( D( N ) ) DO 10 I = 1, N - 1 ANORM = MAX( ANORM, ABS( D( I ) ) ) ANORM = MAX( ANORM, ABS( E( I ) ) ) 10 CONTINUE ELSE IF( PLSAME( NORM, 'O' ) .OR. NORM.EQ.'1' .OR. $ PLSAME( NORM, 'I' ) ) THEN** Find norm1(A).* IF( N.EQ.1 ) THEN ANORM = ABS( D( 1 ) ) ELSE ANORM = MAX( ABS( D( 1 ) )+ABS( E( 1 ) ), $ ABS( E( N-1 ) )+ABS( D( N ) ) ) DO 20 I = 2, N - 1 ANORM = MAX( ANORM, ABS( D( I ) )+ABS( E( I ) )+ $ ABS( E( I-1 ) ) ) 20 CONTINUE END IF ELSE IF( ( PLSAME( NORM, 'F' ) ) .OR. ( PLSAME( NORM, 'E'))) THEN** Find normF(A).* SCALE = ZERO SUM = ONE IF( N.GT.1 ) THEN CALL PDLASSQ( N-1, E, 1, SCALE, SUM ) SUM = 2*SUM END IF CALL PDLASSQ( N, D, 1, SCALE, SUM ) ANORM = SCALE*SQRT( SUM ) END IF* PDLANST = ANORM RETURN** End of DLANST* END DOUBLE PRECISION FUNCTION PDLAPY2( X, Y )** -- LAPACK auxiliary routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* October 31, 1992** .. Scalar Arguments .. DOUBLE PRECISION X, Y* ..** Purpose* =======** DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary* overflow.** Arguments* =========** X (input) DOUBLE PRECISION* Y (input) DOUBLE PRECISION* X and Y specify the values x and y.** =====================================================================** .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) DOUBLE PRECISION ONE PARAMETER ( ONE = 1.0D0 )* ..* .. Local Scalars .. DOUBLE PRECISION W, XABS, YABS, Z* ..* .. Intrinsic Functions .. INTRINSIC ABS, MAX, MIN, SQRT* ..* .. Executable Statements ..* XABS = ABS( X ) YABS = ABS( Y ) W = MAX( XABS, YABS ) Z = MIN( XABS, YABS ) IF( Z.EQ.ZERO ) THEN PDLAPY2 = W ELSE PDLAPY2 = W*SQRT( ONE+( Z / W )**2 ) END IF RETURN** End of DLAPY2* END SUBROUTINE PDLARTG( F, G, CS, SN, R )** -- LAPACK auxiliary routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* September 30, 1994** .. Scalar Arguments .. DOUBLE PRECISION CS, F, G, R, SN* ..** Purpose* =======** DLARTG generate a plane rotation so that** [ CS SN ] . [ F ] = [ R ] where CS**2 + SN**2 = 1.* [ -SN CS ] [ G ] [ 0 ]** This is a slower, more accurate version of the BLAS1 routine DROTG,* with the following other differences:* F and G are unchanged on return.* If G=0, then CS=1 and SN=0.* If F=0 and (G .ne. 0), then CS=0 and SN=1 without doing any* floating point operations (saves work in DBDSQR when* there are zeros on the diagonal).** If F exceeds G in magnitude, CS will be positive.** Arguments
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -