45 #ifndef CLIPPER_RESOL_FN
46 #define CLIPPER_RESOL_FN
77 std::vector<ftype>
df;
80 Fderiv(
const int& np) : df(np,0.0), df2(np,np,0.0) {}
90 virtual ftype f(
const HKL& hkl,
const Cell& cell,
const std::vector<ftype>& params )
const {
return fderiv( hkl, cell, params ).
f; }
92 virtual const Fderiv&
fderiv(
const HKL& hkl,
const Cell& cell,
const std::vector<ftype>& params )
const = 0;
104 mutable Fderiv result_;
194 const std::vector<ftype>&
params()
const;
ftype f
value of function
Definition: resol_fn.h:76
abstract base class for resolution function basis functions
Definition: resol_fn.h:66
void calc_derivs(const std::vector< ftype > ¶ms, ftype &r, std::vector< ftype > &drdp, Matrix<> &drdp2) const
calculate derivatives of target wrt params
Definition: resol_fn.cpp:91
std::vector< ftype > df
first derivative vector w.r.t params
Definition: resol_fn.h:77
virtual ~BasisFn_base()
destructor
Definition: resol_fn.h:100
virtual FNtype type() const
the type of the function: optionally used to improve convergence
Definition: resol_fn.h:132
Fderiv & result() const
provide write access to result for subclasses
Definition: resol_fn.h:99
const std::vector< ftype > & params() const
return the values of the parameters
Definition: resol_fn.cpp:196
abstract base class for least-squares resolution function target functions
Definition: resol_fn.h:114
virtual ~TargetFn_base()
destructor
Definition: resol_fn.h:133
HKL reference with index-like behaviour.
Definition: hkl_info.h:151
ftype f(const HKL_info::HKL_reference_index &ih) const
return the value of the basis function with the current paramters
Definition: resol_fn.h:192
BasisFn_base()
null constructor
Definition: resol_fn.h:84
void debug() const
print the target, gradient, and curvatures with respect to the params
Fderiv()
null constructor
Definition: resol_fn.h:79
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
HKL list container and tree root.
Definition: hkl_info.h:62
virtual ftype f(const HKL &hkl, const Cell &cell, const std::vector< ftype > ¶ms) const
the value of the resolution function
Definition: resol_fn.h:90
const HKL_info * hkl_info_
reflection list
Definition: resol_fn.h:200
Cell object.
Definition: cell.h:121
virtual Rderiv rderiv(const HKL_info::HKL_reference_index &ih, const ftype &fh) const =0
return the value and derivatives of the target function
virtual int num_diagonals() const
number of non-zero diagonals in the upper triangle of the curvatures
Definition: resol_fn.cpp:81
Cell cell_
cell
Definition: resol_fn.h:204
virtual FNtype type() const
the type of the function: optionally used to improve convergence
Definition: resol_fn.cpp:71
object holding the residual function and first two derivatives
Definition: resol_fn.h:118
2nd order resolution function evaluator
Definition: resol_fn.h:186
const BasisFn_base * basisfn_
basis function
Definition: resol_fn.h:202
FNtype
enumeration of function types: optionally used to improve convergence
Definition: resol_fn.h:70
BasisFn_base(const int &np)
constructor: takes number of parameters
Definition: resol_fn.h:86
ResolutionFn_nonlinear(const HKL_info &hkl_info, const BasisFn_base &basisfn, const TargetFn_base &targetfn, const std::vector< ftype > ¶ms, const ftype damp=0.0, const bool debug=false)
constructor: need reflections, basis fn and target fn.
Definition: resol_fn.cpp:206
2nd order resolution function evaluator
Definition: resol_fn.h:234
object holding the basis function and its first two derivatives
Definition: resol_fn.h:73
ftype dr
first derivative w.r.t basis fn
Definition: resol_fn.h:122
Matrix df2
second derivative matrix w.r.t params
Definition: resol_fn.h:78
ResolutionFn()
null constructor
Definition: resol_fn.h:210
const int & num_params() const
the number of parameters of this basis function
Definition: resol_fn.h:88
virtual const Fderiv & fderiv(const HKL &hkl, const Cell &cell, const std::vector< ftype > ¶ms) const =0
the value of the resolution function and its first two derivatives
General matrix class: like Array2d but with numerical methods.
Definition: clipper_types.h:396
ftype dr2
second derivative w.r.t basis fn
Definition: resol_fn.h:123
ftype r
the value of the function
Definition: resol_fn.h:121
const HKL & hkl() const
return the current HKL
Definition: hkl_info.h:160
const TargetFn_base * targetfn_
target function
Definition: resol_fn.h:201
void debug(const HKL_info &hkl_info) const
test that the residuals, gradients, and curvatures are consistent
Definition: resol_fn.cpp:50
reflection 'Miller' index
Definition: coords.h:145
FNtype
enumeration of function types: optionally used to improve convergence
Definition: resol_fn.h:127
std::vector< ftype > params_
basis function parameters
Definition: resol_fn.h:203