69 bool test_different(
double a,
double b,
double c,
double eps)
101 : _test_gradient(defs.get_bool(
"test_gradient")),
102 _test_step(defs.get_float(
"test_step")),
103 _test_eps(defs.get_float(
"test_eps")) {}
141 : _nconstraints(nconstraints) {}
176 s <<
"Base_Constrainer parameters:\n";
177 s <<
" test_gradient: " << _args.test_gradient() <<
" test_step: " << _args.test_step()
178 <<
" test_eps: " << _args.test_eps() <<
"\n";
236 bool val = constraint_calculator.eval(
x, y,
F, Bx, By);
239 if (!_args.test_gradient())
246 int Nw =
x.num_row();
247 int Np = y.num_row();
248 int Nc =
F.num_col();
251 for (
int i = 1;
i <= Nc;
i++) {
254 step_x(
i) = _args.test_step();
261 if (!constraint_calculator.eval(new_x, y, new_F, new_Bx, new_By))
269 for (
int j = 1;
j <= Nc;
j++) {
270 if (test_different(test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
271 cout <<
"bad gradient x " <<
i <<
" " <<
j <<
"\n";
278 cout << (test_F - new_F);
285 for (
int i = 1;
i <= Np;
i++) {
288 step_y(
i) = _args.test_step();
295 if (!constraint_calculator.eval(
x, new_y, new_F, new_Bx, new_By))
303 for (
int j = 1;
j <= Nc;
j++) {
304 if (test_different(test_F(
j), new_F(
j),
F(
j), _args.test_eps())) {
305 cout <<
"bad gradient y " <<
i <<
" " <<
j <<
"\n";
312 cout << (test_F - new_F);
virtual std::ostream & print(std::ostream &s) const
Print out internal state to output stream.
bool test_gradient() const
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)
Abstract base classes for the fitter classes.
Base_Constrainer_Args(const Defaults &defs)
Hold on to parameters for the Base_Constrainer class.
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...
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)
Row-vector class. CLHEP doesn't have a row-vector class, so HitFit uses its own. This is only a simpl...