10#include <kernel/util/tiny_algebra.hpp>
48 static_assert(m_ > 0,
"invalid vector field dimension");
63 template<
typename DataType_,
int domain_dim_,
typename ImageType_>
67 template<
typename DataType_,
int domain_dim_>
70 typedef DataType_ DataType;
71 static constexpr int domain_dim = domain_dim_;
72 static constexpr int image_dim = 1;
76 typedef DataType_ ValueType;
82 template<
typename DataType_,
int domain_dim_,
int image_dim_>
85 typedef DataType_ DataType;
86 static constexpr int domain_dim = domain_dim_;
87 static constexpr int image_dim = image_dim_;
96 template<
typename DataType_,
typename Function_>
98 public EvalTraitsBase<DataType_, Function_::domain_dim, typename Function_::ImageType>
143 static constexpr bool can_grad =
false;
144 static constexpr bool can_hess =
false;
155 template<
typename Traits_>
273 template<
typename Function_,
typename DT_,
int dim_,
int s_>
278 static_assert(Function_::can_value,
"function does not support evaluation of values");
279 static_assert(dim_ == Traits::domain_dim,
"invalid point dimension");
280 typename Function_::template Evaluator<Traits> evaluator(function);
281 return evaluator.value(point);
285 template<
typename Function_,
typename DT_>
287 eval_value_x(
const Function_& function,
const DT_ x)
295 template<
typename Function_,
typename DT_>
296 typename Analytic::EvalTraits<DT_, Function_>::ValueType
297 eval_value_x(
const Function_& function,
const DT_ x,
const DT_ y)
299 Tiny::Vector<DT_, 2> p;
306 template<
typename Function_,
typename DT_>
307 typename Analytic::EvalTraits<DT_, Function_>::ValueType
308 eval_value_x(
const Function_& function,
const DT_ x,
const DT_ y,
const DT_ z)
310 Tiny::Vector<DT_, 3> p;
333 template<
typename Function_,
typename DT_,
int dim_,
int s_>
334 typename Analytic::EvalTraits<DT_, Function_>::GradientType
338 static_assert(Function_::can_grad,
"function does not support evaluation of gradients");
339 static_assert(dim_ == Traits::domain_dim,
"invalid point dimension");
340 typename Function_::template Evaluator<Traits> evaluator(function);
341 return evaluator.gradient(point);
345 template<
typename Function_,
typename DT_>
347 eval_gradient_x(
const Function_& function,
const DT_ x)
355 template<
typename Function_,
typename DT_>
356 typename Analytic::EvalTraits<DT_, Function_>::GradientType
357 eval_gradient_x(
const Function_& function,
const DT_ x,
const DT_ y)
359 Tiny::Vector<DT_, 2> p;
366 template<
typename Function_,
typename DT_>
367 typename Analytic::EvalTraits<DT_, Function_>::GradientType
368 eval_gradient_x(
const Function_& function,
const DT_ x,
const DT_ y,
const DT_ z)
370 Tiny::Vector<DT_, 3> p;
393 template<
typename Function_,
typename DT_,
int dim_,
int s_>
394 typename Analytic::EvalTraits<DT_, Function_>::HessianType
398 static_assert(Function_::can_hess,
"function does not support evaluation of hessians");
399 static_assert(dim_ == Traits::domain_dim,
"invalid point dimension");
400 typename Function_::template Evaluator<Traits> evaluator(function);
401 return evaluator.hessian(point);
405 template<
typename Function_,
typename DT_>
407 eval_hessian_x(
const Function_& function,
const DT_ x)
415 template<
typename Function_,
typename DT_>
416 typename Analytic::EvalTraits<DT_, Function_>::HessianType
417 eval_hessian_x(
const Function_& function,
const DT_ x,
const DT_ y)
419 Tiny::Vector<DT_, 2> p;
426 template<
typename Function_,
typename DT_>
427 typename Analytic::EvalTraits<DT_, Function_>::HessianType
428 eval_hessian_x(
const Function_& function,
const DT_ x,
const DT_ y,
const DT_ z)
430 Tiny::Vector<DT_, 3> p;
Analytic Function Evaluator base-class template.
ValueType value(const PointType &point)
Computes the function value in a given point.
GradientType gradient(const PointType &point)
Computes the function gradient in a given point.
Traits_::PointType PointType
The type of the domain evaluation point.
Traits_::HessianType HessianType
The type of the function hessian.
Traits_::GradientType GradientType
The type of the function gradient.
Traits_::DataType DataType
The underlying floating point data type.
Traits_::ValueType ValueType
The type of the function value.
Evaluator(const Function &function)
Mandatory constructor.
HessianType hessian(const PointType &point)
Computes the function hessian in a given point.
Analytic Function interface.
static constexpr bool can_grad
Specifies whether the function's evaluator can compute function gradients.
static constexpr bool can_hess
Specifies whether the function's evaluator can compute function hessians.
static constexpr bool can_value
Specifies whether the function's evaluator can compute function values.
typedef ImageType
Specifies the image type of the function.
static constexpr int domain_dim
Specifies the domain dimension of the function.
Tiny Matrix class template.
Tiny Tensor3 class template.
Tiny Vector class template.
Analytic::EvalTraits< DT_, Function_ >::GradientType eval_gradient(const Function_ &function, const Tiny::Vector< DT_, dim_, s_ > &point)
Helper function to quickly evaluate a function gradient in a given point.
Analytic::EvalTraits< DT_, Function_ >::HessianType eval_hessian(const Function_ &function, const Tiny::Vector< DT_, dim_, s_ > &point)
Helper function to quickly evaluate a function hessian in a given point.
Analytic::EvalTraits< DT_, Function_ >::ValueType eval_value(const Function_ &function, const Tiny::Vector< DT_, dim_, s_ > &point)
Helper function to quickly evaluate a function value in a given point.
analytic evaluation traits base-class
Scalar Function Image tag class.
static constexpr bool is_scalar
this is a scalar function
static constexpr bool is_vector
this is not a vector field
static constexpr int scalar_components
this function has 1 scalar component
Vector Field Image tag class.
static constexpr bool is_vector
this is a vector field
static constexpr int scalar_components
this function has m_ scalar components
static constexpr int image_dim
this is the image dimension of the vector field
static constexpr bool is_scalar
this is not a scalar function