17#ifndef __dwi_tractography_sift2_regularisation_h__
18#define __dwi_tractography_sift2_regularisation_h__
28 namespace Tractography
35 template <
typename value_type>
38 return ((coeff <= base) ?
40 (
Math::pow2(std::exp(coeff) - std::exp(base))));
42 template <
typename value_type>
45 return ((coeff <= base) ?
47 (
value_type(2.0) * std::exp(coeff) * (std::exp(coeff) - std::exp(base))));
49 template <
typename value_type>
52 return ((coeff <= base) ?
56 template <
typename value_type>
59 return ((coeff <= base) ?
64 inline void dxtvreg_dcoeffx (LineSearchFunctor::Result& result,
const double coeff,
const double expcoeff,
const double multiplier,
const double base,
const double expbase)
67 result.cost += multiplier *
Math::pow2 (coeff - base);
68 result.first_deriv += multiplier * 2.0 * (coeff - base);
69 result.second_deriv += multiplier * 2.0;
71 result.cost += multiplier *
Math::pow2 (expcoeff - expbase);
72 result.first_deriv += multiplier * 2.0 * expcoeff * (expcoeff - expbase);
73 result.second_deriv += multiplier * 2.0 * expcoeff * ((2.0*expcoeff) - expbase);
74 result.third_deriv += multiplier * 2.0 * expcoeff * ((4.0*expcoeff) - expbase);
constexpr T pow2(const T &v)
value_type dtvreg_dcoeff(const value_type coeff, const value_type base)
value_type d3tvreg_dcoeff3(const value_type coeff, const value_type base)
value_type tvreg(const value_type coeff, const value_type base)
value_type d2tvreg_dcoeff2(const value_type coeff, const value_type base)
void dxtvreg_dcoeffx(LineSearchFunctor::Result &result, const double coeff, const double expcoeff, const double multiplier, const double base, const double expbase)
MR::default_type value_type