LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
srotm.f
Go to the documentation of this file.
1 *> \brief \b SROTM
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE SROTM(N,SX,INCX,SY,INCY,SPARAM)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,INCY,N
15 * ..
16 * .. Array Arguments ..
17 * REAL SPARAM(5),SX(*),SY(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIX
27 *>
28 *> (SX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF SX ARE IN
29 *> (SX**T)
30 *>
31 *> SX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSE
32 *> LX = (-INCX)*N, AND SIMILARLY FOR SY USING USING LY AND INCY.
33 *> WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS..
34 *>
35 *> SFLAG=-1.E0 SFLAG=0.E0 SFLAG=1.E0 SFLAG=-2.E0
36 *>
37 *> (SH11 SH12) (1.E0 SH12) (SH11 1.E0) (1.E0 0.E0)
38 *> H=( ) ( ) ( ) ( )
39 *> (SH21 SH22), (SH21 1.E0), (-1.E0 SH22), (0.E0 1.E0).
40 *> SEE SROTMG FOR A DESCRIPTION OF DATA STORAGE IN SPARAM.
41 *>
42 *> \endverbatim
43 *
44 * Arguments:
45 * ==========
46 *
47 *> \param[in] N
48 *> \verbatim
49 *> N is INTEGER
50 *> number of elements in input vector(s)
51 *> \endverbatim
52 *>
53 *> \param[in,out] SX
54 *> \verbatim
55 *> SX is REAL array, dimension N
56 *> double precision vector with N elements
57 *> \endverbatim
58 *>
59 *> \param[in] INCX
60 *> \verbatim
61 *> INCX is INTEGER
62 *> storage spacing between elements of SX
63 *> \endverbatim
64 *>
65 *> \param[in,out] SY
66 *> \verbatim
67 *> SY is REAL array, dimension N
68 *> double precision vector with N elements
69 *> \endverbatim
70 *>
71 *> \param[in] INCY
72 *> \verbatim
73 *> INCY is INTEGER
74 *> storage spacing between elements of SY
75 *> \endverbatim
76 *>
77 *> \param[in,out] SPARAM
78 *> \verbatim
79 *> SPARAM is REAL array, dimension 5
80 *> SPARAM(1)=SFLAG
81 *> SPARAM(2)=SH11
82 *> SPARAM(3)=SH21
83 *> SPARAM(4)=SH12
84 *> SPARAM(5)=SH22
85 *> \endverbatim
86 *
87 * Authors:
88 * ========
89 *
90 *> \author Univ. of Tennessee
91 *> \author Univ. of California Berkeley
92 *> \author Univ. of Colorado Denver
93 *> \author NAG Ltd.
94 *
95 *> \date November 2011
96 *
97 *> \ingroup single_blas_level1
98 *
99 * =====================================================================
100  SUBROUTINE srotm(N,SX,INCX,SY,INCY,SPARAM)
101 *
102 * -- Reference BLAS level1 routine (version 3.4.0) --
103 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
104 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
105 * November 2011
106 *
107 * .. Scalar Arguments ..
108  INTEGER INCX,INCY,N
109 * ..
110 * .. Array Arguments ..
111  REAL SPARAM(5),SX(*),SY(*)
112 * ..
113 *
114 * =====================================================================
115 *
116 * .. Local Scalars ..
117  REAL SFLAG,SH11,SH12,SH21,SH22,TWO,W,Z,ZERO
118  INTEGER I,KX,KY,NSTEPS
119 * ..
120 * .. Data statements ..
121  DATA zero,two/0.e0,2.e0/
122 * ..
123 *
124  sflag = sparam(1)
125  IF (n.LE.0 .OR. (sflag+two.EQ.zero)) RETURN
126  IF (incx.EQ.incy.AND.incx.GT.0) THEN
127 *
128  nsteps = n*incx
129  IF (sflag.LT.zero) THEN
130  sh11 = sparam(2)
131  sh12 = sparam(4)
132  sh21 = sparam(3)
133  sh22 = sparam(5)
134  DO i = 1,nsteps,incx
135  w = sx(i)
136  z = sy(i)
137  sx(i) = w*sh11 + z*sh12
138  sy(i) = w*sh21 + z*sh22
139  END DO
140  ELSE IF (sflag.EQ.zero) THEN
141  sh12 = sparam(4)
142  sh21 = sparam(3)
143  DO i = 1,nsteps,incx
144  w = sx(i)
145  z = sy(i)
146  sx(i) = w + z*sh12
147  sy(i) = w*sh21 + z
148  END DO
149  ELSE
150  sh11 = sparam(2)
151  sh22 = sparam(5)
152  DO i = 1,nsteps,incx
153  w = sx(i)
154  z = sy(i)
155  sx(i) = w*sh11 + z
156  sy(i) = -w + sh22*z
157  END DO
158  END IF
159  ELSE
160  kx = 1
161  ky = 1
162  IF (incx.LT.0) kx = 1 + (1-n)*incx
163  IF (incy.LT.0) ky = 1 + (1-n)*incy
164 *
165  IF (sflag.LT.zero) THEN
166  sh11 = sparam(2)
167  sh12 = sparam(4)
168  sh21 = sparam(3)
169  sh22 = sparam(5)
170  DO i = 1,n
171  w = sx(kx)
172  z = sy(ky)
173  sx(kx) = w*sh11 + z*sh12
174  sy(ky) = w*sh21 + z*sh22
175  kx = kx + incx
176  ky = ky + incy
177  END DO
178  ELSE IF (sflag.EQ.zero) THEN
179  sh12 = sparam(4)
180  sh21 = sparam(3)
181  DO i = 1,n
182  w = sx(kx)
183  z = sy(ky)
184  sx(kx) = w + z*sh12
185  sy(ky) = w*sh21 + z
186  kx = kx + incx
187  ky = ky + incy
188  END DO
189  ELSE
190  sh11 = sparam(2)
191  sh22 = sparam(5)
192  DO i = 1,n
193  w = sx(kx)
194  z = sy(ky)
195  sx(kx) = w*sh11 + z
196  sy(ky) = -w + sh22*z
197  kx = kx + incx
198  ky = ky + incy
199  END DO
200  END IF
201  END IF
202  RETURN
203  END
subroutine srotm(N, SX, INCX, SY, INCY, SPARAM)
SROTM
Definition: srotm.f:101