Skip to content

Commit 2b8ac0d

Browse files
Bindings for EvalMultInPlace()
1 parent 589da80 commit 2b8ac0d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/lib/bindings.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,26 @@ void bind_crypto_context(py::module &m) {
610610
py::arg("scalar"),
611611
py::arg("ciphertext"),
612612
py::doc("")) // TODO (dsuponit): replace this with an actual docstring
613+
.def("EvalMultInPlace",
614+
static_cast<void (CC::*)(Ciphertext<DCRTPoly>&, double) const>(&CC::EvalMultInPlace),
615+
py::arg("ciphertext"),
616+
py::arg("scalar"),
617+
py::doc("")) // TODO (dsuponit): replace this with an actual docstring
618+
.def("EvalMultInPlace",
619+
static_cast<void (CC::*)(double, Ciphertext<DCRTPoly>&) const>(&CC::EvalMultInPlace),
620+
py::arg("scalar"),
621+
py::arg("ciphertext"),
622+
py::doc("")) // TODO (dsuponit): replace this with an actual docstring
623+
.def("EvalMultInPlace",
624+
static_cast<void (CC::*)(Ciphertext<DCRTPoly>&, std::complex<double>) const>(&CC::EvalMultInPlace),
625+
py::arg("ciphertext"),
626+
py::arg("scalar"),
627+
py::doc("")) // TODO (dsuponit): replace this with an actual docstring
628+
.def("EvalMultInPlace",
629+
static_cast<void (CC::*)(std::complex<double>, Ciphertext<DCRTPoly>&) const>(&CC::EvalMultInPlace),
630+
py::arg("scalar"),
631+
py::arg("ciphertext"),
632+
py::doc("")) // TODO (dsuponit): replace this with an actual docstring
613633
.def("EvalMultMutable",
614634
py::overload_cast<Ciphertext<DCRTPoly>&, Ciphertext<DCRTPoly>&>(&CryptoContextImpl<DCRTPoly>::EvalMultMutable, py::const_),
615635
py::arg("ciphertext1"),
@@ -841,6 +861,11 @@ void bind_crypto_context(py::module &m) {
841861
.def("IntMPBootAdjustScale",&CryptoContextImpl<DCRTPoly>::IntMPBootAdjustScale,
842862
py::arg("ciphertext"),
843863
py::doc(cc_IntMPBootAdjustScale_docs))
864+
/////////////////////////////////////////////////////////
865+
// static_cast seems to be better than py::overload_cast for overloaded functions (even it doesn't look pretty):
866+
// 1. compiler tells your exactly what doesn’t match
867+
// 2. never silently selects the wrong overload if only one is visible
868+
/////////////////////////////////////////////////////////
844869
// .def("IntMPBootRandomElementGen",
845870
// py::overload_cast<const PublicKey<DCRTPoly>>(&CryptoContextImpl<DCRTPoly>::IntMPBootRandomElementGen, py::const_),
846871
// py::arg("publicKey"),

0 commit comments

Comments
 (0)