CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
LikelihoodParameters.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2014 by Federico Marulli and Alfonso Veropalumbo *
3  * federico.marulli3@unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ********************************************************************/
20 
33 #ifndef __LPARAM__
34 #define __LPARAM__
35 
36 #include "ModelParameters.h"
37 
38 namespace cbl {
39 
40  namespace statistics {
41 
51 
52  protected:
53 
55  std::vector<bool> m_parameter_isFixed;
56 
58  size_t m_nparameters_free = 0;
59 
61  size_t m_nparameters_fixed = 0;
62 
64  std::vector<unsigned int> m_fixed_parameter;
65 
67  std::vector<unsigned int> m_free_parameter;
68 
70  std::vector<double> m_parameter_fixed_value;
71 
73  std::vector<double> m_parameter_bestfit_value;
74 
81  void m_set_parameter_type () override;
82 
83 
84  public:
85 
90 
96  LikelihoodParameters () = default;
97 
109  LikelihoodParameters (const size_t nparameters, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames);
110 
116  ~LikelihoodParameters () = default;
117 
119 
125  void reset () override;
126 
134  std::string status (const int p) const;
135 
141  std::vector<std::string> status () const;
142 
147 
154  size_t nparameters_free () const override;
155 
161  std::vector<unsigned int> free_parameter () const { return m_free_parameter; }
162 
169  size_t nparameters_fixed () const override;
170 
176  std::vector<unsigned int> fixed_parameter () const { return m_fixed_parameter; }
177 
185  std::vector<double> full_parameter (const std::vector<double> parameter_value) const override;
186 
198  void set_parameters (const size_t nparameters, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames) override;
199 
201 
206 
214  void free (const int p) override;
215 
225  void fix (const int p, const double value) override;
226 
235  void fix_at_bestfit (const int p) override;
236 
238 
239 
241 
249  double bestfit_value (const int p) const override;
250 
256  std::vector<double> bestfit_value () const override;
257 
265  void set_bestfit_values (const std::vector<double> bestfit_value) override;
266 
272  void write_bestfit_info() override;
273 
275  };
276  }
277 }
278 
279 #endif
The class ModelParameters.
The class LikelihoodParameters.
std::vector< double > bestfit_value() const override
get the protected member m_value
void free(const int p) override
set m_fixed to false;
std::vector< bool > m_parameter_isFixed
false free parameter; true fixed parameters
void fix(const int p, const double value) override
fix the parameter at the input value;
std::vector< double > m_parameter_bestfit_value
the best-fit parameter values, i.e. the maxima of the likelihood
~LikelihoodParameters()=default
default destructor
std::vector< std::string > status() const
return all the model parameter status
std::vector< double > m_parameter_fixed_value
the model parameter fixed values
size_t m_nparameters_fixed
the number of fixed parameters
void set_bestfit_values(const std::vector< double > bestfit_value) override
set the protected member m_bestfit_value
void m_set_parameter_type() override
private member to set the parameter types
std::vector< unsigned int > fixed_parameter() const
return the private member m_fixed_parameter
LikelihoodParameters()=default
default constructor
std::vector< unsigned int > m_free_parameter
the indexes of the free parameters
void reset() override
reset the parameter vectors
size_t m_nparameters_free
the number of free parameters
std::vector< unsigned int > free_parameter() const
return the private member m_free_parameter
void write_bestfit_info() override
write the best fit info
void fix_at_bestfit(const int p) override
fix the parameter at the bestfit value, contained in m_bestfit_value;
std::vector< double > full_parameter(const std::vector< double > parameter_value) const override
return all the model parameter
size_t nparameters_fixed() const override
return the number of fixed parameters
size_t nparameters_free() const override
return the number of free parameters
std::vector< unsigned int > m_fixed_parameter
the indexes of fixed parameters
void set_parameters(const size_t nparameters, std::vector< ParameterType > parameterTypes, std::vector< std::string > parameterNames) override
set the parameter
The class ModelParameters.
size_t nparameters() const
return the total number of parameters
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38