|
@@ -12,6 +12,9 @@
|
|
|
#include "bindings.h"
|
|
|
#include "cryptocontext_wrapper.h"
|
|
|
#include "binfhe_bindings.h"
|
|
|
+#include "cryptocontext_docs.h"
|
|
|
+#include "plaintext_docs.h"
|
|
|
+#include "ciphertext_docs.h"
|
|
|
|
|
|
using namespace lbcrypto;
|
|
|
namespace py = pybind11;
|
|
@@ -37,7 +40,7 @@ void bind_parameters(py::module &m,const std::string name)
|
|
|
.def("GetDesiredPrecision", &CCParams<T>::GetDesiredPrecision)
|
|
|
.def("GetStatisticalSecurity", &CCParams<T>::GetStatisticalSecurity)
|
|
|
.def("GetNumAdversarialQueries", &CCParams<T>::GetNumAdversarialQueries)
|
|
|
- .def("GetThresholdNumOfParties", &CCParams<T>::GetThresholdNumOfParties)
|
|
|
+ //.def("GetThresholdNumOfParties", &CCParams<T>::GetThresholdNumOfParties)
|
|
|
.def("GetKeySwitchTechnique", &CCParams<T>::GetKeySwitchTechnique)
|
|
|
.def("GetScalingTechnique", &CCParams<T>::GetScalingTechnique)
|
|
|
.def("GetBatchSize", &CCParams<T>::GetBatchSize)
|
|
@@ -66,7 +69,7 @@ void bind_parameters(py::module &m,const std::string name)
|
|
|
.def("SetDesiredPrecision", &CCParams<T>::SetDesiredPrecision)
|
|
|
.def("SetStatisticalSecurity", &CCParams<T>::SetStatisticalSecurity)
|
|
|
.def("SetNumAdversarialQueries", &CCParams<T>::SetNumAdversarialQueries)
|
|
|
- .def("SetThresholdNumOfParties", &CCParams<T>::SetThresholdNumOfParties)
|
|
|
+ //.def("SetThresholdNumOfParties", &CCParams<T>::SetThresholdNumOfParties)
|
|
|
.def("SetKeySwitchTechnique", &CCParams<T>::SetKeySwitchTechnique)
|
|
|
.def("SetScalingTechnique", &CCParams<T>::SetScalingTechnique)
|
|
|
.def("SetBatchSize", &CCParams<T>::SetBatchSize)
|
|
@@ -95,166 +98,413 @@ void bind_crypto_context(py::module &m)
|
|
|
{
|
|
|
py::class_<CryptoContextImpl<DCRTPoly>, std::shared_ptr<CryptoContextImpl<DCRTPoly>>>(m, "CryptoContext")
|
|
|
.def(py::init<>())
|
|
|
- .def("GetKeyGenLevel", &CryptoContextImpl<DCRTPoly>::GetKeyGenLevel)
|
|
|
- .def("SetKeyGenLevel", &CryptoContextImpl<DCRTPoly>::SetKeyGenLevel)
|
|
|
+ .def("GetKeyGenLevel", &CryptoContextImpl<DCRTPoly>::GetKeyGenLevel, cc_GetKeyGenLevel_docs)
|
|
|
+ .def("SetKeyGenLevel", &CryptoContextImpl<DCRTPoly>::SetKeyGenLevel, cc_SetKeyGenLevel_docs,
|
|
|
+ py::arg("level"))
|
|
|
//.def("GetScheme",&CryptoContextImpl<DCRTPoly>::GetScheme)
|
|
|
//.def("GetCryptoParameters", &CryptoContextImpl<DCRTPoly>::GetCryptoParameters)
|
|
|
- .def("GetRingDimension", &CryptoContextImpl<DCRTPoly>::GetRingDimension)
|
|
|
- .def("Enable", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(PKESchemeFeature)>(&CryptoContextImpl<DCRTPoly>::Enable), "Enable a feature for the CryptoContext")
|
|
|
- .def("KeyGen", &CryptoContextImpl<DCRTPoly>::KeyGen, "Generate a key pair with public and private keys")
|
|
|
- .def("EvalMultKeyGen", &CryptoContextImpl<DCRTPoly>::EvalMultKeyGen, "Generate the evaluation key for multiplication")
|
|
|
- .def("EvalMultKeysGen", &CryptoContextImpl<DCRTPoly>::EvalMultKeysGen)
|
|
|
- .def("EvalRotateKeyGen", &CryptoContextImpl<DCRTPoly>::EvalRotateKeyGen, "Generate the evaluation key for rotation",
|
|
|
- py::arg("privateKey"), py::arg("indexList"), py::arg("publicKey") = nullptr)
|
|
|
- .def("MakeStringPlaintext", &CryptoContextImpl<DCRTPoly>::MakeStringPlaintext)
|
|
|
- .def("MakePackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakePackedPlaintext, "Make a plaintext from a vector of integers",
|
|
|
- py::arg("value"), py::arg("depth") = 1, py::arg("level") = 0)
|
|
|
- .def("MakeCoefPackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakeCoefPackedPlaintext)
|
|
|
+ .def("GetRingDimension", &CryptoContextImpl<DCRTPoly>::GetRingDimension, cc_GetRingDimension_docs)
|
|
|
+ .def("Enable", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(PKESchemeFeature)>(&CryptoContextImpl<DCRTPoly>::Enable), cc_Enable_docs,
|
|
|
+ py::arg("feature"))
|
|
|
+ .def("KeyGen", &CryptoContextImpl<DCRTPoly>::KeyGen, cc_KeyGen_docs)
|
|
|
+ .def("EvalMultKeyGen", &CryptoContextImpl<DCRTPoly>::EvalMultKeyGen,
|
|
|
+ cc_EvalMultKeyGen_docs,
|
|
|
+ py::arg("privateKey"))
|
|
|
+ .def("EvalMultKeysGen", &CryptoContextImpl<DCRTPoly>::EvalMultKeysGen,
|
|
|
+ cc_EvalMultKeysGen_docs,
|
|
|
+ py::arg("privateKey"))
|
|
|
+ .def("EvalRotateKeyGen", &CryptoContextImpl<DCRTPoly>::EvalRotateKeyGen,
|
|
|
+ cc_EvalRotateKeyGen_docs,
|
|
|
+ py::arg("privateKey"),
|
|
|
+ py::arg("indexList"),
|
|
|
+ py::arg("publicKey") = nullptr)
|
|
|
+ .def("MakeStringPlaintext", &CryptoContextImpl<DCRTPoly>::MakeStringPlaintext,
|
|
|
+ cc_MakeStringPlaintext_docs,
|
|
|
+ py::arg("str"))
|
|
|
+ .def("MakePackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakePackedPlaintext,
|
|
|
+ cc_MakePackedPlaintext_docs,
|
|
|
+ py::arg("value"),
|
|
|
+ py::arg("depth") = 1,
|
|
|
+ py::arg("level") = 0)
|
|
|
+ .def("MakeCoefPackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakeCoefPackedPlaintext,
|
|
|
+ cc_MakeCoefPackedPlaintext_docs,
|
|
|
+ py::arg("value"),
|
|
|
+ py::arg("depth") = 1,
|
|
|
+ py::arg("level") = 0)
|
|
|
// TODO (Oliveira): allow user to specify different params values
|
|
|
- .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<std::complex<double>> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), "Make a CKKS plaintext from a vector of complex doubles",
|
|
|
+ .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<std::complex<double>> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), cc_MakeCKKSPackedPlaintextComplex_docs,
|
|
|
py::arg("value"),
|
|
|
py::arg("depth") = static_cast<size_t>(1),
|
|
|
py::arg("level") = static_cast<uint32_t>(0),
|
|
|
py::arg("params") = py::none(),
|
|
|
py::arg("slots") = 0)
|
|
|
- .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<double> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), "Make a CKKS plaintext from a vector of doubles",
|
|
|
+ .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<double> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), cc_MakeCKKSPlaintextReal_docs,
|
|
|
py::arg("value"),
|
|
|
py::arg("depth") = static_cast<size_t>(1),
|
|
|
py::arg("level") = static_cast<uint32_t>(0),
|
|
|
py::arg("params") = py::none(),
|
|
|
py::arg("slots") = 0)
|
|
|
- .def("EvalRotate", &CryptoContextImpl<DCRTPoly>::EvalRotate, "Rotate a ciphertext")
|
|
|
- .def("EvalFastRotationPrecompute", &EvalFastRotationPrecomputeWrapper)
|
|
|
- .def("EvalFastRotation", &EvalFastRotationWrapper)
|
|
|
- .def("EvalFastRotationExt", &EvalFastRotationExtWrapper)
|
|
|
- .def("EvalAtIndexKeyGen", &CryptoContextImpl<DCRTPoly>::EvalAtIndexKeyGen)
|
|
|
- .def("EvalAtIndex", &CryptoContextImpl<DCRTPoly>::EvalAtIndex)
|
|
|
- .def("Encrypt", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const PublicKey<DCRTPoly>, Plaintext) const>(&CryptoContextImpl<DCRTPoly>::Encrypt),
|
|
|
- "Encrypt a plaintext using public key")
|
|
|
- .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, const PrivateKey<DCRTPoly>, ConstCiphertext<DCRTPoly>)>(&DecryptWrapper),
|
|
|
- "Decrypt a ciphertext using private key")
|
|
|
- .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, ConstCiphertext<DCRTPoly>, const PrivateKey<DCRTPoly>)>(&DecryptWrapper),
|
|
|
- "Decrypt a ciphertext using private key")
|
|
|
- .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalAdd), "Add two ciphertexts")
|
|
|
- .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>(&CryptoContextImpl<DCRTPoly>::EvalAdd), "Add a ciphertext with a scalar")
|
|
|
- .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalAddInPlace))
|
|
|
- .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstPlaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalAddInPlace))
|
|
|
- .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalAddInPlace))
|
|
|
- .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalAddMutable))
|
|
|
- .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalAddMutable))
|
|
|
- .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalAddMutable))
|
|
|
- .def("EvalAddMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalAddMutableInPlace)
|
|
|
- .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalSub), "Subtract two ciphertexts")
|
|
|
- .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>(&CryptoContextImpl<DCRTPoly>::EvalSub), "Subtract double from ciphertext")
|
|
|
- .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalSub), "Subtract ciphertext from double")
|
|
|
- .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalSub), "Subtract plaintext from ciphertext")
|
|
|
- .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalSub), "Subtract ciphertext from plaintext")
|
|
|
- .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalSubInPlace))
|
|
|
- .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, double) const>(&CryptoContextImpl<DCRTPoly>::EvalSubInPlace))
|
|
|
- .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(double, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalSubInPlace))
|
|
|
- .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalSubMutable))
|
|
|
- .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalSubMutable))
|
|
|
- .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalSubMutable))
|
|
|
- .def("EvalSubMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalSubMutableInPlace)
|
|
|
- .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalMult), "Multiply two ciphertexts")
|
|
|
- .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>(&CryptoContextImpl<DCRTPoly>::EvalMult), "Multiply a ciphertext with a scalar")
|
|
|
- .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalMult))
|
|
|
- .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalMult))
|
|
|
- .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::EvalMult))
|
|
|
- .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalMultMutable))
|
|
|
- .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>(&CryptoContextImpl<DCRTPoly>::EvalMultMutable))
|
|
|
- .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>(&CryptoContextImpl<DCRTPoly>::EvalMultMutable))
|
|
|
- .def("EvalMultMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalMultMutableInPlace)
|
|
|
- .def("EvalSquare", &CryptoContextImpl<DCRTPoly>::EvalSquare)
|
|
|
- .def("EvalSquareMutable", &CryptoContextImpl<DCRTPoly>::EvalSquareMutable)
|
|
|
- .def("EvalSquareInPlace", &CryptoContextImpl<DCRTPoly>::EvalSquareInPlace)
|
|
|
- .def("EvalMultNoRelin", &CryptoContextImpl<DCRTPoly>::EvalMultNoRelin)
|
|
|
- .def("Relinearize", &CryptoContextImpl<DCRTPoly>::Relinearize)
|
|
|
- .def("RelinearizeInPlace", &CryptoContextImpl<DCRTPoly>::RelinearizeInPlace)
|
|
|
- .def("EvalMultAndRelinearize", &CryptoContextImpl<DCRTPoly>::EvalMultAndRelinearize)
|
|
|
- .def("EvalNegate", &CryptoContextImpl<DCRTPoly>::EvalNegate)
|
|
|
- .def("EvalNegateInPlace", &CryptoContextImpl<DCRTPoly>::EvalNegateInPlace)
|
|
|
+ .def("EvalRotate", &CryptoContextImpl<DCRTPoly>::EvalRotate,
|
|
|
+ cc_EvalRotate_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("index"))
|
|
|
+ .def("EvalFastRotationPrecompute", &EvalFastRotationPrecomputeWrapper,
|
|
|
+ cc_EvalFastRotationPreCompute_docs,
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalFastRotation", &EvalFastRotationWrapper,
|
|
|
+ cc_EvalFastRotation_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("index"),
|
|
|
+ py::arg("m"),
|
|
|
+ py::arg("digits"))
|
|
|
+ .def("EvalFastRotationExt", &EvalFastRotationExtWrapper,
|
|
|
+ cc_EvalFastRotationExt_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("index"),
|
|
|
+ py::arg("digits"),
|
|
|
+ py::arg("addFirst"))
|
|
|
+ .def("EvalAtIndexKeyGen", &CryptoContextImpl<DCRTPoly>::EvalAtIndexKeyGen,
|
|
|
+ cc_EvalAtIndexKeyGen_docs,
|
|
|
+ py::arg("privateKey"),
|
|
|
+ py::arg("indexList"),
|
|
|
+ py::arg("publicKey") = nullptr)
|
|
|
+ .def("EvalAtIndex", &CryptoContextImpl<DCRTPoly>::EvalAtIndex,
|
|
|
+ cc_EvalAtIndex_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("index"))
|
|
|
+ .def("Encrypt", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const PublicKey<DCRTPoly>, Plaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::Encrypt),
|
|
|
+ cc_Encrypt_docs,
|
|
|
+ py::arg("publicKey"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, const PrivateKey<DCRTPoly>, ConstCiphertext<DCRTPoly>)>
|
|
|
+ (&DecryptWrapper), cc_Decrypt_docs,
|
|
|
+ py::arg("privateKey"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, ConstCiphertext<DCRTPoly>, const PrivateKey<DCRTPoly>)>
|
|
|
+ (&DecryptWrapper), cc_Decrypt_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("privateKey"))
|
|
|
+ .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAdd),
|
|
|
+ cc_EvalAdd_docs,
|
|
|
+ py::arg("ciphertext1"),
|
|
|
+ py::arg("ciphertext2"))
|
|
|
+ .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAdd),
|
|
|
+ cc_EvalAddfloat_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("scalar"))
|
|
|
+ .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
|
|
|
+ cc_EvalAddInPlace_docs,
|
|
|
+ py::arg("ciphertext1"),
|
|
|
+ py::arg("ciphertext2"))
|
|
|
+ .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstPlaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
|
|
|
+ cc_EvalAddInPlacePlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
|
|
|
+ cc_EvalAddMutable_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
|
|
|
+ cc_EvalAddMutablePlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalAddMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalAddMutableInPlace,
|
|
|
+ cc_EvalAddMutableInPlace_docs,
|
|
|
+ py::arg("ciphertext1"),
|
|
|
+ py::arg("ciphertext2"))
|
|
|
+ .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSub),
|
|
|
+ cc_EvalSub_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSub),
|
|
|
+ cc_EvalSubfloat_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("constant"))
|
|
|
+ .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSub),
|
|
|
+ "",
|
|
|
+ py::arg("constant"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSub),
|
|
|
+ cc_EvalSubPlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSub),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
|
|
|
+ cc_EvalSubInPlace_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, double) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
|
|
|
+ cc_EvalSubInPlacefloat_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("constant"))
|
|
|
+ .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(double, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
|
|
|
+ "",
|
|
|
+ py::arg("constant"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
|
|
|
+ cc_EvalSubMutable_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
|
|
|
+ cc_EvalSubMutablePlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalSubMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalSubMutableInPlace,
|
|
|
+ cc_EvalSubMutableInPlace_docs,
|
|
|
+ py::arg("ciphertext1"),
|
|
|
+ py::arg("ciphertext2"))
|
|
|
+ .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMult),
|
|
|
+ cc_EvalMult_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMult),
|
|
|
+ cc_EvalMultfloat_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("constant"))
|
|
|
+ .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMult),
|
|
|
+ cc_EvalMultPlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMult),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMult),
|
|
|
+ "",
|
|
|
+ py::arg("constant"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
|
|
|
+ cc_EvalMultMutable_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
|
|
|
+ cc_EvalMultMutablePlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"))
|
|
|
+ .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
|
|
|
+ (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
|
|
|
+ "",
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalMultMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalMultMutableInPlace,
|
|
|
+ cc_EvalMultMutableInPlace_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalSquare", &CryptoContextImpl<DCRTPoly>::EvalSquare,
|
|
|
+ cc_EvalSquare_docs,
|
|
|
+ py::arg("ct"))
|
|
|
+ .def("EvalSquareMutable", &CryptoContextImpl<DCRTPoly>::EvalSquareMutable,
|
|
|
+ cc_EvalSquareMutable_docs,
|
|
|
+ py::arg("ct"))
|
|
|
+ .def("EvalSquareInPlace", &CryptoContextImpl<DCRTPoly>::EvalSquareInPlace,
|
|
|
+ cc_EvalSquareInPlace_docs,
|
|
|
+ py::arg("ct"))
|
|
|
+ .def("EvalMultNoRelin", &CryptoContextImpl<DCRTPoly>::EvalMultNoRelin,
|
|
|
+ cc_EvalMultNoRelin_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("Relinearize", &CryptoContextImpl<DCRTPoly>::Relinearize,
|
|
|
+ cc_Relinearize_docs,
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("RelinearizeInPlace", &CryptoContextImpl<DCRTPoly>::RelinearizeInPlace,
|
|
|
+ cc_RelinearizeInPlace_docs,
|
|
|
+ py::arg("ciphertext"))
|
|
|
+ .def("EvalMultAndRelinearize", &CryptoContextImpl<DCRTPoly>::EvalMultAndRelinearize,
|
|
|
+ cc_EvalMultAndRelinearize_docs,
|
|
|
+ py::arg("ct1"),
|
|
|
+ py::arg("ct2"))
|
|
|
+ .def("EvalNegate", &CryptoContextImpl<DCRTPoly>::EvalNegate,
|
|
|
+ cc_EvalNegate_docs,
|
|
|
+ py::arg("ct"))
|
|
|
+ .def("EvalNegateInPlace", &CryptoContextImpl<DCRTPoly>::EvalNegateInPlace,
|
|
|
+ cc_EvalNegateInPlace_docs,
|
|
|
+ py::arg("ct"))
|
|
|
.def("EvalLogistic", &CryptoContextImpl<DCRTPoly>::EvalLogistic,
|
|
|
- py::arg("ciphertext"),
|
|
|
- py::arg("a"),
|
|
|
- py::arg("b"),
|
|
|
- py::arg("degree"))
|
|
|
- .def("EvalChebyshevSeries", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeries)
|
|
|
- .def("EvalChebyshevSeriesLinear", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesLinear)
|
|
|
- .def("EvalChebyshevSeriesPS", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesPS)
|
|
|
+ cc_EvalLogistic_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("a"),
|
|
|
+ py::arg("b"),
|
|
|
+ py::arg("degree"))
|
|
|
+ .def("EvalChebyshevSeries", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeries,
|
|
|
+ cc_EvalChebyshevSeries_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"),
|
|
|
+ py::arg("a"),
|
|
|
+ py::arg("b"))
|
|
|
+ .def("EvalChebyshevSeriesLinear", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesLinear,
|
|
|
+ cc_EvalChebyshevSeriesLinear_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"),
|
|
|
+ py::arg("a"),
|
|
|
+ py::arg("b"))
|
|
|
+ .def("EvalChebyshevSeriesPS", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesPS,
|
|
|
+ cc_EvalChebyshevSeriesPS_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"),
|
|
|
+ py::arg("a"),
|
|
|
+ py::arg("b"))
|
|
|
.def("EvalChebyshevFunction", &CryptoContextImpl<DCRTPoly>::EvalChebyshevFunction,
|
|
|
+ cc_EvalChebyshevFunction_docs,
|
|
|
py::arg("func"),
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("a"),
|
|
|
py::arg("b"),
|
|
|
py::arg("degree"))
|
|
|
.def("EvalSin", &CryptoContextImpl<DCRTPoly>::EvalSin,
|
|
|
+ cc_EvalSin_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("a"),
|
|
|
py::arg("b"),
|
|
|
py::arg("degree"))
|
|
|
.def("EvalCos", &CryptoContextImpl<DCRTPoly>::EvalCos,
|
|
|
+ cc_EvalCos_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("a"),
|
|
|
py::arg("b"),
|
|
|
py::arg("degree"))
|
|
|
.def("EvalDivide", &CryptoContextImpl<DCRTPoly>::EvalDivide,
|
|
|
+ cc_EvalDivide_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("a"),
|
|
|
py::arg("b"),
|
|
|
py::arg("degree"))
|
|
|
.def("EvalSumKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumKeyGen,
|
|
|
+ cc_EvalSumKeyGen_docs,
|
|
|
py::arg("privateKey"),
|
|
|
py::arg("publicKey") = py::none())
|
|
|
+ //TODO (Oliveira, R.): Solve pointer handling bug when dealing with EvalKeyMap object for the next functions
|
|
|
.def("EvalSumRowsKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumRowsKeyGen,
|
|
|
+ cc_EvalSumRowsKeyGen_docs,
|
|
|
py::arg("privateKey"),
|
|
|
py::arg("publicKey") = py::none(),
|
|
|
py::arg("rowSize") = 0,
|
|
|
py::arg("subringDim") = 0)
|
|
|
.def("EvalSumColsKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumColsKeyGen,
|
|
|
+ cc_EvalSumColsKeyGen_docs,
|
|
|
py::arg("privateKey"),
|
|
|
py::arg("publicKey") = py::none())
|
|
|
.def("EvalSumRows", &CryptoContextImpl<DCRTPoly>::EvalSumRows,
|
|
|
+ cc_EvalSumRows_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("rowSize"),
|
|
|
py::arg("evalSumKeyMap"),
|
|
|
py::arg("subringDim") = 0)
|
|
|
.def("EvalSumCols", &CryptoContextImpl<DCRTPoly>::EvalSumCols,
|
|
|
+ cc_EvalSumCols_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("rowSize"),
|
|
|
py::arg("evalSumKeyMap"))
|
|
|
- .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)
|
|
|
- (ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct))
|
|
|
- .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)
|
|
|
- (ConstCiphertext<DCRTPoly>, ConstPlaintext, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct))
|
|
|
- .def("EvalPoly", &CryptoContextImpl<DCRTPoly>::EvalPoly)
|
|
|
- .def("EvalPolyLinear", &CryptoContextImpl<DCRTPoly>::EvalPolyLinear)
|
|
|
- .def("EvalPolyPS", &CryptoContextImpl<DCRTPoly>::EvalPolyPS)
|
|
|
- .def("Rescale", &CryptoContextImpl<DCRTPoly>::Rescale, "Rescale a ciphertext")
|
|
|
+ .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct),
|
|
|
+ cc_EvalInnerProduct_docs,
|
|
|
+ py::arg("ciphertext1"),
|
|
|
+ py::arg("ciphertext2"),
|
|
|
+ py::arg("batchSize"))
|
|
|
+ .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct),
|
|
|
+ cc_EvalInnerProductPlaintext_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("plaintext"),
|
|
|
+ py::arg("batchSize"))
|
|
|
+ .def("EvalMerge", &CryptoContextImpl<DCRTPoly>::EvalMerge,
|
|
|
+ cc_EvalMerge_docs,
|
|
|
+ py::arg("ciphertextVec"))
|
|
|
+ .def("EvalPoly", &CryptoContextImpl<DCRTPoly>::EvalPoly,
|
|
|
+ cc_EvalPoly_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"))
|
|
|
+ .def("EvalPolyLinear", &CryptoContextImpl<DCRTPoly>::EvalPolyLinear,
|
|
|
+ cc_EvalPolyLinear_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"))
|
|
|
+ .def("EvalPolyPS", &CryptoContextImpl<DCRTPoly>::EvalPolyPS,
|
|
|
+ cc_EvalPolyPS_docs,
|
|
|
+ py::arg("ciphertext"),
|
|
|
+ py::arg("coefficients"))
|
|
|
+ .def("Rescale", &CryptoContextImpl<DCRTPoly>::Rescale,
|
|
|
+ cc_Rescale_docs,
|
|
|
+ py::arg("ciphertext"))
|
|
|
.def("EvalBootstrapSetup", &CryptoContextImpl<DCRTPoly>::EvalBootstrapSetup,
|
|
|
+ cc_EvalBootstrapSetup_docs,
|
|
|
py::arg("levelBudget") = std::vector<uint32_t>({5, 4}),
|
|
|
py::arg("dim1") = std::vector<uint32_t>({0, 0}),
|
|
|
py::arg("slots") = 0,
|
|
|
py::arg("correctionFactor") = 0)
|
|
|
.def("EvalBootstrapKeyGen", &CryptoContextImpl<DCRTPoly>::EvalBootstrapKeyGen,
|
|
|
+ cc_EvalBootstrapKeyGen_docs,
|
|
|
py::arg("privateKey"),
|
|
|
py::arg("slots"))
|
|
|
.def("EvalBootstrap", &CryptoContextImpl<DCRTPoly>::EvalBootstrap,
|
|
|
+ cc_EvalBootstrap_docs,
|
|
|
py::arg("ciphertext"),
|
|
|
py::arg("numIterations") = 1,
|
|
|
py::arg("precision") = 0)
|
|
|
- .def("EvalAutomorphismKeyGen", &EvalAutomorphismKeyGenWrapper, py::return_value_policy::reference_internal)
|
|
|
- .def("EvalAutomorphismKeyGen", &EvalAutomorphismKeyGenWrapper_PublicKey, py::return_value_policy::reference_internal)
|
|
|
- .def("FindAutomorphismIndex", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndex)
|
|
|
- .def("FindAutomorphismIndices", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndices)
|
|
|
+ //TODO (Oliveira, R.): Solve pointer handling bug when returning EvalKeyMap objects for the next functions
|
|
|
+ .def("EvalAutomorphismKeyGen", &EvalAutomorphismKeyGenWrapper,
|
|
|
+ cc_EvalAutomorphismKeyGen_docs,
|
|
|
+ py::arg("privateKey"),
|
|
|
+ py::arg("indexList"),
|
|
|
+ py::return_value_policy::reference_internal)
|
|
|
+ .def("EvalAutomorphismKeyGen", &EvalAutomorphismKeyGenWrapper_PublicKey,
|
|
|
+ cc_EvalAutomorphismKeyGenPublic_docs,
|
|
|
+ py::arg("publicKey"),
|
|
|
+ py::arg("privateKey"),
|
|
|
+ py::arg("indexList"),
|
|
|
+ py::return_value_policy::reference_internal)
|
|
|
+ .def("FindAutomorphismIndex", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndex,
|
|
|
+ cc_FindAutomorphismIndex_docs,
|
|
|
+ py::arg("idx"))
|
|
|
+ .def("FindAutomorphismIndices", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndices,
|
|
|
+ cc_FindAutomorphismIndices_docs,
|
|
|
+ py::arg("idxList"))
|
|
|
.def_static(
|
|
|
"ClearEvalMultKeys", []()
|
|
|
{ CryptoContextImpl<DCRTPoly>::ClearEvalMultKeys(); },
|
|
|
- "Clear the evaluation keys for multiplication")
|
|
|
+ cc_ClearEvalMultKeys_docs)
|
|
|
.def_static(
|
|
|
"ClearEvalAutomorphismKeys", []()
|
|
|
{ CryptoContextImpl<DCRTPoly>::ClearEvalAutomorphismKeys(); },
|
|
|
- "Clear the evaluation keys for rotation")
|
|
|
+ cc_ClearEvalAutomorphismKeys_docs)
|
|
|
.def_static(
|
|
|
"SerializeEvalMultKey", [](const std::string &filename, const SerType::SERBINARY &sertype, std::string id = "")
|
|
|
{
|
|
@@ -263,8 +513,8 @@ void bind_crypto_context(py::module &m)
|
|
|
res = CryptoContextImpl<DCRTPoly>::SerializeEvalMultKey<SerType::SERBINARY>(outfile, sertype, id);
|
|
|
outfile.close();
|
|
|
return res; },
|
|
|
- py::arg("filename"), py::arg("sertype"), py::arg("id") = "",
|
|
|
- "Serialize an evaluation key for multiplication")
|
|
|
+ cc_SerializeEvalMultKey_docs,
|
|
|
+ py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
|
|
|
.def_static(
|
|
|
"SerializeEvalAutomorphismKey", [](const std::string &filename, const SerType::SERBINARY &sertype, std::string id = "")
|
|
|
{
|
|
@@ -273,7 +523,8 @@ void bind_crypto_context(py::module &m)
|
|
|
res = CryptoContextImpl<DCRTPoly>::SerializeEvalAutomorphismKey<SerType::SERBINARY>(outfile, sertype, id);
|
|
|
outfile.close();
|
|
|
return res; },
|
|
|
- py::arg("filename"), py::arg("sertype"), py::arg("id") = "", "Serialize evaluation keys for rotation")
|
|
|
+ cc_SerializeEvalAutomorphismKey_docs,
|
|
|
+ py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
|
|
|
.def_static("DeserializeEvalMultKey", [](std::shared_ptr<CryptoContextImpl<DCRTPoly>> &self, const std::string &filename, const SerType::SERBINARY &sertype)
|
|
|
{
|
|
|
std::ifstream emkeys(filename, std::ios::in | std::ios::binary);
|
|
@@ -282,7 +533,10 @@ void bind_crypto_context(py::module &m)
|
|
|
}
|
|
|
bool res;
|
|
|
res = self->DeserializeEvalMultKey<SerType::SERBINARY>(emkeys, sertype);
|
|
|
- return res; })
|
|
|
+ return res; },
|
|
|
+ cc_DeserializeEvalMultKey_docs,
|
|
|
+ py::arg("self"),
|
|
|
+ py::arg("filename"), py::arg("sertype"))
|
|
|
.def_static("DeserializeEvalAutomorphismKey", [](std::shared_ptr<CryptoContextImpl<DCRTPoly>> &self, const std::string &filename, const SerType::SERBINARY &sertype)
|
|
|
{
|
|
|
std::ifstream erkeys(filename, std::ios::in | std::ios::binary);
|
|
@@ -291,12 +545,18 @@ void bind_crypto_context(py::module &m)
|
|
|
}
|
|
|
bool res;
|
|
|
res = self->DeserializeEvalAutomorphismKey<SerType::SERBINARY>(erkeys, sertype);
|
|
|
- return res; });
|
|
|
+ return res; },
|
|
|
+ cc_DeserializeEvalAutomorphismKey_docs,
|
|
|
+ py::arg("self"),
|
|
|
+ py::arg("filename"), py::arg("sertype"));
|
|
|
|
|
|
// Generator Functions
|
|
|
- m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBFVRNS>);
|
|
|
- m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBGVRNS>);
|
|
|
- m.def("GenCryptoContext", &GenCryptoContext<CryptoContextCKKSRNS>);
|
|
|
+ m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBFVRNS>,
|
|
|
+ py::arg("params"));
|
|
|
+ m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBGVRNS>,
|
|
|
+ py::arg("params"));
|
|
|
+ m.def("GenCryptoContext", &GenCryptoContext<CryptoContextCKKSRNS>,
|
|
|
+ py::arg("params"));
|
|
|
m.def("ReleaseAllContexts", &CryptoContextFactory<DCRTPoly>::ReleaseAllContexts);
|
|
|
}
|
|
|
|
|
@@ -471,17 +731,28 @@ void bind_keys(py::module &m)
|
|
|
void bind_encodings(py::module &m)
|
|
|
{
|
|
|
py::class_<PlaintextImpl, std::shared_ptr<PlaintextImpl>>(m, "Plaintext")
|
|
|
- .def("GetScalingFactor", &PlaintextImpl::GetScalingFactor)
|
|
|
- .def("SetScalingFactor", &PlaintextImpl::SetScalingFactor)
|
|
|
- .def("GetLength", &PlaintextImpl::GetLength)
|
|
|
- .def("GetSchemeID", &PlaintextImpl::GetSchemeID)
|
|
|
- .def("SetLength", &PlaintextImpl::SetLength)
|
|
|
- .def("IsEncoded", &PlaintextImpl::IsEncoded)
|
|
|
- .def("GetLogPrecision", &PlaintextImpl::GetLogPrecision)
|
|
|
- //.def("GetEncondingParams", &PlaintextImpl::GetEncondingParams)
|
|
|
- .def("Encode", &PlaintextImpl::Encode)
|
|
|
- .def("Decode", &PlaintextImpl::Decode)
|
|
|
- .def("GetCKKSPackedValue", &PlaintextImpl::GetCKKSPackedValue)
|
|
|
+ .def("GetScalingFactor", &PlaintextImpl::GetScalingFactor,
|
|
|
+ ptx_GetScalingFactor_docs)
|
|
|
+ .def("SetScalingFactor", &PlaintextImpl::SetScalingFactor,
|
|
|
+ ptx_SetScalingFactor_docs,
|
|
|
+ py::arg("sf"))
|
|
|
+ .def("GetLength", &PlaintextImpl::GetLength,
|
|
|
+ ptx_GetLength_docs)
|
|
|
+ .def("GetSchemeID", &PlaintextImpl::GetSchemeID,
|
|
|
+ ptx_GetSchemeID_docs)
|
|
|
+ .def("SetLength", &PlaintextImpl::SetLength,
|
|
|
+ ptx_SetLength_docs,
|
|
|
+ py::arg("newSize"))
|
|
|
+ .def("IsEncoded", &PlaintextImpl::IsEncoded,
|
|
|
+ ptx_IsEncoded_docs)
|
|
|
+ .def("GetLogPrecision", &PlaintextImpl::GetLogPrecision,
|
|
|
+ ptx_GetLogPrecision_docs)
|
|
|
+ .def("Encode", &PlaintextImpl::Encode,
|
|
|
+ ptx_Encode_docs)
|
|
|
+ .def("Decode", &PlaintextImpl::Decode,
|
|
|
+ ptx_Decode_docs)
|
|
|
+ .def("GetCKKSPackedValue", &PlaintextImpl::GetCKKSPackedValue,
|
|
|
+ ptx_GetCKKSPackedValue_docs)
|
|
|
.def("__repr__", [](const PlaintextImpl &p)
|
|
|
{
|
|
|
std::stringstream ss;
|
|
@@ -505,8 +776,11 @@ void bind_ciphertext(py::module &m)
|
|
|
// .def(py::self + py::self);
|
|
|
// .def("GetDepth", &CiphertextImpl<DCRTPoly>::GetDepth)
|
|
|
// .def("SetDepth", &CiphertextImpl<DCRTPoly>::SetDepth)
|
|
|
- .def("GetLevel", &CiphertextImpl<DCRTPoly>::GetLevel)
|
|
|
- .def("SetLevel", &CiphertextImpl<DCRTPoly>::SetLevel);
|
|
|
+ .def("GetLevel", &CiphertextImpl<DCRTPoly>::GetLevel,
|
|
|
+ ctx_GetLevel_docs)
|
|
|
+ .def("SetLevel", &CiphertextImpl<DCRTPoly>::SetLevel,
|
|
|
+ ctx_SetLevel_docs,
|
|
|
+ py::arg("level"));
|
|
|
// .def("GetHopLevel", &CiphertextImpl<DCRTPoly>::GetHopLevel)
|
|
|
// .def("SetHopLevel", &CiphertextImpl<DCRTPoly>::SetHopLevel)
|
|
|
// .def("GetScalingFactor", &CiphertextImpl<DCRTPoly>::GetScalingFactor)
|
|
@@ -532,10 +806,10 @@ PYBIND11_MODULE(openfhe, m)
|
|
|
bind_parameters<CryptoContextBFVRNS>(m,"CCParamsBFVRNS");
|
|
|
bind_parameters<CryptoContextBGVRNS>(m,"CCParamsBGVRNS");
|
|
|
bind_parameters<CryptoContextCKKSRNS>(m,"CCParamsCKKSRNS");
|
|
|
- bind_crypto_context(m);
|
|
|
- bind_keys(m);
|
|
|
bind_encodings(m);
|
|
|
bind_ciphertext(m);
|
|
|
+ bind_keys(m);
|
|
|
+ bind_crypto_context(m);
|
|
|
bind_serialization(m);
|
|
|
bind_schemes(m);
|
|
|
// binfhe library
|