Prechádzať zdrojové kódy

Add EvalAutomorphism to the python bindings

Ian Goldberg 4 mesiacov pred
rodič
commit
cf8093756d

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

@@ -1561,6 +1561,19 @@ const char* cc_EvalAutomorphismKeyGen_docs = R"pbdoc(
     :rtype: EvalKeyMap
 )pbdoc";
 
+const char* cc_EvalAutomorphism_docs = R"pbdoc(
+    Compute an automorphism
+
+    :param privateKey: private key.
+    :type privateKey: PrivateKey
+    :param indexList: list of automorphism indices to be computed.
+    :type indexList: list
+    :param: the evaluation key
+    :type: EvalKeyMap
+    :return: an automorphism ciphertext
+    :rtype: Ciphertext
+)pbdoc";
+
 const char* cc_FindAutomorphismIndex_docs = R"pbdoc(
     Finds an automorphism index for a given vector index using a scheme-specific algorithm
 

+ 12 - 0
src/lib/bindings.cpp

@@ -994,6 +994,18 @@ void bind_crypto_context(py::module &m) {
             py::arg("privateKey"),
             py::arg("indexList"),
             py::doc(cc_EvalAutomorphismKeyGen_docs))
+        .def("EvalAutomorphism",
+            [](const CryptoContextImpl<DCRTPoly>& cc,
+               ConstCiphertext<DCRTPoly>& ciphertext,
+               uint32_t i,
+               const std::map<uint32_t, EvalKey<DCRTPoly>>& evalKeyMap)
+            {
+                return cc.EvalAutomorphism(ciphertext, i, evalKeyMap);
+            },
+            py::arg("ciphertext"),
+            py::arg("index"),
+            py::arg("evalKeyMap"),
+            py::doc(cc_EvalAutomorphism_docs))
         .def("Compress", &CryptoContextImpl<DCRTPoly>::Compress,
             py::arg("ciphertext"),
             py::arg("towersLeft"))