Browse Source

clear Params from python interface + examp bug fix

Rener Oliveira (Ubuntu WSL) 1 year ago
parent
commit
afddfe79fa
2 changed files with 7 additions and 10 deletions
  1. 1 4
      src/bindings.cpp
  2. 6 6
      src/pke/examples/simple-real-numbers.py

+ 1 - 4
src/bindings.cpp

@@ -17,7 +17,7 @@ namespace py = pybind11;
 template <typename T>
 void bind_parameters(py::module &m,const std::string name)
 {
-    py::class_<CCParams<T>, Params>(m, name.c_str())
+    py::class_<CCParams<T>>(m, name.c_str())
         .def(py::init<>())
         // getters
         .def("GetPlaintextModulus", &CCParams<T>::GetPlaintextModulus)
@@ -363,9 +363,6 @@ void bind_enums_and_constants(py::module &m)
 
     //NATIVEINT function
     m.def("get_native_int", &get_native_int);
-
-    // Params
-    py::class_<Params>(m, "Params");
 }
 
 void bind_keys(py::module &m)

+ 6 - 6
src/pke/examples/simple-real-numbers.py

@@ -48,7 +48,7 @@ c_rot2 = cc.EvalRotate(c1, -2)
 
 # Step 5: Decryption and output
 # Decrypt the result of additions
-ptAdd = Decrypt(c_add,keys.secretKey)
+ptAdd = cc.Decrypt(c_add,keys.secretKey)
 
 # We set the precision to 8 decimal digits for a nicer output.
 # If you want to see the error/noise introduced by CKKS, bump it up
@@ -56,28 +56,28 @@ ptAdd = Decrypt(c_add,keys.secretKey)
 
 precision = 8
 print("Results of homomorphic computations:")
-result = Decrypt(c1, keys.secretKey)
+result = cc.Decrypt(c1, keys.secretKey)
 result.SetLength(batch_size)
 print("x1 = " + str(result))
 print("Estimated precision in bits: " + str(result.GetLogPrecision()))
 
 # Decrypt the result of scalar multiplication
-result = Decrypt(c_scalar,keys.secretKey)
+result = cc.Decrypt(c_scalar,keys.secretKey)
 result.SetLength(batch_size)
 print("4 * x1 = " + str(result))
 
 # Decrypt the result of multiplication
-result = Decrypt(c_mult,keys.secretKey)
+result = cc.Decrypt(c_mult,keys.secretKey)
 result.SetLength(batch_size)
 print("x1 * x2 = " + str(result))
 
 # Decrypt the result of rotations
-result = Decrypt(c_rot1,keys.secretKey)
+result = cc.Decrypt(c_rot1,keys.secretKey)
 result.SetLength(batch_size)
 print("In rotations, very small outputs (~10^-10 here) correspond to 0's:")
 print("x1 rotated by 1 = " + str(result))
 
-result = Decrypt(c_rot2,keys.secretKey)
+result = cc.Decrypt(c_rot2,keys.secretKey)
 result.SetLength(batch_size)
 print("x1 rotated by -2 = " + str(result))