NumCpp  2.3.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 
31 #include "NumCpp/NdArray.hpp"
32 
33 #include "boost/math/special_functions/spherical_harmonic.hpp"
34 
35 #include <complex>
36 
37 namespace nc
38 {
39  namespace 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 polynomial
110 } // namespace nc
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:79
NdArray.hpp
nc::polynomial::spherical_harmonic_i
double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:102
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:56