Giù Marcer
093faf3fe8
move all the functions to lib.c and lib.h; add this two librearies to makefile; make plot.py more easy to use for passing to one mode to the other (show or save figure); create fit_plot and create the figure 5-fit.pdf.
36 lines
885 B
C
36 lines
885 B
C
#pragma once
|
|
|
|
|
|
// Subtruct for the results storage.
|
|
//
|
|
struct poket
|
|
{
|
|
double * x; // Vector with the numbers of function calls.
|
|
double * y; // Vector with Plain MC error estimates.
|
|
};
|
|
|
|
// Struct for the results storage.
|
|
//
|
|
struct bag
|
|
{
|
|
struct poket pokets; // Values.
|
|
size_t size; // Quantity of values.
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Wrapper for the gsl_function structure.
|
|
//
|
|
double function (double * x, size_t dim, void * params);
|
|
|
|
// Results printer.
|
|
//
|
|
void results (size_t calls, double result, double error, double chi);
|
|
|
|
// Do a linear minimization fitting the model y = a⋅x^b. The p-value of the
|
|
// compatibility test of b with the expected value -0.5 is returned in p.
|
|
//
|
|
void fit (struct bag full_bag, double* p,
|
|
double* a, double* a_err,
|
|
double* b, double* b_err);
|