/
SHConfidence.f95
39 lines (35 loc) · 1.2 KB
/
SHConfidence.f95
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
real*8 function SHConfidence(l_conf, r)
!------------------------------------------------------------------------------
!
! This subroutine will calculate the probability that two sets of spherical
! harmonic coefficients, which possess a correlation coefficients r, are
! linearly correlated at a given degree. This is calucated according to
! equation A7 in Pauer et al. (2007), which is from Eckhard 1984.
!
! Calling Parameters
!
! INPUT
! l_conf Degree to calculate confidence levels.
! r The correlation coefficient of two sets
! of spherical harmonic coeficients at degree l_conf.
!
! OUTPUT
! cl The confidence level.
!
! Copyright (c) 2016, SHTOOLS
! All rights reserved.
!
!------------------------------------------------------------------------------
implicit none
real*8, intent(in) :: r
integer, intent(in) :: l_conf
real*8 :: prod
integer:: l, i
SHConfidence = abs(r)
prod = 1.0d0
do l = 2, l_conf, 1
i = l - 1
prod = prod * dble(2*i-1) / dble(2*i)
SHConfidence = SHConfidence + prod * abs(r) * (1.0d0 - r**2)**(l-1)
end do
end function SHConfidence