Prechádzať zdrojové kódy

Adding some functions

Hovsep Papoyan 6 mesiacov pred
rodič
commit
fed8e5d0b3
3 zmenil súbory, kde vykonal 17 pridanie a 5 odobranie
  1. 5 0
      src/CryptoContext.cc
  2. 5 2
      src/CryptoContext.h
  3. 7 3
      src/lib.rs

+ 5 - 0
src/CryptoContext.cc

@@ -116,6 +116,11 @@ void CryptoContextDCRTPoly::EvalRotateKeyGen(const std::shared_ptr<PrivateKeyImp
 {
     m_cryptoContextImplSharedPtr->EvalRotateKeyGen(privateKey, indexList, publicKey);
 }
+void CryptoContextDCRTPoly::EvalAtIndexKeyGen(const std::shared_ptr<PrivateKeyImpl> privateKey,
+    const std::vector<int32_t>& indexList, const std::shared_ptr<PublicKeyImpl> publicKey) const
+{
+    m_cryptoContextImplSharedPtr->EvalAtIndexKeyGen(privateKey, indexList, publicKey);
+}
 void CryptoContextDCRTPoly::EvalCKKStoFHEWPrecompute(const double scale) const
 {
     m_cryptoContextImplSharedPtr->EvalCKKStoFHEWPrecompute(scale);

+ 5 - 2
src/CryptoContext.h

@@ -95,8 +95,11 @@ public:
     [[nodiscard]] std::unique_ptr<KeyPairDCRTPoly> SparseKeyGen() const;
     void EvalMultKeyGen(const std::shared_ptr<PrivateKeyImpl> key) const;
     void EvalMultKeysGen(const std::shared_ptr<PrivateKeyImpl> key) const;
-    void EvalRotateKeyGen(
-        const std::shared_ptr<PrivateKeyImpl> privateKey, const std::vector<int32_t>& indexList,
+    void EvalRotateKeyGen(const std::shared_ptr<PrivateKeyImpl> privateKey,
+        const std::vector<int32_t>& indexList,
+        const std::shared_ptr<PublicKeyImpl> publicKey /* nullptr */) const;
+    void EvalAtIndexKeyGen(const std::shared_ptr<PrivateKeyImpl> privateKey,
+        const std::vector<int32_t>& indexList,
         const std::shared_ptr<PublicKeyImpl> publicKey /* nullptr */) const;
     void EvalCKKStoFHEWPrecompute(const double scale /* 1.0 */) const;
     [[nodiscard]] uint32_t GetRingDimension() const;

+ 7 - 3
src/lib.rs

@@ -548,12 +548,16 @@ pub mod ffi
                             makeSparse: /* false */ bool, fresh: /* false */ bool)
                             -> UniquePtr<KeyPairDCRTPoly>;
         fn MultiAddPubKeys(self: &CryptoContextDCRTPoly, publicKey1: &PublicKeyDCRTPoly,
-                           publicKey2: &PublicKeyDCRTPoly, keyId: &CxxString /* "" */)
+                           publicKey2: &PublicKeyDCRTPoly, keyId: /* "" */ &CxxString)
                            -> UniquePtr<PublicKeyDCRTPoly>;
         fn EvalMultKeyGen(self: &CryptoContextDCRTPoly, key: SharedPtr<PrivateKeyImpl>);
         fn EvalMultKeysGen(self: &CryptoContextDCRTPoly, key: SharedPtr<PrivateKeyImpl>);
         fn EvalRotateKeyGen(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>,
-                            indexList: &CxxVector<i32>, publicKey: SharedPtr<PublicKeyImpl>);
+                            indexList: &CxxVector<i32>,
+                            publicKey: /* null() */ SharedPtr<PublicKeyImpl>);
+        fn EvalAtIndexKeyGen(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>,
+                             indexList: &CxxVector<i32>,
+                             publicKey: /* null() */ SharedPtr<PublicKeyImpl>);
         fn EvalCKKStoFHEWPrecompute(self: &CryptoContextDCRTPoly, scale: /* 1.0 */ f64);
         fn MakePackedPlaintext(self: &CryptoContextDCRTPoly, value: &CxxVector<i64>,
                                noiseScaleDeg: /* 1 */ usize, level: /* 0 */ u32)
@@ -823,7 +827,7 @@ pub mod ffi
                             evalKey2: &EvalKeyDCRTPoly, keyId: /* "" */ &CxxString)
                             -> UniquePtr<EvalKeyDCRTPoly>;
         fn MultiMultEvalKey(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>,
-                            evalKey: &EvalKeyDCRTPoly, keyId: &CxxString /* "" */)
+                            evalKey: &EvalKeyDCRTPoly, keyId: /* "" */ &CxxString)
                             -> UniquePtr<EvalKeyDCRTPoly>;
         fn MultiAddEvalMultKeys(self: &CryptoContextDCRTPoly, evalKey1: &EvalKeyDCRTPoly,
                                 evalKey2: &EvalKeyDCRTPoly, keyId: /* "" */ &CxxString)