CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Chi2.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 
34 #ifndef __CHI2__
35 #define __CHI2__
36 
37 #include "Likelihood.h"
38 
39 
40 // ============================================================================================
41 
42 
43 namespace cbl {
44 
45  namespace statistics {
46 
55  class Chi2 : public Likelihood
56  {
57 
58  public:
59 
64 
68  Chi2 () : Likelihood() {}
69 
86  Chi2 (const std::shared_ptr<data::Data> data, const std::shared_ptr<Model> model, const bool use_covariance=false, const std::vector<size_t> x_index={0,2}, const int w_index=-1);
87 
91  ~Chi2 () = default;
92 
94 
102  double operator () (std::vector<double> &pp) const;
103 
119  void minimize (const std::vector<double> start, const std::vector<std::vector<double>> parameter_limits, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3);
120 
121  };
122  }
123 }
124 
125 #endif
The class Likelihood.
The class Chi2.
Definition: Chi2.h:56
~Chi2()=default
default destructor
Chi2()
default constructor
Definition: Chi2.h:68
double operator()(std::vector< double > &pp) const
evaluate the
Definition: Chi2.cpp:43
void minimize(const std::vector< double > start, const std::vector< std::vector< double >> parameter_limits, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3)
function that minimizes the , finds the best-fit parameters and stores them in model parameters
Definition: Chi2.cpp:74
The class Likelihood.
Definition: Likelihood.h:56
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38