Merge branch 'beyn_pureblas'
[qpms.git] / qpms / gaunt.h
blob425c660febd1698018d571dc9bca49095b6d462a
1 /*! \file gaunt.h
2 * \brief Gaunt coefficients (integrals over three spherical harmonics).
3 */
4 #ifndef GAUNT_H
5 #define GAUNT_H
6 #include <stdlib.h>
8 #define _GAUNT_H_MIN(x,y) (((x) > (y)) ? (y) : (x))
9 static inline int gaunt_q_max(int m, int n, int mu, int nu) {
10 return _GAUNT_H_MIN(n, _GAUNT_H_MIN(nu, (n+nu-abs(m+mu))/2));
12 #undef _GAUNT_H_MIN
14 void gaunt_xu(int m, int n, int mu, int nu, int qmax, double *v_aq, int *err);
15 //int gaunt(int m, int n, int mu, int nu, double *v_aq);
18 #ifdef GAUNT_PRECOMPILED
19 extern const double gaunt_table[];
20 extern const int gaunt_table_lMax;
22 // Returns given gaunt coeff. If not in range, return nan
23 // TODO distinguish between invalid input and limitations given by gaunt_table_lMax
24 double gaunt_table_retrieve_single(int m, int n, int mu, int nu, int q);
26 // returns pointer to the memory where gaunt(m, n, mu, nu, q=0) is placed
27 // returns NULL if invalid input or exceeding gaunt_table_lMax
28 double const * gaunt_table_retrieve_allq(int m, int n, int mu, int nu);
30 int gaunt_table_or_xu_fill(double *target, int m, int n, int mu, int nu);
31 #endif //GAUNT_PRECOMPILED
33 #endif //GAUNT_H