Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2ci / .svn / text-base / givens.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (960 Bytes)

1
      Subroutine givens( a, b, c, s )
2
! ----------------------------------------------------------------------
3
! --- Calculates rotation factors c & s from 'a' and 'b' for the Givens
4
!     transformation (used in rgmres).
5
! ----------------------------------------------------------------------
6
      Use         numerics
7
      Use         floptime
8
      Implicit    None
9

    
10
      Real(l_) :: a, b, c, s
11

    
12
      Real(l_) :: fac
13
! ----------------------------------------------------------------------
14
      If ( b == 0.0_l_ ) Then
15
         c = 1.0_l_
16
         s = 0.0_l_
17
      Else If ( Abs( b ) < Abs( a ) ) Then
18
         fac = -a/b
19
         s = 1.0_l_/Sqrt( 1.0_l_ + fac*fac )
20
         c = fac*s
21
         flops = flops + 13
22
      Else
23
         fac = -b/a
24
         c = 1.0_l_/Sqrt( 1.0_l_ + fac*fac )
25
         s = fac*c
26
         flops = flops + 13
27
      End If
28
! ----------------------------------------------------------------------
29
      End Subroutine givens