File: giv.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (44 lines) | stat: -rw-r--r-- 1,055 bytes parent folder | download | duplicates (4)
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
      subroutine giv(sa,sb,sc,ss)
c     Copyright INRIA
      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