73 bool test_different (
double a,
double b,
double c,
double eps)
83 if (scale == 0)
return false;
84 if (scale < eps) scale = eps;
108 : _test_gradient (defs.get_bool (
"test_gradient")),
109 _test_step (defs.get_float (
"test_step")),
110 _test_eps (defs.get_float (
"test_eps"))
155 : _nconstraints (nconstraints)
198 s <<
"Base_Constrainer parameters:\n";
199 s <<
" test_gradient: " << _args.test_gradient()
200 <<
" test_step: " << _args.test_step()
201 <<
" test_eps: " << _args.test_eps() <<
"\n";
232 constraint_calculator,
262 bool val = constraint_calculator.eval (
x,
y,
F, Bx, By);
265 if (!_args.test_gradient())
272 int Nw =
x.num_row();
273 int Np =
y.num_row();
274 int Nc =
F.num_col();
277 for (
int i=1;
i<=Nc;
i++) {
280 step_x(
i) = _args.test_step();
287 if (! constraint_calculator.eval (new_x,
y, new_F, new_Bx, new_By))
295 for (
int j=1;
j<=Nc;
j++) {
296 if (test_different (test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
297 cout <<
"bad gradient x " <<
i <<
" " <<
j <<
"\n";
304 cout << (test_F - new_F);
311 for (
int i=1;
i<=Np;
i++) {
314 step_y(
i) = _args.test_step();
321 if (! constraint_calculator.eval (
x, new_y, new_F, new_Bx, new_By))
329 for (
int j=1;
j<=Nc;
j++) {
330 if (test_different (test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
331 cout <<
"bad gradient y " <<
i <<
" " <<
j <<
"\n";
338 cout << (test_F - new_F);
Define an abstract interface for getting parameter settings.
CLHEP::HepVector Column_Vector
Define matrix types for the HitFit package, and supply a few additional operations.
Abstract base class for evaluating constraints. Users derive from this class and implement the eval()...
Constraint_Calculator(int nconstraints)
Base class for constrained fitter.
Base_Constrainer(const Base_Constrainer_Args &args)
bool call_constraint_fcn(Constraint_Calculator &constraint_calculator, const Column_Vector &x, const Column_Vector &y, Row_Vector &F, Matrix &Bx, Matrix &By) const
Helper function to evaluate constraints. This takes care of checking what the user function returns a...
Abstract base classes for the fitter classes.
Base_Constrainer_Args(const Defaults &defs)
Hold on to parameters for the Base_Constrainer class.
Define an interface for getting parameter settings.
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
virtual std::ostream & print(std::ostream &s) const
Print out internal state to output stream.
bool test_gradient() const
Row-vector class. CLHEP doesn't have a row-vector class, so HitFit uses its own. This is only a simpl...