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

#include "cctk.h"

module matexp
  use constants
  implicit none
  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
    
    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