Library version 0.1 · Package overview
All functions below are exported by main.flatppl. Arguments are positional or named in the listed order.
Four-vectors are real arrays [E, px, py, pz], with energy first and metric signature (+,-,-,-).
Natural units use
| Function | Arguments | Description | Domains |
|---|---|---|---|
clebschgordan |
j1, m1, j2, m2, j, m
|
Integer-spin Clebsch–Gordan coefficient | nonnegative integer spins, integer projections |
clebschgordan_doublearg |
two_j1, two_m1, two_j2, two_m2, two_j, two_m
|
Clebsch–Gordan coefficient with doubled quantum numbers | nonnegative integer doubled spins, integer doubled projections |
ls_coupling |
two_j, two_j1, two_j2, two_l, two_s, two_lambda1, two_lambda2
|
LS-to-helicity coupling | doubled spins and helicities; nonnegative even two_l
|
wignerd_matrix |
j, cosbeta
|
Integer-spin Wigner small |
nonnegative integers, interval(-1, 1)
|
wignerd_matrix_doublearg |
two_j, cosbeta
|
Wigner small |
nonnegative integers, interval(-1, 1)
|
twobody_phasespace |
sigma, ma, mb
|
Analytically continued two-body phase-space factor |
posreals, nonnegreals, nonnegreals
|
resonance_multichannel_breitwigner |
sigma, m, gsq, mas, mbs, ls, ds
|
Coupled-channel resonance amplitude | positive invariant mass squared and pole mass; aligned channel vectors |
resonance_bugg_breitwigner |
sigma, m, width, sa, gamma
|
Simplified Adler-zero resonance amplitude | positive sigma, m, width; real sa, gamma; sa != m^2
|
mass_squared |
p |
Minkowski norm squared | real four-vectors |
boost_to_rest |
p, P
|
Boost into the rest frame of P
|
real four-vectors; future-timelike P
|
boost_from_rest |
p, P
|
Inverse rest-frame boost | real four-vectors; future-timelike P
|
helicity_frame |
p, P, child
|
Four-vector in a helicity frame | real four-vectors; future-timelike P; child in {1, 2}
|
helicity_angles |
p, P, child
|
Polar cosine and azimuth in a helicity frame | helicity-frame domain; nonzero transformed spatial momentum |
dalitz_cos_theta |
k, sigmas, m0, ms
|
Isobar helicity-angle cosine |
k in {1, 2, 3}; physical three-body decay |
dalitz_cos_zeta |
i, k, l, sigmas, m0, ms
|
Inter-chain Wigner-angle cosine |
i in {0, 1, 2, 3}; chain indices in {1, 2, 3}; physical three-body decay |
Defined in src/angular.flatppl. Angular momenta are measured in units of
clebschgordan(j1, m1, j2, m2, j, m) — the real Clebsch–Gordan coefficient in the Condon–Shortley convention:
Arguments:
j1,j2,j: nonnegative integer angular momenta.m1,m2,m: integer magnetic projections.
Returns zero unless clebschgordan_doublearg with every argument multiplied by two.
clebschgordan_doublearg(two_j1, two_m1, two_j2, two_m2, two_j, two_m) — the same coefficient for integer or half-integer spins, with each quantum number passed as its doubled integer value.
Arguments:
-
two_j1,two_j2,two_j: nonnegative integers representing$2j_1$ ,$2j_2$ ,$2j$ . -
two_m1,two_m2,two_m: integers representing$2m_1$ ,$2m_2$ ,$2m$ .
Returns zero for forbidden projections, triangle couplings, or parity combinations.
In addition to the preceding selection rules,
ls_coupling(two_j, two_j1, two_j2, two_l, two_s, two_lambda1, two_lambda2) — the real LS-to-helicity coupling for a parent of spin
Arguments:
-
two_j,two_j1,two_j2,two_s: nonnegative doubled integer spins$2J,2j_1,2j_2,2S$ . -
two_l: nonnegative even integer$2L$ , where$L$ is orbital angular momentum. -
two_lambda1,two_lambda2: doubled integer daughter helicities.
The Clebsch–Gordan selection rules apply to both factors. Additional decay-chain phase factors are not included.
wignerd_matrix(j, cosbeta) — returns the real
Arguments:
j: nonnegative integer spin.cosbeta: real polar-angle cosine ininterval(-1, 1).
Rows and columns descend from wignerd_matrix_doublearg with two_j = 2*j.
Derivatives with respect to cosbeta are intended for the interior
wignerd_matrix_doublearg(two_j, cosbeta) — returns the small Wigner matrix for spin
Arguments:
-
two_j: nonnegative integer doubled spin$2j$ . -
cosbeta: real polar-angle cosine ininterval(-1, 1).
The result has shape (two_j + 1, two_j + 1) and the ordering and rotation convention above.
For spin
Defined in src/lineshapes.flatppl. Write
twobody_phasespace(sigma, ma, mb) — returns the complex dimensionless two-body phase-space factor
Arguments:
sigma: positive invariant mass squared, in energy squared.ma,mb: nonnegative daughter masses.
Each square root continues from the upper half-plane:
resonance_multichannel_breitwigner(sigma, m, gsq, mas, mbs, ls, ds) — returns the coupled-channel amplitude
Arguments:
-
sigma,m: positive invariant mass squared and positive pole mass. -
gsq: real vector of signed squared-coupling parameters$g_a^2$ , in energy squared; its notation does not require nonnegative entries. -
mas,mbs: nonnegative daughter-mass vectors$m_{a1},m_{a2}$ . -
ls: integer orbital-momentum vector, with each entry between zero and seven. -
ds: nonnegative barrier-radius vector, in inverse energy.
All channel vectors have the same nonzero length. The factor particle-physics convention in the kinematics catalogue.
The result has units of inverse energy squared. Points where a barrier polynomial or the full amplitude denominator vanishes are excluded.
Two S-wave channels give the Flatté form in this coupling convention. Closed channels use twobody_phasespace's continuation.
resonance_bugg_breitwigner(sigma, m, width, sa, gamma) — returns the simplified LHCb Adler-zero amplitude
Arguments:
-
sigma: positive invariant mass squared. -
m,width: positive pole mass and width$\Gamma$ . -
sa: real Adler-zero parameter$s_A$ , in energy squared, with$s_A\neq m^2$ . -
gamma: real exponential coefficient, in inverse energy squared; nonnegative values give damping.
The result is complex with units of inverse energy squared. Its denominator must be nonzero. This is the simplified form used in the reference LHCb model, not the full Bugg parameterization.
Defined in src/kinematics.flatppl.
For a frame momentum
mass_squared(p) — returns the real Minkowski norm squared
p is a real four-vector. The result has units of energy squared and may be negative for a spacelike vector.
boost_to_rest(p, P) — returns the four-vector
Arguments:
p: real four-vector to transform.P: future-timelike real frame four-vector.
The result has four real components in the same energy unit. It maps
boost_from_rest(p, P) — returns the inverse of boost_to_rest, with components
Arguments:
p: real four-vector in the rest frame ofP.P: future-timelike real frame four-vector.
The result has four real components. Both boosts preserve mass_squared.
helicity_frame(p, P, child) — returns p in the helicity frame defined by P and the daughter convention child.
Arguments:
p: real four-vector to transform.P: future-timelike real frame four-vector.child: integer one or two, selecting the first- or second-child convention.
Let
where
helicity_angles(p, P, child) — returns the polar cosine and azimuth of helicity_frame(p, P, child).
Arguments are those of helicity_frame, with nonzero transformed spatial momentum record(costheta = qz/|q|, phi = atan2(qy, qx)), where costheta lies in phi is in radians.
No angle is defined when
Defined in src/dalitz.flatppl. Let
sigmas = [s1, s2, s3] and ms = [m1, m2, m3] describe a physical three-body decay, with
dalitz_cos_theta(k, sigmas, m0, ms) — returns the isobar helicity-angle cosine
Arguments:
k: chain index one, two, or three.sigmas: three invariant masses squared, in the order above.m0: positive parent mass.ms: three nonnegative daughter masses.
For the cyclic ordering
The result is real and dimensionless, with the boundary convention above.
dalitz_cos_zeta(i, k, l, sigmas, m0, ms) — returns the cosine of the Wigner rotation for particle i between chains k and l.
Arguments:
i: particle index zero through three; zero denotes the parent.k,l: chain indices one through three.sigmas,m0,ms: the physical three-body inputs defined above.
For equal chains, the result is one. For distinct chains, let
For a massive daughter that is the spectator of chain
The case
For a massless daughter, the result is one by convention. All results are real and dimensionless, with the boundary convention above.
examples/lambda1405.flatppl exposes an invariant-mass input and the Lambda(1405) intensity output.
From the repository root, compile it with the Rust CLI:
flatppl stablehlo examples/lambda1405.flatppl --dtype f64 -o example.mlirThe numerical tests use an existing environment with NumPy and SymPy, plus Node and the JS engine checkout:
python tests/test_library.pyThey check CG coefficients against SymPy, Wigner group laws, complex threshold branches,
all eight barrier polynomials, boosts, both child frames, and Dalitz angles against explicit four-vector geometry.
Set FLATPPL_JS_DIR if the JS checkout is not the neighboring flatppl-js directory.
An existing JAX/Enzyme-JAX environment can also execute the library's compiled test query:
python tests/run_compiled.py --output compiled-results.jsonThis tests the normal import facade, gradients, and vmap in both precisions on the selected JAX device.
FLATPPL_CLI selects another compiler. --modules DIR reuses prepared MLIR and expected values on another host.
The frame convention and LHCb formulas follow the
hand-written models and converter.
The reference repository's license notice is preserved in THIRD-PARTY-NOTICES.txt.
The library uses the MIT license, as do the reference models. See LICENSE.
The Dalitz formulas are Eqs. 20, 22, 26, and 29 of Mikhasenko et al., PRD 101 (2020) 034033. The simplified Bugg form follows LHCb, PRD 108 (2023) 012023.
With the Rust CLI, run flatppl prepare model.flatppl and approve the URL before
compiling a model that imports it. The source ZIP contains main.flatppl inside
GitHub's repository folder. A local checkout also loads with
load_module("path/to/flatppl-amplitudes") or load_module("main.flatppl")
from a file in that checkout.
A source ZIP can be loaded with load_module("https://github.com/flatppl-community/flatppl-amplitudes/archive/ea0f502ee4f67feb3a28e3fbdd7413f0d1a5408a.zip"). The URL pins a source commit. VERSION records the library version; it does not imply a published release.
GitHub's redirect and CORS policy currently prevent direct archive imports in
the web playground.
Each helper module in src/ can also be loaded directly.
The live example fits the Lambda(1405) pole mass using five synthetic intensity measurements.
It fixes the two channel couplings and uses a uniform prior on [1.39,1.42] GeV.
The likelihood has independent Gaussian errors with standard deviation 5.0 in intensity units.
It scores measured intensities, so no lineshape-normalization integral is required.
The two-channel evaluation also includes the closed-channel continuation below the proton–kaon threshold.
FLATPPL_JS_DIR=/path/to/flatppl-js python tests/test_playground.pyThe posterior test uses independent complex arithmetic and checks three parameter points.