NumCpp  2.10.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
spherical_harmonic.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #ifndef NUMCPP_NO_USE_BOOST
31 
32 #include <complex>
33 
34 #include "boost/math/special_functions/spherical_harmonic.hpp"
35 
37 #include "NumCpp/NdArray.hpp"
38 
39 namespace nc::polynomial
40 {
41  //============================================================================
42  // Method Description:
55  template<typename dtype1, typename dtype2>
56  std::complex<double> spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
57  {
60 
61  return boost::math::spherical_harmonic(m, n, static_cast<double>(phi), static_cast<double>(theta));
62  }
63 
64  //============================================================================
65  // Method Description:
78  template<typename dtype1, typename dtype2>
79  double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
80  {
83 
84  return boost::math::spherical_harmonic_r(m, n, static_cast<double>(phi), static_cast<double>(theta));
85  }
86 
87  //============================================================================
88  // Method Description:
101  template<typename dtype1, typename dtype2>
102  double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
103  {
104  STATIC_ASSERT_ARITHMETIC(dtype1);
105  STATIC_ASSERT_ARITHMETIC(dtype2);
106 
107  return boost::math::spherical_harmonic_i(m, n, static_cast<double>(phi), static_cast<double>(theta));
108  }
109 } // namespace nc::polynomial
110 
111 #endif // #ifndef NUMCPP_NO_USE_BOOST
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
Definition: chebyshev_t.hpp:39
double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:102
double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:79
std::complex< double > spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:56
std::int32_t int32
Definition: Types.hpp:36
std::uint32_t uint32
Definition: Types.hpp:40