@@ -29,6 +29,12 @@ struct declare_integral_distributions {
2929 nb::call_guard<nb::gil_scoped_release>())
3030 .def (" p" , &std::geometric_distribution<ResultType>::p,
3131 nb::call_guard<nb::gil_scoped_release>())
32+ .def (" __copy__" , [](const std::geometric_distribution<ResultType>& self) {
33+ return std::geometric_distribution<ResultType>(self);
34+ }).def (" __deepcopy__" , [](
35+ const std::geometric_distribution<ResultType>& self, nb::dict) {
36+ return std::geometric_distribution<ResultType>(self);
37+ }, " memo" _a)
3238 .def (" __repr__" , [](const std::geometric_distribution<ResultType>& a) {
3339 return fmt::format (" {}" , a);
3440 }).def_static (" __class_repr__" , []() {
@@ -49,6 +55,12 @@ struct declare_integral_distributions {
4955 delta.def (nb::init<ResultType>(), " mean" _a)
5056 .def (" mean" , &reticula::delta_distribution<ResultType>::mean,
5157 nb::call_guard<nb::gil_scoped_release>())
58+ .def (" __copy__" , [](const reticula::delta_distribution<ResultType>& self) {
59+ return reticula::delta_distribution<ResultType>(self);
60+ }).def (" __deepcopy__" , [](
61+ const reticula::delta_distribution<ResultType>& self, nb::dict) {
62+ return reticula::delta_distribution<ResultType>(self);
63+ }, " memo" _a)
5264 .def (" __repr__" , [](
5365 const reticula::delta_distribution<ResultType>& a) {
5466 return fmt::format (" {}" , a);
@@ -72,6 +84,12 @@ struct declare_integral_distributions {
7284 nb::call_guard<nb::gil_scoped_release>())
7385 .def (" b" , &std::uniform_int_distribution<ResultType>::b,
7486 nb::call_guard<nb::gil_scoped_release>())
87+ .def (" __copy__" , [](const std::uniform_int_distribution<ResultType>& self) {
88+ return std::uniform_int_distribution<ResultType>(self);
89+ }).def (" __deepcopy__" , [](
90+ const std::uniform_int_distribution<ResultType>& self, nb::dict) {
91+ return std::uniform_int_distribution<ResultType>(self);
92+ }, " memo" _a)
7593 .def (" __repr__" , [](
7694 const std::uniform_int_distribution<ResultType>& a) {
7795 return fmt::format (" {}" , a);
@@ -98,6 +116,12 @@ struct declare_floating_point_distributions {
98116 nb::call_guard<nb::gil_scoped_release>())
99117 .def (" lmbda" , &std::exponential_distribution<ResultType>::lambda,
100118 nb::call_guard<nb::gil_scoped_release>())
119+ .def (" __copy__" , [](const std::exponential_distribution<ResultType>& self) {
120+ return std::exponential_distribution<ResultType>(self);
121+ }).def (" __deepcopy__" , [](
122+ const std::exponential_distribution<ResultType>& self, nb::dict) {
123+ return std::exponential_distribution<ResultType>(self);
124+ }, " memo" _a)
101125 .def (" __repr__" , [](
102126 const std::exponential_distribution<ResultType>& a) {
103127 return fmt::format (" {}" , a);
@@ -124,6 +148,14 @@ struct declare_floating_point_distributions {
124148 .def (" mean" ,
125149 &reticula::power_law_with_specified_mean<ResultType>::mean,
126150 nb::call_guard<nb::gil_scoped_release>())
151+ .def (" __copy__" , [](
152+ const reticula::power_law_with_specified_mean<ResultType>& self) {
153+ return reticula::power_law_with_specified_mean<ResultType>(self);
154+ }).def (" __deepcopy__" , [](
155+ const reticula::power_law_with_specified_mean<ResultType>& self,
156+ nb::dict) {
157+ return reticula::power_law_with_specified_mean<ResultType>(self);
158+ }, " memo" _a)
127159 .def (" __repr__" , [](
128160 const reticula::power_law_with_specified_mean<ResultType>& a) {
129161 return fmt::format (" {}" , a);
@@ -153,6 +185,14 @@ struct declare_floating_point_distributions {
153185 .def (" mean" ,
154186 &reticula::residual_power_law_with_specified_mean<ResultType>::mean,
155187 nb::call_guard<nb::gil_scoped_release>())
188+ .def (" __copy__" , [](
189+ const reticula::residual_power_law_with_specified_mean<ResultType>& self) {
190+ return reticula::residual_power_law_with_specified_mean<ResultType>(self);
191+ }).def (" __deepcopy__" , [](
192+ const reticula::residual_power_law_with_specified_mean<ResultType>& self,
193+ nb::dict) {
194+ return reticula::residual_power_law_with_specified_mean<ResultType>(self);
195+ }, " memo" _a)
156196 .def (" __repr__" , [](
157197 const reticula::residual_power_law_with_specified_mean<
158198 ResultType>& a) {
@@ -188,6 +228,14 @@ struct declare_floating_point_distributions {
188228 .def (" phi" ,
189229 &reticula::hawkes_univariate_exponential<ResultType>::phi,
190230 nb::call_guard<nb::gil_scoped_release>())
231+ .def (" __copy__" , [](
232+ const reticula::hawkes_univariate_exponential<ResultType>& self) {
233+ return reticula::hawkes_univariate_exponential<ResultType>(self);
234+ }).def (" __deepcopy__" , [](
235+ const reticula::hawkes_univariate_exponential<ResultType>& self,
236+ nb::dict) {
237+ return reticula::hawkes_univariate_exponential<ResultType>(self);
238+ }, " memo" _a)
191239 .def (" __repr__" , [](
192240 const reticula::hawkes_univariate_exponential<ResultType>& a) {
193241 return fmt::format (" {}" , a);
@@ -208,6 +256,12 @@ struct declare_floating_point_distributions {
208256 nb::call_guard<nb::gil_scoped_release>())
209257 .def (" mean" , &reticula::delta_distribution<ResultType>::mean,
210258 nb::call_guard<nb::gil_scoped_release>())
259+ .def (" __copy__" , [](const reticula::delta_distribution<ResultType>& self) {
260+ return reticula::delta_distribution<ResultType>(self);
261+ }).def (" __deepcopy__" , [](
262+ const reticula::delta_distribution<ResultType>& self, nb::dict) {
263+ return reticula::delta_distribution<ResultType>(self);
264+ }, " memo" _a)
211265 .def (" __repr__" , [](
212266 const reticula::delta_distribution<ResultType>& a) {
213267 return fmt::format (" {}" , a);
@@ -231,6 +285,12 @@ struct declare_floating_point_distributions {
231285 nb::call_guard<nb::gil_scoped_release>())
232286 .def (" b" , &std::uniform_real_distribution<ResultType>::b,
233287 nb::call_guard<nb::gil_scoped_release>())
288+ .def (" __copy__" , [](const std::uniform_real_distribution<ResultType>& self) {
289+ return std::uniform_real_distribution<ResultType>(self);
290+ }).def (" __deepcopy__" , [](
291+ const std::uniform_real_distribution<ResultType>& self, nb::dict) {
292+ return std::uniform_real_distribution<ResultType>(self);
293+ }, " memo" _a)
234294 .def (" __repr__" , [](
235295 const std::uniform_real_distribution<ResultType>& a) {
236296 return fmt::format (" {}" , a);
0 commit comments