23template <
typename elemT>
24GeneralisedPrior<elemT>::GeneralisedPrior()
26 penalisation_factor = 0;
29template <
typename elemT>
31GeneralisedPrior<elemT>::get_penalisation_factor()
const
33 return penalisation_factor;
39template <
typename elemT>
43 penalisation_factor = new_penalisation_factor;
46template <
typename TargetT>
50 this->parser.add_key(
"penalisation factor", &this->penalisation_factor);
53template <
typename TargetT>
57 _already_set_up =
false;
58 this->penalisation_factor = 0;
61template <
typename TargetT>
65 _already_set_up =
true;
66 return Succeeded::yes;
69template <
typename TargetT>
73 error(
"GeneralisedPrior:\n compute_gradient_times_input is not implemented by your prior.");
77template <
typename TargetT>
81 const TargetT& current_image_estimate)
const
84 error(
"GeneralisedPrior:\n compute_Hessian implementation is not overloaded by your convex prior.");
86 error(
"GeneralisedPrior:\n compute_Hessian is not implemented for this (non-convex) prior.");
89template <
typename TargetT>
93 error(
"GeneralisedPrior:\n compute_Hessian_diagonal is not implemented by your prior.");
96template <
typename TargetT>
100 error(
"GeneralisedPrior:\n"
101 "add_multiplication_with_approximate_Hessian implementation is not overloaded by your prior.");
104template <
typename TargetT>
107 const TargetT& current_estimate,
108 const TargetT& input)
const
110 error(
"GeneralisedPrior:\n"
111 "accumulate_Hessian_times_input implementation is not overloaded by your prior.");
114template <
typename TargetT>
118 if (!_already_set_up)
119 error(
"The prior should already be set-up, but it's not.");
class BasicCoordinate<int num_dimensions, typename coordT> defines num_dimensions -dimensional coordi...
Definition BasicCoordinate.h:57
virtual double compute_gradient_times_input(const DataT &input, const DataT ¤t_estimate)
compute the dot product of the gradient of the log of the prior function at the current_estimate with...
Definition GeneralisedPrior.inl:71
virtual void compute_Hessian(DataT &prior_Hessian_for_single_densel, const BasicCoordinate< 3, int > &coords, const DataT ¤t_image_estimate) const
This computes a single row of the Hessian.
Definition GeneralisedPrior.inl:79
void set_penalisation_factor(float new_penalisation_factor)
Definition GeneralisedPrior.inl:41
virtual void add_multiplication_with_approximate_Hessian(DataT &output, const DataT &input) const
This should compute the multiplication of the Hessian with a vector and add it to output.
Definition GeneralisedPrior.inl:98
virtual Succeeded set_up(shared_ptr< const DataT > const &target_sptr)
Has to be called before using this object.
Definition GeneralisedPrior.inl:63
virtual void compute_Hessian_diagonal(DataT &Hessian_diagonal, const DataT ¤t_estimate) const
This computes the diagonal of the Hessian of the log of the prior function at the current_estimate an...
Definition GeneralisedPrior.inl:91
virtual void check(DataT const ¤t_estimate) const
Check that the prior is ready to be used.
Definition GeneralisedPrior.inl:116
void initialise_keymap() override
sets key for penalisation factor
Definition GeneralisedPrior.inl:48
virtual void accumulate_Hessian_times_input(DataT &output, const DataT ¤t_estimate, const DataT &input) const
This should compute the multiplication of the Hessian with a vector and add it to output.
Definition GeneralisedPrior.inl:106
void set_defaults() override
sets value for penalisation factor
Definition GeneralisedPrior.inl:55
virtual bool is_convex() const =0
Indicates if the prior is a smooth convex function.
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition error.cxx:42