72 bool test_different (
double a,
double b,
double c,
double eps)
82 if (scale == 0)
return false;
83 if (scale < eps) scale = eps;
107 : _test_gradient (defs.get_bool (
"test_gradient")),
108 _test_step (defs.get_float (
"test_step")),
109 _test_eps (defs.get_float (
"test_eps"))
154 : _nconstraints (nconstraints)
197 s <<
"Base_Constrainer parameters:\n";
198 s <<
" test_gradient: " << _args.test_gradient()
199 <<
" test_step: " << _args.test_step()
200 <<
" test_eps: " << _args.test_eps() <<
"\n";
231 constraint_calculator,
261 bool val = constraint_calculator.eval (
x,
y,
F, Bx, By);
264 if (!_args.test_gradient())
271 int Nw =
x.num_row();
272 int Np =
y.num_row();
273 int Nc =
F.num_col();
276 for (
int i=1;
i<=Nc;
i++) {
279 step_x(
i) = _args.test_step();
286 if (! constraint_calculator.eval (new_x,
y, new_F, new_Bx, new_By))
294 for (
int j=1;
j<=Nc;
j++) {
295 if (test_different (test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
296 cout <<
"bad gradient x " <<
i <<
" " <<
j <<
"\n";
303 cout << (test_F - new_F);
310 for (
int i=1;
i<=Np;
i++) {
313 step_y(
i) = _args.test_step();
320 if (! constraint_calculator.eval (
x, new_y, new_F, new_Bx, new_By))
328 for (
int j=1;
j<=Nc;
j++) {
329 if (test_different (test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
330 cout <<
"bad gradient y " <<
i <<
" " <<
j <<
"\n";
337 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)
Abs< T >::type abs(const T &t)
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...