Tatooine
thin_plate_spline.h
Go to the documentation of this file.
1#ifndef TATOOINE_THIN_PLATE_SPLINE_H
2#define TATOOINE_THIN_PLATE_SPLINE_H
3//==============================================================================
4#include <tatooine/math.h>
5//==============================================================================
6namespace tatooine {
7//==============================================================================
8auto constexpr thin_plate_spline = [](auto const x) -> decltype(x) {
9 if (x == 0) {
10 return 0;
11 }
12 return x * x * gcem::log(x);
13};
14//------------------------------------------------------------------------------
16 [](auto const xx) -> decltype(xx) {
17 if (xx == 0) {
18 return 0;
19 }
20 return xx * gcem::log(xx) / 2;
21};
22//------------------------------------------------------------------------------
23auto constexpr thin_plate_spline_diff1 = [](auto const x) -> decltype(x) {
24 return 2 * x * gcem::log(x) + x;
25};
26//------------------------------------------------------------------------------
27auto constexpr thin_plate_spline_diff2 = [](auto const x) -> decltype(x) {
28 return 2 * gcem::log(x) + 3;
29};
30//------------------------------------------------------------------------------
31auto constexpr thin_plate_spline_diff3 = [](auto const x) -> decltype(x) {
32 return 2 / x;
33};
34//------------------------------------------------------------------------------
35template <std::size_t N = 1>
36auto constexpr diff(decltype(thin_plate_spline) const& /*f*/) {
37 if constexpr (N == 0) {
38 return thin_plate_spline;
39 } else if constexpr (N == 1) {
41 } else if constexpr (N == 2) {
43 } else if constexpr (N == 3) {
45 }
46}
47//------------------------------------------------------------------------------
48template <std::size_t N = 1>
49auto constexpr diff(decltype(thin_plate_spline_diff1) const& /*f*/) {
50 if constexpr (N == 0) {
52 } else if constexpr (N == 1) {
54 } else if constexpr (N == 2) {
56 }
57}
58//------------------------------------------------------------------------------
59template <std::size_t N = 1>
60auto constexpr diff(decltype(thin_plate_spline_diff2) const& /*f*/) {
61 if constexpr (N == 0) {
63 } else if constexpr (N == 2) {
65 }
66}
67//==============================================================================
68} // namespace tatooine
69//==============================================================================
70#endif
Definition: algorithm.h:6
auto constexpr thin_plate_spline_from_squared
Definition: thin_plate_spline.h:15
auto constexpr thin_plate_spline_diff3
Definition: thin_plate_spline.h:31
auto constexpr thin_plate_spline_diff2
Definition: thin_plate_spline.h:27
auto constexpr thin_plate_spline
Definition: thin_plate_spline.h:8
auto constexpr thin_plate_spline_diff1
Definition: thin_plate_spline.h:23
constexpr auto diff(polynomial< Real, Degree > const &f)
Definition: polynomial.h:179