```001:       SUBROUTINE SROTM(N,SX,INCX,SY,INCY,SPARAM)
002: *     .. Scalar Arguments ..
003:       INTEGER INCX,INCY,N
004: *     ..
005: *     .. Array Arguments ..
006:       REAL SPARAM(5),SX(1),SY(1)
007: *     ..
008: *
009: *  Purpose
010: *  =======
011: *
012: *     APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIX
013: *
014: *     (SX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF SX ARE IN
015: *     (DX**T)
016: *
017: *     SX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSE
018: *     LX = (-INCX)*N, AND SIMILARLY FOR SY USING USING LY AND INCY.
019: *     WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS..
020: *
021: *     SFLAG=-1.E0     SFLAG=0.E0        SFLAG=1.E0     SFLAG=-2.E0
022: *
023: *       (SH11  SH12)    (1.E0  SH12)    (SH11  1.E0)    (1.E0  0.E0)
024: *     H=(          )    (          )    (          )    (          )
025: *       (SH21  SH22),   (SH21  1.E0),   (-1.E0 SH22),   (0.E0  1.E0).
026: *     SEE  SROTMG FOR A DESCRIPTION OF DATA STORAGE IN SPARAM.
027: *
028: *
029: *  Arguments
030: *  =========
031: *
032: *  N      (input) INTEGER
033: *         number of elements in input vector(s)
034: *
035: *  SX     (input/output) REAL array, dimension N
036: *         double precision vector with 5 elements
037: *
038: *  INCX   (input) INTEGER
039: *         storage spacing between elements of SX
040: *
041: *  SY     (input/output) REAL array, dimension N
042: *         double precision vector with N elements
043: *
044: *  INCY   (input) INTEGER
045: *         storage spacing between elements of SY
046: *
047: *  SPARAM (input/output)  REAL array, dimension 5
048: *     SPARAM(1)=SFLAG
049: *     SPARAM(2)=SH11
050: *     SPARAM(3)=SH21
051: *     SPARAM(4)=SH12
052: *     SPARAM(5)=SH22
053: *
054: *  =====================================================================
055: *
056: *     .. Local Scalars ..
057:       REAL SFLAG,SH11,SH12,SH21,SH22,TWO,W,Z,ZERO
058:       INTEGER I,KX,KY,NSTEPS
059: *     ..
060: *     .. Data statements ..
061:       DATA ZERO,TWO/0.E0,2.E0/
062: *     ..
063: *
064:       SFLAG = SPARAM(1)
065:       IF (N.LE.0 .OR. (SFLAG+TWO.EQ.ZERO)) GO TO 140
066:       IF (.NOT. (INCX.EQ.INCY.AND.INCX.GT.0)) GO TO 70
067: *
068:       NSTEPS = N*INCX
069:       IF (SFLAG) 50,10,30
070:    10 CONTINUE
071:       SH12 = SPARAM(4)
072:       SH21 = SPARAM(3)
073:       DO 20 I = 1,NSTEPS,INCX
074:           W = SX(I)
075:           Z = SY(I)
076:           SX(I) = W + Z*SH12
077:           SY(I) = W*SH21 + Z
078:    20 CONTINUE
079:       GO TO 140
080:    30 CONTINUE
081:       SH11 = SPARAM(2)
082:       SH22 = SPARAM(5)
083:       DO 40 I = 1,NSTEPS,INCX
084:           W = SX(I)
085:           Z = SY(I)
086:           SX(I) = W*SH11 + Z
087:           SY(I) = -W + SH22*Z
088:    40 CONTINUE
089:       GO TO 140
090:    50 CONTINUE
091:       SH11 = SPARAM(2)
092:       SH12 = SPARAM(4)
093:       SH21 = SPARAM(3)
094:       SH22 = SPARAM(5)
095:       DO 60 I = 1,NSTEPS,INCX
096:           W = SX(I)
097:           Z = SY(I)
098:           SX(I) = W*SH11 + Z*SH12
099:           SY(I) = W*SH21 + Z*SH22
100:    60 CONTINUE
101:       GO TO 140
102:    70 CONTINUE
103:       KX = 1
104:       KY = 1
105:       IF (INCX.LT.0) KX = 1 + (1-N)*INCX
106:       IF (INCY.LT.0) KY = 1 + (1-N)*INCY
107: *
108:       IF (SFLAG) 120,80,100
109:    80 CONTINUE
110:       SH12 = SPARAM(4)
111:       SH21 = SPARAM(3)
112:       DO 90 I = 1,N
113:           W = SX(KX)
114:           Z = SY(KY)
115:           SX(KX) = W + Z*SH12
116:           SY(KY) = W*SH21 + Z
117:           KX = KX + INCX
118:           KY = KY + INCY
119:    90 CONTINUE
120:       GO TO 140
121:   100 CONTINUE
122:       SH11 = SPARAM(2)
123:       SH22 = SPARAM(5)
124:       DO 110 I = 1,N
125:           W = SX(KX)
126:           Z = SY(KY)
127:           SX(KX) = W*SH11 + Z
128:           SY(KY) = -W + SH22*Z
129:           KX = KX + INCX
130:           KY = KY + INCY
131:   110 CONTINUE
132:       GO TO 140
133:   120 CONTINUE
134:       SH11 = SPARAM(2)
135:       SH12 = SPARAM(4)
136:       SH21 = SPARAM(3)
137:       SH22 = SPARAM(5)
138:       DO 130 I = 1,N
139:           W = SX(KX)
140:           Z = SY(KY)
141:           SX(KX) = W*SH11 + Z*SH12
142:           SY(KY) = W*SH21 + Z*SH22
143:           KX = KX + INCX
144:           KY = KY + INCY
145:   130 CONTINUE
146:   140 CONTINUE
147:       RETURN
148:       END
149: ```