115 subroutine clartg( f, g, c, s, r )
117 only: wp=>sp, zero=>szero, one=>sone, two=>stwo, czero, &
118 safmin=>ssafmin, safmax=>ssafmax
127 complex(wp) f, g, r, s
130 real(wp) :: d, f1, f2, g1, g2, h2, u, v, w, rtmin, rtmax
131 complex(wp) :: fs, gs, t
134 intrinsic :: abs, aimag, conjg, max, min,
real, sqrt
140 abssq( t ) =
real( t )**2 + aimag( t )**2
143 rtmin = sqrt( safmin )
147 if( g == czero )
then 151 else if( f == czero )
then 153 if(
real(g) == zero )
then 156 elseif( aimag(g) == zero )
then 160 g1 = max( abs(
real(g)), abs(aimag(g)) )
161 rtmax = sqrt( safmax/2 )
162 if( g1 > rtmin .and. g1 < rtmax )
then 176 u = min( safmax, max( safmin, g1 ) )
187 f1 = max( abs(
real(f)), abs(aimag(f)) )
188 g1 = max( abs(
real(g)), abs(aimag(g)) )
189 rtmax = sqrt( safmax/4 )
190 if( f1 > rtmin .and. f1 < rtmax .and. &
191 g1 > rtmin .and. g1 < rtmax )
then 199 if( f2 >= h2 * safmin )
then 204 if( f2 > rtmin .and. h2 < rtmax )
then 206 s = conjg( g ) * ( f / sqrt( f2*h2 ) )
208 s = conjg( g ) * ( r / h2 )
219 if( c >= safmin )
then 226 s = conjg( g ) * ( f / d )
232 u = min( safmax, max( safmin, f1, g1 ) )
235 if( f1 / u < rtmin )
then 240 v = min( safmax, max( safmin, f1 ) )
255 if( f2 >= h2 * safmin )
then 260 if( f2 > rtmin .and. h2 < rtmax )
then 262 s = conjg( gs ) * ( fs / sqrt( f2*h2 ) )
264 s = conjg( gs ) * ( r / h2 )
275 if( c >= safmin )
then 282 s = conjg( gs ) * ( fs / d )
LA_CONSTANTS is a module for the scaling constants for the compiled Fortran single and double precisi...