From 0d70a475718fa49232692c7b1c6fd12c5904af01 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 15 May 2025 18:11:29 -0400 Subject: [PATCH] wrap mt19937_64 --- python/gtsam/specializations/gtsam.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/gtsam/specializations/gtsam.h b/python/gtsam/specializations/gtsam.h index da8842eaf..d15a8fa11 100644 --- a/python/gtsam/specializations/gtsam.h +++ b/python/gtsam/specializations/gtsam.h @@ -10,3 +10,15 @@ * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, * and saves one copy operation. */ + +/* + * Custom Pybind11 module for the Mersenne-Twister PRNG object + * `std::mt19937_64`. + * This can be invoked with `gtsam.MT19937()` and passed + * wherever a rng pointer is expected. + */ +#include +py::class_(m_, "MT19937") + .def(py::init<>()) + .def(py::init()) + .def("__call__", &std::mt19937_64::operator());