NumCpp  2.8.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 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
40 {
41  namespace polynomial
42  {
43  //============================================================================
44  // Method Description:
57  template<typename dtype1, typename dtype2>
58  std::complex<double> spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
59  {
62 
63  return boost::math::spherical_harmonic(m, n, static_cast<double>(phi), static_cast<double>(theta));
64  }
65 
66  //============================================================================
67  // Method Description:
80  template<typename dtype1, typename dtype2>
81  double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
82  {
85 
86  return boost::math::spherical_harmonic_r(m, n, static_cast<double>(phi), static_cast<double>(theta));
87  }
88 
89  //============================================================================
90  // Method Description:
103  template<typename dtype1, typename dtype2>
104  double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
105  {
106  STATIC_ASSERT_ARITHMETIC(dtype1);
107  STATIC_ASSERT_ARITHMETIC(dtype2);
108 
109  return boost::math::spherical_harmonic_i(m, n, static_cast<double>(phi), static_cast<double>(theta));
110  }
111  } // namespace polynomial
112 } // namespace nc
113 
114 #endif // #ifndef NUMCPP_NO_USE_BOOST
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:104
double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:81
std::complex< double > spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:58
Definition: Coordinate.hpp:45
std::int32_t int32
Definition: Types.hpp:36
std::uint32_t uint32
Definition: Types.hpp:40