I have some confusion about the use of cosmoMC. I want to give a user
defined likelihood function to cosmoMC and get back the fit parameters.
I followed the instructions as given in the web but a bit confused. The
program calclike.c is a module where GenericLikelihoodFunction is
defined to be the output of a user defined likelihood function
GreatLike. My confusion is, where should I write this function
Greatlike? Inside which program? I can write it as a separate
subroutine. But in calclike.c GreatLike(Params) is supposed to be a
subroutine. Also, can I write the subroutine in C and use it with
cosmoMC?
Which one is the main program in the entire list of source codes? My data is two arrays of x and y having 1024 elements in each. So to calculate
the likelihood function I would first like to read this data in the main
program and store these arrays as global variable. Then for each sampling
of the parameter space, the data doesn't have to be read again and again.
How can I do this?
I am not familiar with fortran language at all and usually do all the
programming in C only. The above problems might even be too simple to
be solved but I have difficulties in understanding the structure due to
the language.
CosmoMC as a sampler for parameter fitting
-
- Posts: 1
- Joined: April 06 2012
- Affiliation: Raman Research Institute
-
- Posts: 1947
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: CosmoMC as a sampler for parameter fitting
You can write your likelihood function in a separate module and use it in calclike, or various other options. Likelihood functions often initialize/read in their data the first time they are called (easily done in fortran using a SAVE local boolean variable, or a module variable).