9 #include <boost/math/constants/constants.hpp>
10 #include <boost/math/special_functions/spherical_harmonic.hpp>
19 unit_sphere::unit_sphere(
size_t P)
22 using namespace boost::math::double_constants;
23 auto res = NiHu::gauss_impl<double>(
unsigned(m_P));
24 auto const &xi = res.col(0);
25 this->wtheta = res.col(1);
28 size_t N = 2 * m_P*m_P;
32 theta = acos(xi.array());
35 for (
size_t i = 0; i < 2 * m_P; ++i)
37 phi(i) = i * pi / m_P;
38 s.block(0, i*m_P, 1, m_P) = std::cos(phi(i)) * sin(theta.array().transpose());
39 s.block(1, i*m_P, 1, m_P) = std::sin(phi(i)) * sin(theta.array().transpose());
40 s.block(2, i*m_P, 1, m_P) = xi.transpose();
41 w.segment(i*m_P, m_P) = this->wtheta * pi / m_P;
47 using boost::math::spherical_harmonic;
48 Eigen::Matrix<std::complex<double>, Eigen::Dynamic, Eigen::Dynamic> Flm(L + 1, 2 * L + 1);
50 for (
int l = 0; l <= L; ++l)
51 for (
int m = -l; m <= l; ++m)
52 for (
int k = 0; k < s.cols(); ++k)
54 conj(spherical_harmonic(l, m, theta(k%m_P), phi(k / m_P)))
61 using boost::math::spherical_harmonic;
62 Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1> f(s.cols(), 1);
64 int L = int(Flm.rows() - 1);
65 for (
int l = 0; l <= L; ++l)
66 for (
int m = -l; m <= l; ++m)
67 for (
int k = 0; k < s.cols(); ++k)
69 * spherical_harmonic(l, m, theta(k%m_P), phi(k / m_P));