LAPACK 3.3.1
Linear Algebra PACKage

mydrotmg.f

Go to the documentation of this file.
00001       SUBROUTINE MYDROTMG(DD1,DD2,DX1,DY1,DPARAM)
00002 *     .. Scalar Arguments ..
00003       DOUBLE PRECISION DD1,DD2,DX1,DY1
00004 *     ..
00005 *     .. Array Arguments ..
00006       DOUBLE PRECISION DPARAM(5)
00007 *     ..
00008 *
00009 *  Purpose
00010 *  =======
00011 *
00012 *     CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS
00013 *     THE SECOND COMPONENT OF THE 2-VECTOR  (DSQRT(DD1)*DX1,DSQRT(DD2)*
00014 *     DY2)**T.
00015 *     WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS..
00016 *
00017 *     DFLAG=-1.D0     DFLAG=0.D0        DFLAG=1.D0     DFLAG=-2.D0
00018 *
00019 *       (DH11  DH12)    (1.D0  DH12)    (DH11  1.D0)    (1.D0  0.D0)
00020 *     H=(          )    (          )    (          )    (          )
00021 *       (DH21  DH22),   (DH21  1.D0),   (-1.D0 DH22),   (0.D0  1.D0).
00022 *     LOCATIONS 2-4 OF DPARAM CONTAIN DH11, DH21, DH12, AND DH22
00023 *     RESPECTIVELY. (VALUES OF 1.D0, -1.D0, OR 0.D0 IMPLIED BY THE
00024 *     VALUE OF DPARAM(1) ARE NOT STORED IN DPARAM.)
00025 *
00026 *     THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE
00027 *     INEXACT.  THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE
00028 *     OF DD1 AND DD2.  ALL ACTUAL SCALING OF DATA IS DONE USING GAM.
00029 *
00030 *
00031 *  Arguments
00032 *  =========
00033 *
00034 *  DD1    (input/output) DOUBLE PRECISION
00035 *
00036 *  DD2    (input/output) DOUBLE PRECISION
00037 *
00038 *  DX1    (input/output) DOUBLE PRECISION
00039 *
00040 *  DY1    (input) DOUBLE PRECISION
00041 *
00042 *  DPARAM (input/output)  DOUBLE PRECISION array, dimension 5
00043 *     DPARAM(1)=DFLAG
00044 *     DPARAM(2)=DH11
00045 *     DPARAM(3)=DH21
00046 *     DPARAM(4)=DH12
00047 *     DPARAM(5)=DH22
00048 *
00049 *  =====================================================================
00050 *
00051 *     .. Local Scalars ..
00052       DOUBLE PRECISION DFLAG,DH11,DH12,DH21,DH22,DP1,DP2,DQ1,DQ2,DTEMP,
00053      +                 DU,GAM,GAMSQ,ONE,RGAMSQ,TWO,ZERO
00054       INTEGER IGO
00055 *     ..
00056 *     .. Intrinsic Functions ..
00057       INTRINSIC DABS
00058 *     ..
00059 *     .. Data statements ..
00060 *
00061       DATA ZERO,ONE,TWO/0.D0,1.D0,2.D0/
00062       DATA GAM,GAMSQ,RGAMSQ/4096.D0,16777216.D0,5.9604645D-8/
00063 *     ..
00064 
00065       IF (DD1.LT.ZERO) THEN
00066 *        GO ZERO-H-D-AND-DX1..
00067          DFLAG = -ONE
00068          DH11 = ZERO
00069          DH12 = ZERO
00070          DH21 = ZERO
00071          DH22 = ZERO
00072 *
00073          DD1 = ZERO
00074          DD2 = ZERO
00075          DX1 = ZERO
00076       ELSE
00077 *        CASE-DD1-NONNEGATIVE
00078          DP2 = DD2*DY1
00079          IF (DP2.EQ.ZERO) THEN
00080             DFLAG = -TWO
00081             DPARAM(1) = DFLAG
00082             RETURN
00083          END IF 
00084 *        REGULAR-CASE..
00085          DP1 = DD1*DX1
00086          DQ2 = DP2*DY1
00087          DQ1 = DP1*DX1
00088 *
00089          IF (DABS(DQ1).GT.DABS(DQ2)) THEN
00090             DH21 = -DY1/DX1
00091             DH12 = DP2/DP1
00092 *
00093             DU = ONE - DH12*DH21
00094 *
00095            IF (DU.GT.ZERO) THEN
00096              DFLAG = ZERO
00097              DD1 = DD1/DU
00098              DD2 = DD2/DU
00099              DX1 = DX1*DU
00100            END IF
00101          ELSE
00102 
00103             IF (DQ2.LT.ZERO) THEN
00104 *              GO ZERO-H-D-AND-DX1..
00105                DFLAG = -ONE
00106                DH11 = ZERO
00107                DH12 = ZERO
00108                DH21 = ZERO
00109                DH22 = ZERO
00110 *
00111                DD1 = ZERO
00112                DD2 = ZERO
00113                DX1 = ZERO
00114             ELSE
00115                DFLAG = ONE
00116                DH11 = DP1/DP2
00117                DH22 = DX1/DY1
00118                DU = ONE + DH11*DH22
00119                DTEMP = DD2/DU
00120                DD2 = DD1/DU
00121                DD1 = DTEMP
00122                DX1 = DY1*DU
00123             END IF
00124          END IF
00125 
00126 *     PROCEDURE..SCALE-CHECK
00127          IF (DD1.NE.ZERO) THEN
00128             DO WHILE ((DD1.LE.RGAMSQ) .OR. (DD1.GE.GAMSQ))
00129                IF (DFLAG.EQ.ZERO) THEN
00130                   DH11 = ONE
00131                   DH22 = ONE
00132                   DFLAG = -ONE
00133                ELSE
00134                   DH21 = -ONE
00135                   DH12 = ONE
00136                   DFLAG = -ONE
00137                END IF
00138                IF (DD1.LE.RGAMSQ) THEN
00139                   DD1 = DD1*GAM**2
00140                   DX1 = DX1/GAM
00141                   DH11 = DH11/GAM
00142                   DH12 = DH12/GAM
00143                ELSE
00144                   DD1 = DD1/GAM**2
00145                   DX1 = DX1*GAM
00146                   DH11 = DH11*GAM
00147                   DH12 = DH12*GAM
00148                END IF
00149             ENDDO
00150          END IF
00151   
00152          IF (DD2.NE.ZERO) THEN
00153             DO WHILE ( (DABS(DD2).LE.RGAMSQ) .OR. (DABS(DD2).GE.GAMSQ) )
00154                IF (DFLAG.EQ.ZERO) THEN
00155                   DH11 = ONE
00156                   DH22 = ONE
00157                   DFLAG = -ONE
00158                ELSE
00159                   DH21 = -ONE
00160                   DH12 = ONE
00161                   DFLAG = -ONE
00162                END IF
00163                IF (DABS(DD2).LE.RGAMSQ) THEN
00164                   DD2 = DD2*GAM**2
00165                   DH21 = DH21/GAM
00166                   DH22 = DH22/GAM
00167                ELSE
00168                   DD2 = DD2/GAM**2
00169                   DH21 = DH21*GAM
00170                   DH22 = DH22*GAM
00171                END IF      
00172             END DO
00173          END IF
00174      
00175       END IF
00176 
00177       IF (DFLAG.LT.ZERO) THEN
00178          DPARAM(2) = DH11
00179          DPARAM(3) = DH21
00180          DPARAM(4) = DH12
00181          DPARAM(5) = DH22
00182       ELSE IF (DFLAG.EQ.ZERO) THEN
00183          DPARAM(3) = DH21
00184          DPARAM(4) = DH12 
00185       ELSE
00186          DPARAM(2) = DH11
00187          DPARAM(5) = DH22
00188       END IF
00189 
00190   260 CONTINUE
00191       DPARAM(1) = DFLAG
00192       RETURN
00193       END
00194       
00195      
00196      
00197      
 All Files Functions