9#ifndef wigner_functions_h
10#define wigner_functions_h
14#include <wigner/wigxjpf/inc/wigxjpf.h>
19#ifdef FAST_WIGNER_PATH_3J
20#define DO_FAST_WIGNER 1
21#include <wigner/fastwigxj/inc/fastwigxj.h>
23#define DO_FAST_WIGNER 0
33std::pair<Rational, Rational>
wigner_limits(std::pair<Rational, Rational>
a, std::pair<Rational, Rational>
b);
79template<Index pos>
constexpr
81 [[maybe_unused]]
const Rational
b=0,
82 [[maybe_unused]]
const Rational
c=0,
83 [[maybe_unused]]
const Rational
d=0,
84 [[maybe_unused]]
const Rational e=0) {
85 static_assert(pos < 7 and pos > 0,
"Only valid for pos := 1, 2, 3, 4, 5, and 6");
87 if constexpr (pos == 1 or pos == 2) {
88 const Rational maxX =
b -
a;
89 std::pair<Rational, Rational> out {-maxX,
a +
b};
90 if (out.first > out.second) swap(out.first, out.second);
91 if (out.second > maxX) out.second = maxX;
92 if (out.first > maxX) out = {RATIONAL_UNDEFINED, RATIONAL_UNDEFINED};
94 }
else if constexpr (pos == 3) {
95 const Rational maxX =
a +
b;
96 const Rational minX = abs(
a -
b);
97 if (maxX >= minX)
return {minX, maxX};
98 return {RATIONAL_UNDEFINED, RATIONAL_UNDEFINED};
100 const Rational lim = pos == 4 ? abs(
a) :
103 const Rational val = - e -
d;
104 if (-lim <= val and val <= lim)
return {val, val};
105 return {RATIONAL_UNDEFINED, RATIONAL_UNDEFINED};
196template <
class ... Integer>
constexpr
198 constexpr auto N =
sizeof...(Integer);
199 static_assert(N > 0);
200 const std::array<int, N>
v{int(vals)...};
201 return 1 + 2 * (*std::max_element(
v.begin(),
v.end()));
218Numeric
dwigner3j(Index M, Index J1, Index J2, Index J);
235Numeric
dwigner6j(Index A, Index B, Index C, Index D, Index F);
constexpr std::pair< Rational, Rational > wigner3j_limits(const Rational a=0, const Rational b=0, const Rational c=0, const Rational d=0, const Rational e=0)
bool is_wigner_ready(int j)
Tells if the function can deal with the input integer.
Numeric dwigner6j(Index A, Index B, Index C, Index D, Index F)
Computes the wigner 6J symbol with floating point precision.
Numeric wigner6j(const Rational j1, const Rational j2, const Rational j3, const Rational l1, const Rational l2, const Rational l3)
Wigner 6J symbol.
bool is_wigner3_ready(const Rational &J)
Tells if the function is ready for Wigner 3J calculations.
Index make_wigner_ready(int largest, int fastest, int size)
Ready Wigner.
Numeric dwigner3j(Index M, Index J1, Index J2, Index J)
Computes the wigner 3J symbol with floating point precision.
constexpr int temp_init_size(Integer... vals) noexcept
bool is_wigner6_ready(const Rational &J)
Tells if the function is ready for Wigner 6J calculations.
Numeric wigner3j(const Rational j1, const Rational j2, const Rational j3, const Rational m1, const Rational m2, const Rational m3)
Wigner 3J symbol.
std::pair< Rational, Rational > wigner_limits(std::pair< Rational, Rational > a, std::pair< Rational, Rational > b)