aboutsummaryrefslogtreecommitdiff
path: root/src/matexp.F90
blob: d2ecc77413a59d847513b046fd26ba1f9c15d7ab (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
! $Header$

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

module matexp
  use constants
  implicit none
  DECLARE_CCTK_PARAMETERS
  private
  
  public calc_exp3
  
contains
  
  subroutine calc_exp3 (h3, g3)
    CCTK_REAL, intent(in)  :: h3(3,3)
    CCTK_REAL, intent(out) :: g3(3,3)
    CCTK_REAL :: nfact
    CCTK_REAL :: tmp(3,3)
    integer   :: n
    integer   :: i, j
    
    g3 = delta3
    
    nfact = 1
    tmp = delta3
    do n = 1, 18
       nfact = nfact * n
       tmp = matmul (h3, tmp)
       
       ! exp(x) = sum_n x^n / n!
       g3 = g3 + tmp / nfact
    end do
    
  end subroutine calc_exp3
  
end module matexp