@@ -129,7 +129,7 @@ subroutine ZLARTG( f, g, c, s, r )
129
129
complex (wp) f, g, r, s
130
130
! ..
131
131
! .. Local Scalars ..
132
- real (wp) :: d, f1, f2, g1, g2, h2, p, u, uu, v, vv , w
132
+ real (wp) :: d, f1, f2, g1, g2, h2, u, v , w
133
133
complex (wp) :: fs, gs, t
134
134
! ..
135
135
! .. Intrinsic Functions ..
@@ -154,19 +154,16 @@ subroutine ZLARTG( f, g, c, s, r )
154
154
!
155
155
! Use unscaled algorithm
156
156
!
157
- g2 = ABSSQ( g )
158
- d = sqrt ( g2 )
157
+ d = abs ( g )
159
158
s = conjg ( g ) / d
160
159
r = d
161
160
else
162
161
!
163
162
! Use scaled algorithm
164
163
!
165
164
u = min ( safmax, max ( safmin, g1 ) )
166
- uu = one / u
167
- gs = g* uu
168
- g2 = ABSSQ( gs )
169
- d = sqrt ( g2 )
165
+ gs = g / u
166
+ d = abs ( gs )
170
167
s = conjg ( gs ) / d
171
168
r = d* u
172
169
end if
@@ -186,35 +183,32 @@ subroutine ZLARTG( f, g, c, s, r )
186
183
else
187
184
d = sqrt ( f2 )* sqrt ( h2 )
188
185
end if
189
- p = 1 / d
190
- c = f2* p
191
- s = conjg ( g )* ( f* p )
192
- r = f* ( h2* p )
186
+ c = f2 / d
187
+ s = conjg ( g )* ( f / d )
188
+ r = f* ( h2 / d )
193
189
else
194
190
!
195
191
! Use scaled algorithm
196
192
!
197
193
u = min ( safmax, max ( safmin, f1, g1 ) )
198
- uu = one / u
199
- gs = g* uu
194
+ gs = g / u
200
195
g2 = ABSSQ( gs )
201
- if ( f1* uu < rtmin ) then
196
+ if ( f1 < rtmin* u ) then
202
197
!
203
198
! f is not well-scaled when scaled by g1.
204
199
! Use a different scaling for f.
205
200
!
206
201
v = min ( safmax, max ( safmin, f1 ) )
207
- vv = one / v
208
- w = v * uu
209
- fs = f* vv
202
+ w = v / u
203
+ fs = f / v
210
204
f2 = ABSSQ( fs )
211
205
h2 = f2* w** 2 + g2
212
206
else
213
207
!
214
208
! Otherwise use the same scaling for f and g.
215
209
!
216
210
w = one
217
- fs = f* uu
211
+ fs = f / u
218
212
f2 = ABSSQ( fs )
219
213
h2 = f2 + g2
220
214
end if
@@ -223,10 +217,9 @@ subroutine ZLARTG( f, g, c, s, r )
223
217
else
224
218
d = sqrt ( f2 )* sqrt ( h2 )
225
219
end if
226
- p = 1 / d
227
- c = ( f2* p )* w
228
- s = conjg ( gs )* ( fs* p )
229
- r = ( fs* ( h2* p ) )* u
220
+ c = ( f2 / d )* w
221
+ s = conjg ( gs )* ( fs / d )
222
+ r = ( fs* ( h2 / d ) )* u
230
223
end if
231
224
end if
232
225
return
0 commit comments