ARTS 2.5.11 (git: 725533f0)
wigner_functions.h
Go to the documentation of this file.
1
9#ifndef wigner_functions_h
10#define wigner_functions_h
11
12#include "rational.h"
13
14#include <wigner/wigxjpf/inc/wigxjpf.h>
15
16#include <algorithm>
17#include <array>
18
19#ifdef FAST_WIGNER_PATH_3J
20#define DO_FAST_WIGNER 1
21#include <wigner/fastwigxj/inc/fastwigxj.h>
22#else
23#define DO_FAST_WIGNER 0
24#endif
25
26
33std::pair<Rational, Rational> wigner_limits(std::pair<Rational, Rational> a, std::pair<Rational, Rational> b);
34
79template<Index pos> constexpr
80std::pair<Rational, Rational> wigner3j_limits([[maybe_unused]] const Rational a=0,
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");
86
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};
93 return out;
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};
99 } else {
100 const Rational lim = pos == 4 ? abs(a) :
101 pos == 5 ? abs(b) :
102 /*pos == 6*/ abs(c);
103 const Rational val = - e - d;
104 if (-lim <= val and val <= lim) return {val, val};
105 return {RATIONAL_UNDEFINED, RATIONAL_UNDEFINED};
106 }
107}
108
129Numeric wigner3j(const Rational j1,
130 const Rational j2,
131 const Rational j3,
132 const Rational m1,
133 const Rational m2,
134 const Rational m3);
135
156Numeric wigner6j(const Rational j1,
157 const Rational j2,
158 const Rational j3,
159 const Rational l1,
160 const Rational l2,
161 const Rational l3);
162
170Index make_wigner_ready(int largest, int fastest, int size);
171
179
187
195
196template <class ... Integer> constexpr
197int temp_init_size(Integer... vals) noexcept {
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()));
202}
203
218Numeric dwigner3j(Index M, Index J1, Index J2, Index J);
219
235Numeric dwigner6j(Index A, Index B, Index C, Index D, Index F);
236
237#endif // wigner_functions_h
#define d
#define v
#define a
#define c
#define b
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)
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.