88#include < stdexcept>
99
1010#include " ext_interface/persistence_algebra_interface.hpp"
11+
12+ #if !MULTIPERS_DISABLE_PERSISTENCE_ALGEBRA_INTERFACE
1113#include " ext_interface/nanobind_registry_runtime.hpp"
14+ #endif
1215
1316namespace nb = nanobind;
1417using namespace nb ::literals;
1518
1619namespace mppai {
1720
21+ #if !MULTIPERS_DISABLE_PERSISTENCE_ALGEBRA_INTERFACE
22+
1823using CanonicalWrapper = multipers::nanobind_helpers::canonical_contiguous_f64_slicer_wrapper;
1924
2025inline multipers::packed_morphism_columns packed_columns (
@@ -80,6 +85,8 @@ inline nb::object algebra_operation_for_target(nb::object source,
8085 throw std::invalid_argument (" Unknown Persistence-Algebra operation." );
8186}
8287
88+ #endif
89+
8390} // namespace mppai
8491
8592NB_MODULE (_persistence_algebra_interface, m) {
@@ -188,6 +195,15 @@ NB_MODULE(_persistence_algebra_interface, m) {
188195 nb::ndarray<nb::numpy, const std::uint64_t , nb::ndim<1 >, nb::c_contig> column_indptr,
189196 nb::ndarray<nb::numpy, const std::uint32_t , nb::ndim<1 >, nb::c_contig> row_indices,
190197 int degree) {
198+ #if MULTIPERS_DISABLE_PERSISTENCE_ALGEBRA_INTERFACE
199+ (void )op;
200+ (void )source;
201+ (void )target;
202+ (void )column_indptr;
203+ (void )row_indices;
204+ (void )degree;
205+ throw std::runtime_error (" Persistence-Algebra interface is disabled at compile time." );
206+ #else
191207 auto columns = mppai::packed_columns (column_indptr, row_indices);
192208 if (!multipers::persistence_algebra_interface_available ()) {
193209 throw std::runtime_error (" Persistence-Algebra interface is not available." );
@@ -203,6 +219,7 @@ NB_MODULE(_persistence_algebra_interface, m) {
203219 return out;
204220 }
205221 return multipers::nanobind_helpers::astype_slicer_to_original_type (owner, out);
222+ #endif
206223 },
207224 " op" _a,
208225 " source" _a,
@@ -217,6 +234,12 @@ NB_MODULE(_persistence_algebra_interface, m) {
217234 (void )use_clearing;
218235 (void )use_chunk;
219236 (void )verbose;
237+ #if MULTIPERS_DISABLE_PERSISTENCE_ALGEBRA_INTERFACE
238+ (void )slicer;
239+ (void )degree;
240+ (void )full_resolution;
241+ throw std::runtime_error (" Persistence-Algebra interface is disabled at compile time." );
242+ #else
220243 if (!multipers::persistence_algebra_interface_available ()) {
221244 throw std::runtime_error (" Persistence-Algebra interface is not available." );
222245 }
@@ -226,6 +249,7 @@ NB_MODULE(_persistence_algebra_interface, m) {
226249 return out;
227250 }
228251 return multipers::nanobind_helpers::astype_slicer_to_original_type (slicer, out);
252+ #endif
229253 },
230254 " slicer" _a,
231255 " degree" _a,
@@ -237,6 +261,11 @@ NB_MODULE(_persistence_algebra_interface, m) {
237261 m.def (
238262 " death_curve_presentation" ,
239263 [](nb::object slicer, int degree) {
264+ #if MULTIPERS_DISABLE_PERSISTENCE_ALGEBRA_INTERFACE
265+ (void )slicer;
266+ (void )degree;
267+ throw std::runtime_error (" Persistence-Algebra interface is disabled at compile time." );
268+ #else
240269 if (!multipers::persistence_algebra_interface_available ()) {
241270 throw std::runtime_error (" Persistence-Algebra interface is not available." );
242271 }
@@ -249,6 +278,7 @@ NB_MODULE(_persistence_algebra_interface, m) {
249278 return out;
250279 }
251280 return multipers::nanobind_helpers::astype_slicer_to_original_type (slicer, out);
281+ #endif
252282 },
253283 " slicer" _a,
254284 " degree" _a);
0 commit comments