LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
slartg.f90
Go to the documentation of this file.
1 
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 SLARTG( F, G, C, S, R )
12 !
13 ! .. Scalar Arguments ..
14 ! REAL(wp) C, F, G, R, S
15 ! ..
16 !
18 ! =============
52 !
53 ! Arguments:
54 ! ==========
55 !
85 !
86 ! Authors:
87 ! ========
88 !
90 !
92 !
94 !
96 ! ==================
99 !
101 ! =====================
111 !
112 subroutine slartg( f, g, c, s, r )
113  use la_constants, &
114  only: wp=>sp, zero=>szero, half=>shalf, one=>sone, &
115  rtmin=>srtmin, rtmax=>srtmax, safmin=>ssafmin, safmax=>ssafmax
116 !
117 ! -- LAPACK auxiliary routine (version 3.10.0) --
118 ! -- LAPACK is a software package provided by Univ. of Tennessee, --
119 ! -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 ! February 2021
121 !
122 ! .. Scalar Arguments ..
123  real(wp) :: c, f, g, r, s
124 ! ..
125 ! .. Local Scalars ..
126  real(wp) :: d, f1, fs, g1, gs, p, u, uu
127 ! ..
128 ! .. Intrinsic Functions ..
129  intrinsic :: abs, sign, sqrt
130 ! ..
131 ! .. Executable Statements ..
132 !
133  f1 = abs( f )
134  g1 = abs( g )
135  if( g == zero ) then
136  c = one
137  s = zero
138  r = f
139  else if( f == zero ) then
140  c = zero
141  s = sign( one, g )
142  r = g1
143  else if( f1 > rtmin .and. f1 < rtmax .and. &
144  g1 > rtmin .and. g1 < rtmax ) then
145  d = sqrt( f*f + g*g )
146  p = one / d
147  c = f1*p
148  s = g*sign( p, f )
149  r = sign( d, f )
150  else
151  u = min( safmax, max( safmin, f1, g1 ) )
152  uu = one / u
153  fs = f*uu
154  gs = g*uu
155  d = sqrt( fs*fs + gs*gs )
156  p = one / d
157  c = abs( fs )*p
158  s = gs*sign( p, f )
159  r = sign( d, f )*u
160  end if
161  return
162 end subroutine
subroutine slartg(f, g, c, s, r)
SLARTG generates a plane rotation with real cosine and real sine.
Definition: slartg.f90:113
real(sp), parameter srtmax
real(sp), parameter sone
real(sp), parameter shalf
real(sp), parameter srtmin
integer, parameter sp
real(sp), parameter ssafmin
real(sp), parameter ssafmax
real(sp), parameter szero
LA_CONSTANTS is a module for the scaling constants for the compiled Fortran single and double precisi...