aboutsummaryrefslogtreecommitdiff
path: root/src/matinv.F90
blob: ab6c5152017a65d596117c1a173581054bf26525 (plain)
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
54
! $Header$

#include "cctk.h"
#include "cctk_Parameters.h"

module matinv
  use constants
  use lapack
  implicit none
  DECLARE_CCTK_PARAMETERS
  private
  
  public calc_inv3
  public calc_inv4
  
contains
  
  subroutine calc_inv3 (g3, gu3)
    CCTK_REAL, intent(in)  :: g3(3,3)
    CCTK_REAL, intent(out) :: gu3(3,3)
    CCTK_REAL :: tmp(3,3)
    integer   :: ipiv(3)
    integer   :: info
    character :: msg*1000
    
    tmp = g3
    gu3 = delta3
    call gesv (3, 3, tmp, 3, ipiv, gu3, 3, info)
    
    if (info /= 0) then
       write (msg, '("Error in call to GESV, info=",i2)') info
       call CCTK_WARN (0, trim(msg))
    end if
  end subroutine calc_inv3
  
  subroutine calc_inv4 (g4, gu4)
    CCTK_REAL, intent(in)  :: g4(0:3,0:3)
    CCTK_REAL, intent(out) :: gu4(0:3,0:3)
    CCTK_REAL :: tmp(0:3,0:3)
    integer   :: ipiv(0:3)
    integer   :: info
    character :: msg*1000
    
    tmp = g4
    gu4 = delta4
    call gesv (4, 4, tmp, 4, ipiv, gu4, 4, info)
    
    if (info /= 0) then
       write (msg, '("Error in call to GESV, info=",i2)') info
       call CCTK_WARN (0, trim(msg))
    end if
  end subroutine calc_inv4
  
end module matinv