analistica/ex-5/lib.h

36 lines
885 B
C
Raw Normal View History

#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);