6 #ifndef NORMALISATION_H
7 #define NORMALISATION_H
25 return sqrt(
l*(
l+1) * 4*M_PI / (2*
l+1)) *
26 exp(0.5*(lgamma(
l+m+1) - lgamma(
l-m+1)));
163 return cexp(I*m*phi);
165 return cexp(-I*m*phi);
167 if (m > 0)
return M_SQRT2 * cos(m*phi);
168 else if (m < 0)
return M_SQRT2 * sin(m*phi);
202 return I*cexp(I*m*phi);
204 return -I*cexp(-I*m*phi);
206 if (m > 0)
return -M_SQRT2 * sin(m*phi);
207 else if (m < 0)
return M_SQRT2 * cos(m*phi);
216 static inline int qpms_normalisation_t_normonly(qpms_normalisation_t norm) {
217 return norm & (~QPMS_NORMALISATION_T_CSBIT);
233 norm = qpms_normalisation_t_normonly(norm);
236 case QPMS_NORMALISATION_KRISTENSSON:
239 case QPMS_NORMALISATION_TAYLOR:
240 factor = sqrt(
l*(
l+1));
242 case QPMS_NORMALISATION_NONE:
243 factor = sqrt(
l*(
l+1) * 4 * M_PI / (2*
l+1) * exp(lgamma(
l+m+1)-lgamma(
l-m+1)));
245 #ifdef USE_XU_ANTINORMALISATION
246 case QPMS_NORMALISATION_XU:
247 factor = sqrt(4 * M_PI) / (2*
l+1) * exp(lgamma(
l+m+1)-lgamma(
l-m+1));
253 factor *= (m%2)?(-csphase):1;
260 norm = qpms_normalisation_t_normonly(norm);
262 case QPMS_NORMALISATION_KRISTENSSON:
265 case QPMS_NORMALISATION_TAYLOR:
268 case QPMS_NORMALISATION_NONE:
269 return l*(
l+1) * 4 * M_PI / (2*
l+1) * exp(lgamma(
l+m+1)-lgamma(
l-m+1));
271 #ifdef USE_XU_ANTINORMALISATION
272 case QPMS_NORMALISATION_XU:
274 double fac = sqrt(4 * M_PI) / (2*
l+1) * exp(lgamma(
l+m+1)-lgamma(
l-m+1));
Various index conversion functions.
static qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_m_t *m, qpms_l_t *n)
Conversion from universal VSWF index u to type, order and degree.
Definition: indexing.h:70
static complex double qpms_spharm_azimuthal_part_derivative_div_m(qpms_normalisation_t norm, qpms_m_t m, double phi)
Returns derivative of the asimuthal part of a spherical harmonic divided by m.
Definition: normalisation.h:197
static complex double qpms_normalisation_factor_N_M(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a electric basis VSWF divided by the factor of a magnetic VWFS of a given conv...
Definition: normalisation.h:87
static double qpms_normalisation_normfactor(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the (real positive) common norm factor of a given normalisation compared to the reference con...
Definition: normalisation.h:18
static complex double qpms_normalisation_factor_L(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a longitudinal basis VSWF of a given convention compared to the reference conv...
Definition: normalisation.h:112
static complex double qpms_normalisation_factor_M(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a magnetic basis VSWF of a given convention compared to the reference conventi...
Definition: normalisation.h:54
static complex double qpms_normalisation_factor_uvswfi(const qpms_normalisation_t norm, qpms_uvswfi_t ui)
Returns the factors of a basis VSWF of a given convention compared to the reference convention.
Definition: normalisation.h:118
static complex double qpms_normalisation_factor_N(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a electric basis VSWF of a given convention compared to the reference conventi...
Definition: normalisation.h:80
static complex double qpms_spharm_azimuthal_part(qpms_normalisation_t norm, qpms_m_t m, double phi)
Returns the asimuthal part of a spherical harmonic.
Definition: normalisation.h:159
static complex double qpms_normalisation_factor_L_noCS(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a longitudinal basis VSWF of a given convention compared to the reference conv...
Definition: normalisation.h:98
static complex double qpms_normalisation_factor_N_noCS(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a electric basis VSWF of a given convention compared to the reference conventi...
Definition: normalisation.h:65
static complex double qpms_normalisation_factor_M_noCS(qpms_normalisation_t norm, qpms_l_t l, qpms_m_t m)
Returns the factors of a magnetic basis VSWF of a given convention compared to the reference conventi...
Definition: normalisation.h:39
static qpms_normalisation_t qpms_normalisation_dual(qpms_normalisation_t norm)
Returns normalisation flags corresponding to the dual spherical harmonics / waves.
Definition: normalisation.h:140
Macros for compiler optimisation.
QPMS miscellanous internal error handling functions and macros.
#define QPMS_WTF
Prints an "unexpected error" message and aborts the program.
Definition: qpms_error.h:181
static int qpms_normalisation_t_csphase(qpms_normalisation_t norm)
Determine whether the convention includes Condon-Shortley phase (-1) or not (+1).
Definition: qpms_types.h:171
qpms_normalisation_t
Vector spherical wavefuction normalisation and phase convention codes.
Definition: qpms_types.h:104
@ QPMS_NORMALISATION_NORM_POWER
The VSWFs shall be power-normalised. This is the "default".
Definition: qpms_types.h:140
@ QPMS_NORMALISATION_INVERSE
Flag indicating that qpms_normalisition_factor_* should actually return values inverse to the default...
Definition: qpms_types.h:107
@ QPMS_NORMALISATION_SPHARM_REAL
Flag indicating use of the real spherical harmonics.
Definition: qpms_types.h:116
@ QPMS_NORMALISATION_L_MINUS
Include an additional -factor into the longitudinal waves.
Definition: qpms_types.h:130
@ QPMS_NORMALISATION_M_I
Include an additional i -factor into the magnetic waves.
Definition: qpms_types.h:125
@ QPMS_NORMALISATION_M_MINUS
Include an additional -factor into the magnetic waves.
Definition: qpms_types.h:126
@ QPMS_NORMALISATION_L_I
Include an additional i -factor into the longitudinal waves.
Definition: qpms_types.h:129
@ QPMS_NORMALISATION_N_MINUS
Include an additional -factor into the magnetic waves.
Definition: qpms_types.h:128
@ QPMS_NORMALISATION_N_I
Include an additional i -factor into the electric waves.
Definition: qpms_types.h:127
@ QPMS_NORMALISATION_REVERSE_AZIMUTHAL_PHASE
Definition: qpms_types.h:111
@ QPMS_NORMALISATION_DEFAULT
Default VSWF convention. We might encourage the compiler to expect this one.
Definition: qpms_types.h:167
@ QPMS_NORMALISATION_CSPHASE
Flag indicating usage of Condon-Shortley phase.
Definition: qpms_types.h:124
@ QPMS_NORMALISATION_NORM_SPHARM
The VSWFs shall be normalised as in .
Definition: qpms_types.h:143
@ QPMS_NORMALISATION_NORM_NONE
The VSWFs shall be created using spherical harmonics without any normalisation. Do not use.
Definition: qpms_types.h:152
int qpms_l_t
Type for spherical harmonic degree l.
Definition: qpms_types.h:27
qpms_vswf_type_t
Codes of the VSWF types (electric/N, magnetic/M, longitudinal/L).
Definition: qpms_types.h:62
@ QPMS_VSWF_ELECTRIC
"Electric" (N -type) transversal wave.
Definition: qpms_types.h:63
@ QPMS_VSWF_LONGITUDINAL
Longitudinal (L -type) wave (not relevant for radiation).
Definition: qpms_types.h:65
@ QPMS_VSWF_MAGNETIC
"Magnetic" (M -type) transversal wave.
Definition: qpms_types.h:64
unsigned long long qpms_uvswfi_t
Exhaustive index type for VSWF basis functions.
Definition: qpms_types.h:81
qpms_lm_t qpms_m_t
Type for spherical harmonic order m.
Definition: qpms_types.h:31
A VSWF representation element of the qpms_l_t l
< The O(3) element in the quaternion representation.
Definition: quaternions.h:214