53 for (
unsigned j=0;j<n;j++) {
58 for (
unsigned i=0;i<
m;i++)
59 J(i,j) = (ty(i)-y(i))/h(j);
89 for (
unsigned j=0;j<n;j++) {
100 for (
unsigned i=0;i<
m;i++)
101 J(i,j) = (yp(i)-ym(i))/(2*h(j));
112 assert(x.
size() == n);
120 double e = (J1 - J2).fro_norm();
125 std::cerr << __FILE__
": e = " << e << std::endl
126 << __FILE__
": t = " << t << std::endl;
void vnl_discrete_diff_test_lsf(vnl_least_squares_function *lsf, vnl_vector< double > const &x)
bool VNL_ALGO_EXPORT vnl_discrete_diff_fwd(vnl_least_squares_function *lsf, double h, vnl_vector< double > const &x, vnl_matrix< double > &J)
forward differences.
Abstract base for minimising functions.
Functions to compute jacobians of vnl_least_squares_functions.
size_t size() const
Return the length, number of elements, dimension of this vector.
unsigned int get_number_of_unknowns() const
Return the number of unknowns.
Abstract base for minimising functions.
virtual void gradf(vnl_vector< double > const &x, vnl_matrix< double > &jacobian)
Calculate the Jacobian, given the parameter vector x.
bool VNL_ALGO_EXPORT vnl_discrete_diff_sym(vnl_least_squares_function *lsf, double h, vnl_vector< double > const &x, vnl_matrix< double > &J)
symmetric differences.
vnl_vector & fill(T const &v)
Set all values to v.
unsigned int get_number_of_residuals() const
Return the number of residuals.
unsigned int rows() const
Return the number of rows.
VNL_EXPORT T cos_angle(m const &, m const &)
virtual void f(vnl_vector< double > const &x, vnl_vector< double > &fx)=0
The main function.
unsigned int columns() const
Return the number of columns.