Parcourir la source

Merge pull request #76 from openfheorg/rsoliveira-evaladd-fix

EvalAdd Fix
Rener Oliveira il y a 1 an
Parent
commit
c3426cee35
2 fichiers modifiés avec 17 ajouts et 0 suppressions
  1. 11 0
      src/include/docstrings/cryptocontext_docs.h
  2. 6 0
      src/lib/bindings.cpp

+ 11 - 0
src/include/docstrings/cryptocontext_docs.h

@@ -361,6 +361,17 @@ EvalAdd - OpenFHE EvalAdd method for a ciphertext and a real number. Supported o
 :rtype: Ciphertext
 )pbdoc";
 
+const char* cc_EvalAddPlaintext_docs = R"pbdoc(
+EvalAdd - OpenFHE EvalAdd method for a ciphertext and plaintext
+
+:param ciphertext: input ciphertext
+:type ciphertext: Ciphertext
+:param plaintex: input plaintext
+:type plaintext: Plaintext
+:return: new ciphertext for ciphertext + constant
+:rtype: Ciphertext
+)pbdoc";
+
 const char* cc_EvalAddInPlace_docs = R"pbdoc(
 In-place homomorphic addition of two ciphertexts
 

+ 6 - 0
src/lib/bindings.cpp

@@ -205,6 +205,12 @@ void bind_crypto_context(py::module &m)
             cc_EvalAddfloat_docs,
             py::arg("ciphertext"),
             py::arg("constant"))
+        //inline Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ciphertext, ConstPlaintext plaintext) const
+        .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
+            (&CryptoContextImpl<DCRTPoly>::EvalAdd),
+            cc_EvalAddPlaintext_docs,
+            py::arg("ciphertext"),
+            py::arg("plaintext"))
         .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>
             (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
             cc_EvalAddInPlace_docs,