try {
auto chi2 = [] (const double xx)
{
const double mean = 0.;
const double sigma = 1.;
return pow(xx-mean, 2)/(sigma*sigma);
};
const double starting_point = 99.;
const double min = -100.;
const double max = 100.;
std::cout << "result of the minimisation: " << res << std::endl;
auto chi2_2 = [] (std::vector<double> &xx)
{
const double mean1 = 0.;
const double sigma1 = 1.;
const double mean2 = 1.;
const double sigma2 = 1.;
return pow(xx[0]-mean1, 2)/(sigma1*sigma1)+pow(xx[1]-mean2, 2)/(sigma2*sigma2);
};
std::vector<double> starting_points = {5, 5};
std::vector<std::vector<double>> point_limits = {{-10, 10}, {-10, 10}};
const int maxiter = 10000;
}
return 0;
}
Useful generic functions.
int main()
main function to create the logo of the CosmoBolognaLib
const char * what() const noexcept override
the error description
double GSL_minimize_1D(FunctionDoubleDouble func, const double start, double min=par::defaultDouble, double max=-par::defaultDouble, const int max_iter=1000, const bool verbose=false)
minimize the provided function using GSL procedure
std::vector< double > GSL_minimize_nD(FunctionDoubleVector func, const std::vector< double > start, const std::vector< std::vector< double >> ranges, const unsigned int max_iter=1000, const double tol=1.e-6, const double epsilon=0.1)
minimize the provided function using GSL procedure
void Print(const T value, const int prec, const int ww, const std::string header="", const std::string end="\n", const bool use_coutCBL=true, std::ostream &stream=std::cout, const std::string colour=cbl::par::col_default)
function to print values with a proper homegenised format