1use pyo3::prelude::*;
2
3#[cfg(not(feature = "mpi"))]
4use pyo3::exceptions::PyModuleNotFoundError;
5
6#[pymodule]
7mod laddu {
8 use super::*;
9 #[pyfunction]
10 fn version() -> String {
11 env!("CARGO_PKG_VERSION").to_string()
12 }
13
14 #[cfg(feature = "mpi")]
15 #[pymodule_export]
16 use laddu_python::mpi::finalize_mpi;
17 #[cfg(not(feature = "mpi"))]
18 #[pyfunction]
19 fn finalize_mpi() -> PyResult<()> {
20 Err(PyModuleNotFoundError::new_err(
21 "`laddu` was not compiled with MPI support!",
22 ))
23 }
24 #[cfg(feature = "mpi")]
25 #[pymodule_export]
26 use laddu_python::mpi::get_rank;
27 #[cfg(not(feature = "mpi"))]
28 #[pyfunction]
29 fn get_rank() -> PyResult<usize> {
30 Err(PyModuleNotFoundError::new_err(
31 "`laddu` was not compiled with MPI support!",
32 ))
33 }
34 #[cfg(feature = "mpi")]
35 #[pymodule_export]
36 use laddu_python::mpi::get_size;
37 #[cfg(not(feature = "mpi"))]
38 #[pyfunction]
39 fn get_size() -> PyResult<usize> {
40 Err(PyModuleNotFoundError::new_err(
41 "`laddu` was not compiled with MPI support!",
42 ))
43 }
44 #[cfg(feature = "mpi")]
45 #[pymodule_export]
46 use laddu_python::mpi::is_root;
47 #[cfg(not(feature = "mpi"))]
48 #[pyfunction]
49 fn is_root() -> PyResult<bool> {
50 Err(PyModuleNotFoundError::new_err(
51 "`laddu` was not compiled with MPI support!",
52 ))
53 }
54 #[cfg(feature = "mpi")]
55 #[pymodule_export]
56 use laddu_python::mpi::use_mpi;
57 #[cfg(not(feature = "mpi"))]
58 #[pyfunction]
59 #[pyo3(signature = (*, trigger=true))]
60 #[allow(unused_variables)]
61 fn use_mpi(trigger: bool) -> PyResult<()> {
62 Err(PyModuleNotFoundError::new_err(
63 "`laddu` was not compiled with MPI support!",
64 ))
65 }
66 #[cfg(feature = "mpi")]
67 #[pymodule_export]
68 use laddu_python::mpi::using_mpi;
69 #[cfg(not(feature = "mpi"))]
70 #[pyfunction]
71 fn using_mpi() -> PyResult<bool> {
72 Err(PyModuleNotFoundError::new_err(
73 "`laddu` was not compiled with MPI support!",
74 ))
75 }
76
77 #[pymodule_export]
78 use laddu_python::utils::vectors::PyVector3;
79 #[pymodule_export]
80 use laddu_python::utils::vectors::PyVector4;
81
82 #[pymodule_export]
83 use laddu_python::utils::variables::PyAngles;
84 #[pymodule_export]
85 use laddu_python::utils::variables::PyCosTheta;
86 #[pymodule_export]
87 use laddu_python::utils::variables::PyMandelstam;
88 #[pymodule_export]
89 use laddu_python::utils::variables::PyMass;
90 #[pymodule_export]
91 use laddu_python::utils::variables::PyPhi;
92 #[pymodule_export]
93 use laddu_python::utils::variables::PyPolAngle;
94 #[pymodule_export]
95 use laddu_python::utils::variables::PyPolMagnitude;
96 #[pymodule_export]
97 use laddu_python::utils::variables::PyPolarization;
98
99 #[pymodule_export]
100 use laddu_python::data::py_open;
101 #[pymodule_export]
102 use laddu_python::data::PyBinnedDataset;
103 #[pymodule_export]
104 use laddu_python::data::PyDataset;
105 #[pymodule_export]
106 use laddu_python::data::PyEvent;
107
108 #[pymodule_export]
109 use laddu_python::amplitudes::py_constant;
110 #[pymodule_export]
111 use laddu_python::amplitudes::py_parameter;
112 #[pymodule_export]
113 use laddu_python::amplitudes::PyAmplitude;
114 #[pymodule_export]
115 use laddu_python::amplitudes::PyAmplitudeID;
116 #[pymodule_export]
117 use laddu_python::amplitudes::PyEvaluator;
118 #[pymodule_export]
119 use laddu_python::amplitudes::PyExpression;
120 #[pymodule_export]
121 use laddu_python::amplitudes::PyManager;
122 #[pymodule_export]
123 use laddu_python::amplitudes::PyModel;
124 #[pymodule_export]
125 use laddu_python::amplitudes::PyParameterLike;
126
127 #[pymodule_export]
128 use laddu_amplitudes::common::py_complex_scalar;
129 #[pymodule_export]
130 use laddu_amplitudes::common::py_polar_complex_scalar;
131 #[pymodule_export]
132 use laddu_amplitudes::common::py_scalar;
133
134 #[pymodule_export]
135 use laddu_amplitudes::piecewise::py_piecewise_complex_scalar;
136 #[pymodule_export]
137 use laddu_amplitudes::piecewise::py_piecewise_polar_complex_scalar;
138 #[pymodule_export]
139 use laddu_amplitudes::piecewise::py_piecewise_scalar;
140
141 #[pymodule_export]
142 use laddu_amplitudes::breit_wigner::py_breit_wigner;
143
144 #[pymodule_export]
145 use laddu_amplitudes::ylm::py_ylm;
146
147 #[pymodule_export]
148 use laddu_amplitudes::zlm::py_zlm;
149
150 #[pymodule_export]
151 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_a0;
152 #[pymodule_export]
153 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_a2;
154 #[pymodule_export]
155 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_f0;
156 #[pymodule_export]
157 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_f2;
158 #[pymodule_export]
159 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_pi1;
160 #[pymodule_export]
161 use laddu_amplitudes::kmatrix::py_kopf_kmatrix_rho;
162
163 #[pymodule_export]
164 use laddu_extensions::likelihoods::py_likelihood_scalar;
165 #[pymodule_export]
166 use laddu_extensions::likelihoods::PyLikelihoodEvaluator;
167 #[pymodule_export]
168 use laddu_extensions::likelihoods::PyLikelihoodExpression;
169 #[pymodule_export]
170 use laddu_extensions::likelihoods::PyLikelihoodID;
171 #[pymodule_export]
172 use laddu_extensions::likelihoods::PyLikelihoodManager;
173 #[pymodule_export]
174 use laddu_extensions::likelihoods::PyLikelihoodTerm;
175 #[pymodule_export]
176 use laddu_extensions::likelihoods::PyNLL;
177
178 #[pymodule_export]
179 use laddu_extensions::ganesh_ext::py_ganesh::py_integrated_autocorrelation_times;
180 #[pymodule_export]
181 use laddu_extensions::ganesh_ext::py_ganesh::PyAutocorrelationObserver;
182 #[pymodule_export]
183 use laddu_extensions::ganesh_ext::py_ganesh::PyBound;
184 #[pymodule_export]
185 use laddu_extensions::ganesh_ext::py_ganesh::PyEnsemble;
186 #[pymodule_export]
187 use laddu_extensions::ganesh_ext::py_ganesh::PyMCMCObserver;
188 #[pymodule_export]
189 use laddu_extensions::ganesh_ext::py_ganesh::PyObserver;
190 #[pymodule_export]
191 use laddu_extensions::ganesh_ext::py_ganesh::PyStatus;
192
193 #[pymodule_export]
194 use laddu_extensions::experimental::py_binned_guide_term;
195}