NumCpp  1.0
A C++ implementation of the Python Numpy library
spherical_harmonic.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
33 
34 #include "boost/math/special_functions/spherical_harmonic.hpp"
35 
36 #include <complex>
37 
38 namespace nc
39 {
40  namespace polynomial
41  {
42  //============================================================================
43  // Method Description:
56  template<typename dtype1, typename dtype2>
57  std::complex<double> spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
58  {
61 
62  return boost::math::spherical_harmonic(m, n, static_cast<double>(phi), static_cast<double>(theta));
63  }
64 
65  //============================================================================
66  // Method Description:
79  template<typename dtype1, typename dtype2>
80  double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
81  {
84 
85  return boost::math::spherical_harmonic_r(m, n, static_cast<double>(phi), static_cast<double>(theta));
86  }
87 
88  //============================================================================
89  // Method Description:
102  template<typename dtype1, typename dtype2>
103  double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
104  {
105  STATIC_ASSERT_ARITHMETIC(dtype1);
106  STATIC_ASSERT_ARITHMETIC(dtype2);
107 
108  return boost::math::spherical_harmonic_i(m, n, static_cast<double>(phi), static_cast<double>(theta));
109  }
110  }
111 }
StaticAsserts.hpp
nc::int32
std::int32_t int32
Definition: Types.hpp:37
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
nc::polynomial::spherical_harmonic_r
double spherical_harmonic_r(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:80
NdArray.hpp
nc::polynomial::spherical_harmonic_i
double spherical_harmonic_i(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:103
nc
Definition: Coordinate.hpp:45
nc::polynomial::spherical_harmonic
std::complex< double > spherical_harmonic(uint32 n, int32 m, dtype1 theta, dtype2 phi)
Definition: spherical_harmonic.hpp:57