1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
c Copyright (C) INRIA
c
c This file must be used under the terms of the CeCILL.
c This source file is licensed as described in the file COPYING, which
c you should have received as part of this distribution. The terms
c are also available at
c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
subroutine giv(sa,sb,sc,ss)
double precision sa,sb,sc,ss
c!purpose
c this routine constructs the givens transformation
c
c ( sc ss )
c g = ( ), sc**2+ss**2 = 1. ,
c (-ss sc )
c
c which zeros the second entry of the 2-vector (sa,sb)**t
c this routine is a modification of the blas routine srotg
c (algorithm 539) in order to leave the arguments sa and sb
c unchanged
c
c!calling sequence
c
c subroutine giv(sa,sb,sc,ss)
c double precision sa,sb,sc,ss
c!auxiliary routines
c sqrt abs (fortran)
c!
double precision r,u,v
if(abs(sa).le.abs(sb)) go to 10
c* here abs(sa) .gt. abs(sb)
u=sa+sa
v=sb/u
r=sqrt(0.250d+0+v*v)*u
sc=sa/r
ss=v*(sc+sc)
return
c* here abs(sa) .le. abs(sb)
10 if(sb.eq.0.0d+0) go to 20
u=sb+sb
v=sa/u
r=sqrt(0.250d+0+v*v)*u
ss=sb/r
sc=v*(ss+ss)
return
c* here sa = sb = 0.
20 sc=1.0d+0
ss=0.0d+0
return
end
|