This is only for the test class, but reuses library code.
This should make it much easier in the future to implement chi2 gradient functions to minfx, since it
is only necessary to implement the direct gradient of the function, and then pass the direct gradient to chi2 library, which turn it into
the chi2 gradient function which minfx use.
task #7822(https://gna.org/task/index.php?7822): Implement user function to estimate R2eff and associated errors for exponential curve fitting.