CosmicFish  Reference documentation for version 1.0
Looking into future Cosmology
003_Fisher_manipulation.f90
Go to the documentation of this file.
1 !----------------------------------------------------------------------------------------
2 !
3 ! This file is part of CosmicFish.
4 !
5 ! Copyright (C) 2015-2016 by the CosmicFish authors
6 !
7 ! The CosmicFish code is free software;
8 ! You can use it, redistribute it, and/or modify it under the terms
9 ! of the GNU General Public License as published by the Free Software Foundation;
10 ! either version 3 of the License, or (at your option) any later version.
11 ! The full text of the license can be found in the file LICENSE at
12 ! the top level of the CosmicFish distribution.
13 !
14 !----------------------------------------------------------------------------------------
15 
19 
20 !----------------------------------------------------------------------------------------
23 
25 
27 
28  use precision
31 
32  implicit none
33 
34  private
35 
39 
40 contains
41 
42  ! ---------------------------------------------------------------------------------------------
45  subroutine fisher_delete_column_rows( Fisher_in, Fisher_out, indexes )
46 
47  implicit none
48 
49  real(dl), dimension(:,:), intent(in) :: Fisher_in
50  real(dl), dimension(:,:), intent(out) :: Fisher_out
51  integer , dimension(:) , intent(in) :: indexes
52 
53  fisher_out = 0._dl
54 
55  stop 'Fisher_delete_column_rows not yet implemented'
56 
57  end subroutine fisher_delete_column_rows
58 
59  ! ---------------------------------------------------------------------------------------------
62  function confidence_coefficient( confidence_level )
63 
64  implicit none
65 
66  real(dl), intent(in) :: confidence_level
67  real(dl) :: confidence_coefficient
68 
69  confidence_coefficient = sqrt(2._dl)*dierf(confidence_level)
70 
71  end function confidence_coefficient
72 
73  ! ---------------------------------------------------------------------------------------------
75  subroutine confidence_interval_params( Fisher_in, confidence_level, error_out )
76 
77  implicit none
78 
79  real(dl), intent(in) :: Fisher_in(:,:)
80  real(dl), intent(in) :: confidence_level
81  real(dl), intent(out) :: error_out(:)
82 
83  error_out = 0._dl
84 
85  stop 'confidence_interval_params not yet implemented'
86 
87  end subroutine confidence_interval_params
88 
89  ! ---------------------------------------------------------------------------------------------
93  subroutine marginalise_fisher( Fisher_in, indexes, Fisher_out )
94 
95  implicit none
96 
97  real(dl), dimension(:,:), intent(in) :: Fisher_in
98  real(dl), dimension(:,:), intent(out) :: Fisher_out
99  integer , dimension(:) , intent(in) :: indexes
100 
101  fisher_out = 0._dl
102 
103  stop 'marginalise_Fisher not yet implemented'
104 
105  end subroutine marginalise_fisher
106 
107  ! ---------------------------------------------------------------------------------------------
110  subroutine fisher_pca( Fisher_in, eigenvalues, eigenvectors )
112  implicit none
113 
114  real(dl), dimension(:,:), intent(in) :: Fisher_in
115  real(dl), dimension(:) , intent(out) :: eigenvalues
116  real(dl), dimension(:,:), intent(out) :: eigenvectors
117 
118  eigenvalues = 0._dl
119  eigenvectors = 0._dl
120 
121  stop 'Fisher_PCA not yet implemented'
122 
123  end subroutine fisher_pca
124 
125  ! ---------------------------------------------------------------------------------------------
127  subroutine fisher_fom( Fisher_in, FOM )
129  implicit none
130 
131  real(dl), dimension(:,:), intent(in) :: Fisher_in
132  real(dl), intent(out) :: FOM
133 
134  fom = 0._dl
135 
136  stop 'Fisher_FOM not yet implemented'
137 
138  end subroutine fisher_fom
139 
140  ! ---------------------------------------------------------------------------------------------
147  subroutine fisher_protection_unconstrained( Fisher_in )
149  implicit none
150 
151  real(dl), dimension(:,:), intent(inout) :: Fisher_in
152 
153  integer :: fisher_dim, i, j
154  logical :: is_zero
155 
156  fisher_dim = size( fisher_in, 1 )
157 
158  ! cycle over the Fisher matrix to see wether there are columns or row that are
159  ! exactly zero.
160  do i=1, fisher_dim
161 
162  is_zero = .true.
163 
164  do j=1, fisher_dim
165  if ( fisher_in(i,j) /= 0._dl ) is_zero = .false.
166  end do
167 
168  if ( is_zero ) then
169  fisher_in(i,i) = 1.d-16
170  end if
171 
172  end do
173 
174  end subroutine fisher_protection_unconstrained
175 
176  ! ---------------------------------------------------------------------------------------------
182  subroutine fisher_protection_degenerate( Fisher_in )
184  implicit none
185 
186  real(dl), dimension(:,:), intent(inout) :: Fisher_in
187 
188  integer :: fisher_dim, i
189 
190  fisher_dim = size( fisher_in, 1 )
191 
192  ! cycle over the Fisher matrix
193  do i=1, fisher_dim
194  fisher_in(i,i) = fisher_in(i,i) + 1.d-16
195  end do
196 
197  end subroutine fisher_protection_degenerate
198 
199  ! ---------------------------------------------------------------------------------------------
200 
201 end module fisher_manipulation
subroutine, public fisher_delete_column_rows(Fisher_in, Fisher_out, indexes)
Thie subroutine eliminates the rows and columns in indexes from Fisher_in and returns a reduced Fishe...
real(dl) function, public dierf(y)
This function computes the inverse error function in double precision. Taken from: http://www...
subroutine, public fisher_protection_unconstrained(Fisher_in)
This subroutine applies a safeguard against unconstrained parameters. If a parameter is unconstrained...
subroutine, public fisher_fom(Fisher_in, FOM)
This subroutine computes the Figure of Merit from the Fisher matrix Fisher_in.
This module contains the subroutine and functions to manipulate and modify matrices.
This module contains several general purpose utilities.
subroutine, public fisher_pca(Fisher_in, eigenvalues, eigenvectors)
This subroutine performs the principal component analysis on the Fisher matrix Fisher_in returning th...
subroutine, public marginalise_fisher(Fisher_in, indexes, Fisher_out)
This function marginalises the Fisher_in Fisher matrix over the parameters in index and returns the m...
This module contains the subroutine and functions to carry out Fisher matrix manipulations.
real(dl) function, public confidence_coefficient(confidence_level)
This function computes the coefficient correspondent to a given confidence level. Uses MKL to compute...
subroutine, public fisher_protection_degenerate(Fisher_in)
This subroutine applies a safeguard against totally degenerate parameters. If a parameter is totally ...
subroutine, public confidence_interval_params(Fisher_in, confidence_level, error_out)
This function computes the error bounds on the parameters starting from a Fisher matrix.