9 #include <boost/math/special_functions/binomial.hpp>
16 std::complex<double> laplace_2d_fmm::center2complex(
cluster_t const& c)
18 auto const& x = c.get_bounding_box().get_center();
19 return std::complex<double>(x(0), x(1));
42 m_expansion_length = L;
47 return m_expansion_length;
52 return multipole_t::Zero(m_expansion_length + 1, 1);
57 return local_t::Zero(m_expansion_length + 1, 1);
60 laplace_2d_fmm::m2l::result_t
63 std::complex<double> z0 = center2complex(from) - center2complex(to);
64 result_t res(to.get_expansion_length() + 1, from.get_expansion_length() + 1);
65 res(0, 0) = std::log(-z0);
66 for (
size_t k = 1; k <= from.get_expansion_length(); ++k)
67 res(0, k) = 1. / std::pow(-z0, k);
68 for (
size_t l = 1; l <= to.get_expansion_length(); ++l)
70 res(l, 0) = -1. / l / std::pow(z0, l);
71 for (
size_t k = 1; k <= from.get_expansion_length(); ++k)
72 res(l, k) = 1. / std::pow(z0, l + k) * std::pow(-1, k)
73 * boost::math::binomial_coefficient<double>(
unsigned(k + l - 1),
unsigned(k - 1));
78 laplace_2d_fmm::m2m::result_t
81 std::complex<double> z0 = center2complex(from) - center2complex(to);
83 result_t res = result_t::Zero(to.get_expansion_length() + 1, from.get_expansion_length() + 1);
85 for (
size_t l = 1; l <= to.get_expansion_length(); ++l)
87 res(l, 0) = -std::pow(z0, l) / double(l);
88 for (
size_t k = 1; k <= l; ++k)
89 res(l, k) = std::pow(z0, l - k)
90 * boost::math::binomial_coefficient<double>(
unsigned(l - 1),
unsigned(k - 1));
95 laplace_2d_fmm::l2l::result_t
98 std::complex<double> z0 = center2complex(from) - center2complex(to);
99 result_t res = result_t::Zero(to.get_expansion_length() + 1, from.get_expansion_length() + 1);
100 for (
size_t l = 0; l <= to.get_expansion_length(); ++l)
102 for (
size_t k = l; k <= from.get_expansion_length(); ++k)
103 res(l, k) = boost::math::binomial_coefficient<double>(
unsigned(k),
unsigned(l))
104 * std::pow(-z0, k - l);