|
69 | 69 | ! |
70 | 70 | !> \date December 2021 |
71 | 71 | ! |
72 | | -!> \ingroup OTHERauxiliary |
| 72 | +!> \ingroup single_blas_level1 |
73 | 73 | ! |
74 | 74 | !> \par Further Details: |
75 | 75 | ! ===================== |
@@ -136,24 +136,38 @@ subroutine CROTG( a, b, c, s ) |
136 | 136 | r = f |
137 | 137 | else if( f == czero ) then |
138 | 138 | c = zero |
139 | | - g1 = max( abs(real(g)), abs(aimag(g)) ) |
140 | | - rtmax = sqrt( safmax/2 ) |
141 | | - if( g1 > rtmin .and. g1 < rtmax ) then |
| 139 | + if( real(g) == zero ) then |
| 140 | + r = abs(aimag(g)) |
| 141 | + s = conjg( g ) / r |
| 142 | + elseif( aimag(g) == zero ) then |
| 143 | + r = abs(real(g)) |
| 144 | + s = conjg( g ) / r |
| 145 | + else |
| 146 | + g1 = max( abs(real(g)), abs(aimag(g)) ) |
| 147 | + rtmax = sqrt( safmax/2 ) |
| 148 | + if( g1 > rtmin .and. g1 < rtmax ) then |
142 | 149 | ! |
143 | 150 | ! Use unscaled algorithm |
144 | 151 | ! |
145 | | - d = abs( g ) |
146 | | - s = conjg( g ) / d |
147 | | - r = d |
148 | | - else |
| 152 | +! The following two lines can be replaced by `d = abs( g )`. |
| 153 | +! This algorithm do not use the intrinsic complex abs. |
| 154 | + g2 = ABSSQ( g ) |
| 155 | + d = sqrt( g2 ) |
| 156 | + s = conjg( g ) / d |
| 157 | + r = d |
| 158 | + else |
149 | 159 | ! |
150 | 160 | ! Use scaled algorithm |
151 | 161 | ! |
152 | | - u = min( safmax, max( safmin, g1 ) ) |
153 | | - gs = g / u |
154 | | - d = abs( gs ) |
155 | | - s = conjg( gs ) / d |
156 | | - r = d*u |
| 162 | + u = min( safmax, max( safmin, g1 ) ) |
| 163 | + gs = g / u |
| 164 | +! The following two lines can be replaced by `d = abs( gs )`. |
| 165 | +! This algorithm do not use the intrinsic complex abs. |
| 166 | + g2 = ABSSQ( gs ) |
| 167 | + d = sqrt( g2 ) |
| 168 | + s = conjg( gs ) / d |
| 169 | + r = d*u |
| 170 | + end if |
157 | 171 | end if |
158 | 172 | else |
159 | 173 | f1 = max( abs(real(f)), abs(aimag(f)) ) |
@@ -192,7 +206,7 @@ subroutine CROTG( a, b, c, s ) |
192 | 206 | r = f / c |
193 | 207 | else |
194 | 208 | ! f2 / sqrt(f2 * h2) < safmin, then |
195 | | - ! h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax |
| 209 | + ! sqrt(safmin) <= f2 * sqrt(safmax) <= h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax |
196 | 210 | r = f * ( h2 / d ) |
197 | 211 | end if |
198 | 212 | s = conjg( g ) * ( f / d ) |
@@ -248,7 +262,7 @@ subroutine CROTG( a, b, c, s ) |
248 | 262 | r = fs / c |
249 | 263 | else |
250 | 264 | ! f2 / sqrt(f2 * h2) < safmin, then |
251 | | - ! h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax |
| 265 | + ! sqrt(safmin) <= f2 * sqrt(safmax) <= h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax |
252 | 266 | r = fs * ( h2 / d ) |
253 | 267 | end if |
254 | 268 | s = conjg( gs ) * ( fs / d ) |
|
0 commit comments