NumCpp  2.4.0
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 NO_USE_BOOST
31 
33 #include "NumCpp/NdArray.hpp"
34 
35 #include "boost/math/special_functions/spherical_harmonic.hpp"
36 
37 #include <complex>
38 
39 namespace nc
40 {
41  namespace polynomial
42  {
43  //============================================================================
44  // Method Description:
58  template<typename dtype1, typename dtype2>
59  std::complex<double> spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
60  {
63 
64  return boost::math::spherical_harmonic(m, n, static_cast<double>(phi), static_cast<double>(theta));
65  }
66 
67  //============================================================================
68  // Method Description:
82  template<typename dtype1, typename dtype2>
83  double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
84  {
87 
88  return boost::math::spherical_harmonic_r(m, n, static_cast<double>(phi), static_cast<double>(theta));
89  }
90 
91  //============================================================================
92  // Method Description:
106  template<typename dtype1, typename dtype2>
107  double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
108  {
109  STATIC_ASSERT_ARITHMETIC(dtype1);
110  STATIC_ASSERT_ARITHMETIC(dtype2);
111 
112  return boost::math::spherical_harmonic_i(m, n, static_cast<double>(phi), static_cast<double>(theta));
113  }
114  } // namespace polynomial
115 } // namespace nc
116 
117 #endif // #ifndef NO_USE_BOOST
StaticAsserts.hpp
nc::int32
std::int32_t int32
Definition: Types.hpp:36
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:40
nc::polynomial::spherical_harmonic_r
double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:83
NdArray.hpp
nc::polynomial::spherical_harmonic_i
double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:107
nc
Definition: Coordinate.hpp:44
nc::polynomial::spherical_harmonic
std::complex< double > spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:59