diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 58b9fd63c7baf51bc91cde8a1e8416b5ace8a218..bc62140e581297b27a1de76ce8a38d18ad6c7798 100755
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -12,44 +12,38 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="2624f523-8bdb-4867-a32b-0c8fa25f5cda" name="Default" comment="updates for microBench">
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Adult/FULL/Clean_Adult.py" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Adult/FULL/Split_Train_Test.py" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Adult/FULL/data-brute.txt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/Clean_Nursery.py" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/Split_Train_Test.py" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/data-brute.txt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Spam/Clean_Spam.py" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/DATA/Datasets/Spam/Split_Train_Test.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/CONFIG/DAPPLE.config" beforeDir="false" afterPath="$PROJECT_DIR$/CONFIG/DAPPLE.config" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Autism/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Autism/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/BANK2/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/BANK2/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Bank/LR/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Bank/LR/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Edin/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Edin/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Nursery/LR2/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/LR2/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Nursery/testing.enc" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/testing.enc" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Nursery/training.data" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Nursery/training.data" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Spam/Data-brute.txt" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Datasets/Spam/data-brute.txt" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Spam/result.data" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Spam/testing.data" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Datasets/Spam/training.data" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/DATA/Scripts/Clean_Bank.py" beforeDir="false" afterPath="$PROJECT_DIR$/DATA/Scripts/Clean_Bank.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/LIB/helib/HElib/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/LIB/helib/HElib/CMakeLists.txt" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/LIB/helib/HElib/examples/BGV_packed_arithmetic/BGV_packed_arithmetic.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/LIB/helib/HElib/examples/BGV_packed_arithmetic/BGV_packed_arithmetic.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h" beforeDir="false" afterPath="$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/LIB/helib/HElib/src/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/LIB/helib/HElib/src/Makefile" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/ML/IO/DatasetReader.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/ML/IO/DatasetReader.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/ML/LR/LR.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/ML/LR/LR.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/ML/LR/LR.h" beforeDir="false" afterPath="$PROJECT_DIR$/ML/LR/LR.h" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/PPML/PPLR/PPLR_Classifier.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/PPML/PPLR/PPLR_Classifier.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/PPML/PPVFDT/PPVFDT_Classifier.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/PPML/PPVFDT/PPVFDT_Classifier.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/DTPKC.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/DTPKC.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/DTPKC.h" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/DTPKC.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalAddPow2.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalAddPow2.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalCmp.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalCmp.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalCmp100.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalCmp100.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalDiv.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalDiv.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalDiv100.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalDiv100.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalDotProd.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalDotProd.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalEntropy.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalEntropy.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalExpo.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalExpo.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalHBound.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalHBound.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalLog.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalLog.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalLrUpdate.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalLrUpdate.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalMult.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalMult.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalProba.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalProba.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalSigmoid.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalSigmoid.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalSqrt.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalSqrt.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/EvalStandardDiv.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/EvalStandardDiv.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CRYPTO/SkeySwitch.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/CRYPTO/SkeySwitch.cpp" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/SER/dtpkc.ser" beforeDir="false" afterPath="$PROJECT_DIR$/SER/dtpkc.ser" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/TEST/TESTBuildingBlocks.h" beforeDir="false" afterPath="$PROJECT_DIR$/TEST/TESTBuildingBlocks.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/TEST/TESTElementaryOps.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/TEST/TESTElementaryOps.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/TEST/TESTElementaryOps.h" beforeDir="false" afterPath="$PROJECT_DIR$/TEST/TESTElementaryOps.h" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/TEST/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/TEST/main.cpp" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/UTIL/math_util.cc" beforeDir="false" afterPath="$PROJECT_DIR$/UTIL/math_util.cc" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/UTIL/math_util.hh" beforeDir="false" afterPath="$PROJECT_DIR$/UTIL/math_util.hh" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make" afterDir="false" />
     </list>
     <ignored path="$PROJECT_DIR$/cmake-build-debug/" />
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -81,125 +75,80 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/CONFIG/DAPPLE.config">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="195">
-              <caret line="13" column="25" lean-forward="true" selection-start-line="13" selection-start-column="25" selection-end-line="13" selection-end-column="25" />
+            <state relative-caret-position="255">
+              <caret line="17" column="39" selection-start-line="17" selection-start-column="39" selection-end-line="17" selection-end-column="39" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/TEST/main.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="150">
-              <caret line="321" column="38" selection-start-line="321" selection-start-column="22" selection-end-line="321" selection-end-column="38" />
+        <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:12:17-Stats.csv">
+          <provider selected="true" editor-type-id="csv-text-editor">
+            <state relative-caret-position="270">
+              <caret line="18" selection-start-line="18" selection-end-line="18" />
             </state>
           </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:45:01-Stats.csv">
           <provider editor-type-id="csv-table-editor">
             <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
           </provider>
-          <provider selected="true" editor-type-id="csv-text-editor">
-            <state relative-caret-position="45">
-              <caret line="3" selection-start-line="3" selection-end-line="3" />
-            </state>
-          </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/EXP/Tuning/NurseryVFDT-2020-01-23-14:56:17-Stats.csv">
-          <provider editor-type-id="csv-table-editor">
-            <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-          </provider>
-          <provider selected="true" editor-type-id="csv-text-editor">
-            <state relative-caret-position="150">
-              <caret line="10" column="9" selection-start-line="10" selection-start-column="9" selection-end-line="10" selection-end-column="9" />
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/training.data">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="540315">
+              <caret line="36021" column="33" selection-start-line="36021" selection-start-column="33" selection-end-line="36021" selection-end-column="33" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/training.data">
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/result.data">
           <provider selected="true" editor-type-id="text-editor" />
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/training.data">
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/testing.data">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="155505">
-              <caret line="10367" selection-start-line="6" selection-start-column="17" selection-end-line="10367" />
-            </state>
+            <state relative-caret-position="-5628" />
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/testing.data">
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/result.data">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="648">
-              <caret line="2591" selection-start-line="2591" selection-end-line="2591" />
-            </state>
+            <state relative-caret-position="-135303" />
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h">
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/testing.data">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="4215">
-              <caret line="281" column="31" selection-start-line="281" selection-start-column="25" selection-end-line="281" selection-end-column="31" />
-              <folding>
-                <element signature="e#7002#7110#0" />
-              </folding>
+            <state relative-caret-position="372">
+              <caret line="9045" selection-start-line="9045" selection-end-line="9045" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Iris/training.data">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="75">
-              <caret line="5" column="12" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="12" />
-            </state>
-          </provider>
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/DO_16.data">
+          <provider selected="true" editor-type-id="text-editor" />
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file:///usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="1260">
-              <caret line="84" selection-start-line="84" selection-end-line="84" />
-            </state>
-          </provider>
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/training.enc">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/testing.enc">
+          <provider selected="true" editor-type-id="text-editor" />
         </entry>
       </file>
     </leaf>
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
-      <find>delete</find>
-      <find>alpha</find>
-      <find>second</find>
-      <find>#pragma</find>
-      <find>#pragma omp parallel for</find>
-      <find>#pragma omp parallel</find>
-      <find>batchSize</find>
-      <find>train</find>
-      <find>int N=</find>
-      <find>testBuis</find>
-      <find>run</find>
-      <find>nb</find>
-      <find>lr</find>
-      <find>properties</find>
-      <find>-</find>
-      <find>set_tar</find>
-      <find>FLAGS</find>
-      <find>mavx</find>
-      <find>securi</find>
-      <find>find</find>
-      <find>BGV</find>
-      <find>CtxtPart</find>
-      <find>getPa</find>
       <find>get</find>
       <find>getPart</find>
       <find>slots</find>
@@ -207,6 +156,29 @@
       <find>size</find>
       <find>part</find>
       <find>parts</find>
+      <find>delay</find>
+      <find>run</find>
+      <find>deserialize</find>
+      <find>des</find>
+      <find>optim=</find>
+      <find>insert</find>
+      <find>return c</find>
+      <find>fast</find>
+      <find>mpz_class_powm</find>
+      <find>return;</find>
+      <find>ret</find>
+      <find>PSdec0</find>
+      <find>powm</find>
+      <find>expo</find>
+      <find>PSd</find>
+      <find>goto ret</find>
+      <find>PSdec</find>
+      <find>mult</find>
+      <find>base</find>
+      <find>mult =</find>
+      <find>enc</find>
+      <find>fastmul</find>
+      <find>fastpow</find>
     </findStrings>
     <replaceStrings>
       <replace>EvalCmp100</replace>
@@ -234,19 +206,13 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/CRYPTO/EvalExpo.cpp" />
-        <option value="$PROJECT_DIR$/Scripts/TestPPLR1.sh" />
-        <option value="$PROJECT_DIR$/PPML/EVAL/EvaluateClassification.py" />
         <option value="$PROJECT_DIR$/PPML/PPNB/PPNB_Classifier.h" />
         <option value="$PROJECT_DIR$/PPML/PPVFDT/PPNodeStats.h" />
-        <option value="$PROJECT_DIR$/CRYPTO/DTPKC.h" />
         <option value="$PROJECT_DIR$/EXP/DEBUG-LR2/NewDataset-2019-05-14-00:03:04-Config.txt" />
-        <option value="$PROJECT_DIR$/CRYPTO/DTPKC.cpp" />
         <option value="$PROJECT_DIR$/CRYPTO/SkeySwitch.cpp" />
         <option value="$PROJECT_DIR$/CRYPTO/EvalCmp.cpp" />
         <option value="$PROJECT_DIR$/CRYPTO/EvalDotProd.cpp" />
         <option value="$PROJECT_DIR$/CRYPTO/EvalMult.cpp" />
-        <option value="$PROJECT_DIR$/TEST/TESTElementaryOps.cpp" />
         <option value="$PROJECT_DIR$/PPML/PPNB/PPNB_Classifier.cpp" />
         <option value="$PROJECT_DIR$/PPML/PPVFDT/PPVFDT_Classifier.h" />
         <option value="$PROJECT_DIR$/PPML/PPVFDT/PPNodeTest.cpp" />
@@ -278,11 +244,17 @@
         <option value="$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-13:35:08-Stats.csv" />
         <option value="$PROJECT_DIR$/EXP/TESTS/cmpCiphermed-2019-05-13-00:04:05-Stats.csv" />
         <option value="$PROJECT_DIR$/ML/IO/DatasetReader.cpp" />
-        <option value="$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp" />
         <option value="$PROJECT_DIR$/LIB/helib/HElib/CMakeLists.txt" />
         <option value="$PROJECT_DIR$/CMakeLists.txt" />
         <option value="$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h" />
         <option value="$PROJECT_DIR$/LIB/helib/HElib/examples/BGV_packed_arithmetic/BGV_packed_arithmetic.cpp" />
+        <option value="$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp" />
+        <option value="$PROJECT_DIR$/TEST/TESTBuildingBlocks.h" />
+        <option value="$PROJECT_DIR$/CRYPTO/DTPKC.h" />
+        <option value="$PROJECT_DIR$/UTIL/math_util.hh" />
+        <option value="$PROJECT_DIR$/CRYPTO/DTPKC.cpp" />
+        <option value="$PROJECT_DIR$/UTIL/math_util.cc" />
+        <option value="$PROJECT_DIR$/TEST/TESTElementaryOps.cpp" />
         <option value="$PROJECT_DIR$/TEST/main.cpp" />
         <option value="$PROJECT_DIR$/CONFIG/DAPPLE.config" />
       </list>
@@ -299,7 +271,6 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
@@ -312,32 +283,6 @@
               <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
               <item name="CONFIG" type="462c0819:PsiDirectoryNode" />
             </path>
-            <path>
-              <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
-              <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
-              <item name="DATA" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
-              <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
-              <item name="DATA" type="462c0819:PsiDirectoryNode" />
-              <item name="Datasets" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
-              <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
-              <item name="DATA" type="462c0819:PsiDirectoryNode" />
-              <item name="Datasets" type="462c0819:PsiDirectoryNode" />
-              <item name="Nursery" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
-              <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
-              <item name="DATA" type="462c0819:PsiDirectoryNode" />
-              <item name="Datasets" type="462c0819:PsiDirectoryNode" />
-              <item name="Nursery" type="462c0819:PsiDirectoryNode" />
-              <item name="FULL" type="462c0819:PsiDirectoryNode" />
-            </path>
             <path>
               <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
               <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
@@ -347,7 +292,7 @@
               <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
               <item name="DAPPLE-2.0" type="462c0819:PsiDirectoryNode" />
               <item name="EXP" type="462c0819:PsiDirectoryNode" />
-              <item name="DSN" type="462c0819:PsiDirectoryNode" />
+              <item name="MANU" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
               <item name="DAPPLE" type="b2602c69:ProjectViewProjectNode" />
@@ -358,6 +303,7 @@
           <select />
         </subPane>
       </pane>
+      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -520,14 +466,10 @@
       <workItem from="1607311791427" duration="205000" />
       <workItem from="1607312826538" duration="2733000" />
       <workItem from="1613599933641" duration="3413000" />
-      <workItem from="1631024915961" duration="1155000" />
-    </task>
-    <task id="LOCAL-00053" summary="Testing PPNB">
-      <created>1553943203444</created>
-      <option name="number" value="00053" />
-      <option name="presentableId" value="LOCAL-00053" />
-      <option name="project" value="LOCAL" />
-      <updated>1553943203448</updated>
+      <workItem from="1631024915961" duration="6438000" />
+      <workItem from="1631320935146" duration="43534000" />
+      <workItem from="1631963023588" duration="9689000" />
+      <workItem from="1632009502288" duration="3197000" />
     </task>
     <task id="LOCAL-00054" summary="Added the LrUpdate building block and updated the sigmoid one.">
       <created>1554308558845</created>
@@ -865,11 +807,18 @@
       <option name="project" value="LOCAL" />
       <updated>1584352180251</updated>
     </task>
-    <option name="localTasksCounter" value="102" />
+    <task id="LOCAL-00102" summary="updates for microBench">
+      <created>1631050222333</created>
+      <option name="number" value="00102" />
+      <option name="presentableId" value="LOCAL-00102" />
+      <option name="project" value="LOCAL" />
+      <updated>1631050222337</updated>
+    </task>
+    <option name="localTasksCounter" value="103" />
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1455787000" />
+    <option name="totallyTimeSpent" value="1517490000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -881,23 +830,23 @@
     </todo-panel>
   </component>
   <component name="ToolWindowManager">
-    <frame x="0" y="25" width="1920" height="866" extended-state="6" />
+    <frame x="0" y="25" width="1920" height="856" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.8053333" visible="true" weight="0.21237993" />
+      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.8053333" visible="true" weight="0.21664888" />
       <window_info id="Structure" order="1" sideWeight="0.2735043" side_tool="true" weight="0.3390558" />
       <window_info id="Favorites" order="2" sideWeight="0.19466667" side_tool="true" weight="0.28113064" />
       <window_info anchor="bottom" id="Database Changes" order="0" />
       <window_info anchor="bottom" id="Message" order="1" />
       <window_info anchor="bottom" id="Find" order="2" sideWeight="0.49363586" weight="0.32506204" />
-      <window_info active="true" anchor="bottom" id="Run" order="3" sideWeight="0.6303265" visible="true" weight="0.37078652" />
-      <window_info anchor="bottom" id="Debug" order="4" sideWeight="0.5146652" weight="0.51884425" />
+      <window_info active="true" anchor="bottom" id="Run" order="3" sideWeight="0.6303265" visible="true" weight="0.30341882" />
+      <window_info anchor="bottom" id="Debug" order="4" sideWeight="0.5146652" weight="0.48005697" />
       <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="7" sideWeight="0.4986165" weight="0.32663316" />
-      <window_info anchor="bottom" id="Messages" order="8" sideWeight="0.43054786" weight="0.47191012" />
+      <window_info anchor="bottom" id="Messages" order="8" sideWeight="0.43054786" weight="0.47008547" />
       <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.4853348" side_tool="true" weight="0.5325048" />
-      <window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.50359714" weight="0.28915662" />
+      <window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.50359714" weight="0.2877493" />
       <window_info anchor="bottom" id="Version Control" order="11" sideWeight="0.4864416" weight="0.3190883" />
       <window_info anchor="bottom" id="CMake" order="12" sideWeight="0.7094632" weight="0.36324787" />
       <window_info anchor="bottom" id="ExcelReader" order="13" weight="0.32914573" />
@@ -1537,12 +1486,12 @@
         </line-breakpoint>
         <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
           <url>file://$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp</url>
-          <line>724</line>
+          <line>725</line>
           <option name="timeStamp" value="1019" />
         </line-breakpoint>
         <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
           <url>file://$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp</url>
-          <line>725</line>
+          <line>726</line>
           <option name="timeStamp" value="1020" />
         </line-breakpoint>
         <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
@@ -1555,20 +1504,295 @@
           <line>718</line>
           <option name="timeStamp" value="1024" />
         </line-breakpoint>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
           <url>file://$PROJECT_DIR$/TEST/TESTElementaryOps.cpp</url>
-          <line>178</line>
+          <line>214</line>
           <option name="timeStamp" value="1025" />
         </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h</url>
+          <line>206</line>
+          <option name="timeStamp" value="1027" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp</url>
+          <line>343</line>
+          <option name="timeStamp" value="1028" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>313</line>
+          <option name="timeStamp" value="1036" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>312</line>
+          <option name="timeStamp" value="1037" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>324</line>
+          <option name="timeStamp" value="1039" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>325</line>
+          <option name="timeStamp" value="1040" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>334</line>
+          <option name="timeStamp" value="1041" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>333</line>
+          <option name="timeStamp" value="1053" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>339</line>
+          <option name="timeStamp" value="1054" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>347</line>
+          <option name="timeStamp" value="1055" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>603</line>
+          <option name="timeStamp" value="1059" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>733</line>
+          <option name="timeStamp" value="1060" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>727</line>
+          <option name="timeStamp" value="1061" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>508</line>
+          <option name="timeStamp" value="1062" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>534</line>
+          <option name="timeStamp" value="1064" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>551</line>
+          <option name="timeStamp" value="1066" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>550</line>
+          <option name="timeStamp" value="1067" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>548</line>
+          <option name="timeStamp" value="1068" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>547</line>
+          <option name="timeStamp" value="1069" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>553</line>
+          <option name="timeStamp" value="1070" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>556</line>
+          <option name="timeStamp" value="1071" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>567</line>
+          <option name="timeStamp" value="1074" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>572</line>
+          <option name="timeStamp" value="1076" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>585</line>
+          <option name="timeStamp" value="1077" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>593</line>
+          <option name="timeStamp" value="1078" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>594</line>
+          <option name="timeStamp" value="1079" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>598</line>
+          <option name="timeStamp" value="1080" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>600</line>
+          <option name="timeStamp" value="1081" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>608</line>
+          <option name="timeStamp" value="1082" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>609</line>
+          <option name="timeStamp" value="1083" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>613</line>
+          <option name="timeStamp" value="1084" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>619</line>
+          <option name="timeStamp" value="1085" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>622</line>
+          <option name="timeStamp" value="1086" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>630</line>
+          <option name="timeStamp" value="1087" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>632</line>
+          <option name="timeStamp" value="1088" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>626</line>
+          <option name="timeStamp" value="1089" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>638</line>
+          <option name="timeStamp" value="1090" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>639</line>
+          <option name="timeStamp" value="1091" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>646</line>
+          <option name="timeStamp" value="1092" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>645</line>
+          <option name="timeStamp" value="1093" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>648</line>
+          <option name="timeStamp" value="1094" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>650</line>
+          <option name="timeStamp" value="1095" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>664</line>
+          <option name="timeStamp" value="1096" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>666</line>
+          <option name="timeStamp" value="1097" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>674</line>
+          <option name="timeStamp" value="1098" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>688</line>
+          <option name="timeStamp" value="1099" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>699</line>
+          <option name="timeStamp" value="1100" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>711</line>
+          <option name="timeStamp" value="1101" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>723</line>
+          <option name="timeStamp" value="1102" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>728</line>
+          <option name="timeStamp" value="1103" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>729</line>
+          <option name="timeStamp" value="1104" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>735</line>
+          <option name="timeStamp" value="1105" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>737</line>
+          <option name="timeStamp" value="1106" />
+        </line-breakpoint>
+        <line-breakpoint type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.cc</url>
+          <line>740</line>
+          <option name="timeStamp" value="1107" />
+        </line-breakpoint>
         <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
           <url>file://$PROJECT_DIR$/TEST/TESTElementaryOps.cpp</url>
-          <line>62</line>
-          <option name="timeStamp" value="1026" />
+          <line>106</line>
+          <option name="timeStamp" value="1113" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h</url>
-          <line>206</line>
-          <option name="timeStamp" value="1027" />
+          <url>file://$PROJECT_DIR$/TEST/TESTElementaryOps.cpp</url>
+          <line>108</line>
+          <option name="timeStamp" value="1114" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
+          <url>file://$PROJECT_DIR$/UTIL/math_util.hh</url>
+          <line>87</line>
+          <option name="timeStamp" value="1115" />
         </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/DATA/Scripts/Clean_Adult.py</url>
@@ -1616,348 +1840,278 @@
     </watches-manager>
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:46:25-ClassOutput.txt">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-5166">
-          <caret line="25" column="1" lean-forward="true" selection-start-line="25" selection-start-column="1" selection-end-line="25" selection-end-column="1" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/IRIS-2019-05-12-23:24:09-Config.txt">
-      <provider selected="true" editor-type-id="text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-11:58:41-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/BankNBCipher-2020-01-31-14:38:02-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-11:58:41-Config.txt">
-      <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-12:01:34-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/LR-2020-01-27-14:04:56-Config.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-12:06:54-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/BankNBCipher-2020-01-31-14:38:17-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="30">
-          <caret line="2" selection-start-line="2" selection-end-line="2" selection-end-column="66" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-12:01:34-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/LR-2020-01-27-14:04:56-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="15">
-          <caret line="1" selection-start-line="1" selection-end-line="1" selection-end-column="61" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-12:06:54-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/LR-adult-2020-01-28-14:57:27-Config.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-12-23:23:46-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/LR-adult-2020-01-28-14:57:34-Config.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/IRIS-2019-05-12-23:23:55-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/LR-adult-2020-01-29-09:28:22-Config.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DEBUG-VFDT/clear-2019-03-19-13:30:12-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/Report-BankNBCipher-2020-01-29-17:02:18-ClassOutput.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DEBUG-VFDT/clear-2019-03-19-13:27:35-Config.txt">
+    <entry file="file://$PROJECT_DIR$/EXP/micro/Report-LR-2020-01-27-14:04:56-ClassOutput.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DEBUG-VFDT/clear-2019-03-19-13:22:34-Config.txt">
-      <provider selected="true" editor-type-id="text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/cmpCiphermed-2019-05-13-00:04:05-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="45">
-          <caret line="3" selection-start-line="3" selection-end-line="3" />
+    <entry file="file://$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4875">
+          <caret line="325" column="27" selection-start-line="325" selection-start-column="17" selection-end-line="325" selection-end-column="27" />
+          <folding>
+            <element signature="e#0#31#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/cmpCiphermed-2019-05-13-00:04:05-Config.txt">
+    <entry file="file://$PROJECT_DIR$/CRYPTO/EvalCmp.cpp">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="60">
-          <caret line="4" column="22" selection-end-line="68" selection-end-column="2" />
+        <state relative-caret-position="300">
+          <caret line="20" selection-start-line="20" selection-end-line="20" />
+          <folding>
+            <element signature="e#0#17#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:54:41-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/big-2021-09-18-20:56:11-Stats.csv">
       <provider selected="true" editor-type-id="csv-text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:56:02-Stats.csv">
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:58:04-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/big-2021-09-18-20:56:11-Config.txt">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/cmake-build-debug/buildingblocks-Stats.csv">
       <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="30">
-          <caret line="2" selection-start-line="2" selection-end-line="2" />
+        <state relative-caret-position="240">
+          <caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
         </state>
       </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:59:02-Stats.csv">
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:59:56-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/DATA/CLEAN/autism_609_21.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="30">
-          <caret line="2" selection-start-line="2" selection-end-line="2" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-11:00:59-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/DATA/CLEAN/bank_45212_17.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="30">
-          <caret line="2" selection-start-line="2" selection-end-line="2" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-11:01:57-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
+    <entry file="file://$PROJECT_DIR$/DATA/CLEAN/nursery_12960_8.csv">
       <provider selected="true" editor-type-id="csv-text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-11:02:23-Stats.csv">
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-11:03:12-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/DATA/CLEAN/adult_45222_15.csv">
+      <provider selected="true" editor-type-id="csv-text-editor">
+        <state relative-caret-position="-1710" />
+      </provider>
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/edi-2020-12-01-11:17:45-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/DO_1.data">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-915" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="15">
-          <caret line="1" column="40" selection-start-line="1" selection-start-column="35" selection-end-line="1" selection-end-column="40" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/DO_2.data">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="585">
+          <caret line="100" selection-start-line="100" selection-end-line="100" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-13:35:08-Config.txt">
+    <entry file="file://$PROJECT_DIR$/Scripts/TestPPLR1.sh">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/TESTS/testingNB-2019-05-05-13:35:08-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="45">
-          <caret line="3" selection-start-line="3" selection-end-line="3" />
-        </state>
+    <entry file="file://$PROJECT_DIR$/Scripts/TestPPLR2.sh">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Scripts/TestPPNB.sh">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-165" />
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/edi-2020-12-01-11:17:45-Config.txt">
+    <entry file="file://$PROJECT_DIR$/Scripts/vary_cores.sh">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Scripts/vary_th.sh">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/ML/IO/DatasetReader.cpp">
+    <entry file="file://$PROJECT_DIR$/DATA/Scripts/CSV_Splitter.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="2685">
-          <caret line="179" column="15" selection-start-line="179" selection-start-column="15" selection-end-line="179" selection-end-column="15" />
+        <state relative-caret-position="15">
+          <caret line="1" column="14" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="100" />
+          <folding>
+            <element signature="e#178#187#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/edi-2020-12-01-11:15:01-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-00:59:24-Config.txt">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-00:59:24-Stats.csv">
       <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="15">
-          <caret line="1" column="40" selection-start-line="1" selection-start-column="36" selection-end-line="1" selection-end-column="40" />
+        <state relative-caret-position="30">
+          <caret line="2" lean-forward="true" selection-start-line="2" selection-end-line="2" />
         </state>
       </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-11:06:15-Stats.csv">
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="15">
-          <caret line="1" column="40" selection-start-line="1" selection-start-column="35" selection-end-line="1" selection-end-column="40" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/ML/NB/NB_Classifier.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="435">
-          <caret line="29" selection-start-line="29" selection-end-line="29" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/TEST/TESTBuildingBlocks.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="270">
-          <caret line="18" column="14" selection-start-line="18" selection-start-column="14" selection-end-line="18" selection-end-column="14" />
-          <folding>
-            <element signature="e#0#31#0" expanded="true" />
-          </folding>
-        </state>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:01:00-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
+      <provider editor-type-id="csv-table-editor">
+        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/CMakeLists.txt">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="285">
-          <caret line="19" column="8" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
-        </state>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:01:37-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
+      <provider editor-type-id="csv-table-editor">
+        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
+    <entry file="file://$PROJECT_DIR$/TEST/main.cpp">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="165">
-          <caret line="11" column="18" selection-start-line="11" selection-start-column="18" selection-end-line="11" selection-end-column="18" />
+        <state relative-caret-position="108">
+          <caret line="1358" column="12" selection-start-line="1358" selection-start-column="12" selection-end-line="1358" selection-end-column="12" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/examples/BGV_packed_arithmetic/BGV_packed_arithmetic.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="420">
-          <caret line="28" column="25" selection-start-line="28" selection-start-column="16" selection-end-line="28" selection-end-column="25" />
-        </state>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:02:20-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
+      <provider editor-type-id="csv-table-editor">
+        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/Tuning/_NurseryVFDT-2020-01-23-15:38:20-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/DSN/big-2021-02-17-22:21:22-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/examples/tests/BGV_packed_arithmetic.bats">
+    <entry file="file://$PROJECT_DIR$/EXP/DSN/big-2021-09-16-21:49:25-Config.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/examples/BGV_country_db_lookup/BGV_country_db_lookup.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="2025">
-          <caret line="135" column="31" selection-start-line="135" selection-start-column="31" selection-end-line="135" selection-end-column="31" />
-        </state>
-      </provider>
+    <entry file="file://$PROJECT_DIR$/EXP/DSN/big-2021-09-16-21:40:47-Config.txt">
+      <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/src/Ctxt.cpp">
+    <entry file="file://$PROJECT_DIR$/EXP/DSN/big-2021-09-16-17:16:36-Config.txt">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/EXP/DEBUG-VFDT/cipher-2019-03-18-09:37:34-Config.txt">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1380">
-          <caret line="92" column="9" selection-start-line="92" selection-start-column="4" selection-end-line="92" selection-end-column="9" />
-          <folding>
-            <element signature="e#3648#5151#0" />
-          </folding>
+        <state relative-caret-position="285">
+          <caret line="19" column="22" lean-forward="true" selection-start-line="18" selection-end-line="24" selection-end-column="22" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/big-2021-02-17-22:21:22-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:05:07-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="30">
-          <caret line="2" selection-end-line="2" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/DSN/cmpCiphermed-2020-12-01-10:45:01-Stats.csv">
-      <provider editor-type-id="csv-table-editor">
-        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
-      </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="45">
-          <caret line="3" selection-start-line="3" selection-end-line="3" />
+    <entry file="file://$PROJECT_DIR$/EXP/DEBUG-VFDT/cipher-2019-03-18-09:36:50-Config.txt">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="315">
+          <caret line="33" column="18" selection-start-line="29" selection-start-column="4" selection-end-line="33" selection-end-column="26" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/EXP/Tuning/NurseryVFDT-2020-01-23-14:56:17-Stats.csv">
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:07:28-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor" />
       <provider editor-type-id="csv-table-editor">
         <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
       </provider>
-      <provider selected="true" editor-type-id="csv-text-editor">
-        <state relative-caret-position="150">
-          <caret line="10" column="9" selection-start-line="10" selection-start-column="9" selection-end-line="10" selection-end-column="9" />
-        </state>
-      </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/training.data">
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:07:28-ClassOutput.txt">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/training.data">
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/training.data">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="155505">
-          <caret line="10367" selection-start-line="6" selection-start-column="17" selection-end-line="10367" />
+        <state relative-caret-position="540315">
+          <caret line="36021" column="33" selection-start-line="36021" selection-start-column="33" selection-end-line="36021" selection-end-column="33" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/LIB/helib/HElib/include/helib/Ctxt.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="4215">
-          <caret line="281" column="31" selection-start-line="281" selection-start-column="25" selection-end-line="281" selection-end-column="31" />
-          <folding>
-            <element signature="e#7002#7110#0" />
-          </folding>
-        </state>
-      </provider>
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/result.data">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/training.enc">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/testing.enc">
+      <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Iris/training.data">
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/testing.data">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="75">
-          <caret line="5" column="12" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="12" />
-        </state>
+        <state relative-caret-position="-5628" />
       </provider>
     </entry>
-    <entry file="file:///usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h">
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/result.data">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1260">
-          <caret line="84" selection-start-line="84" selection-end-line="84" />
-        </state>
+        <state relative-caret-position="-135303" />
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Nursery/FULL/testing.data">
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/testing.data">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="648">
-          <caret line="2591" selection-start-line="2591" selection-end-line="2591" />
+        <state relative-caret-position="372">
+          <caret line="9045" selection-start-line="9045" selection-end-line="9045" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/TEST/main.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="150">
-          <caret line="321" column="38" selection-start-line="321" selection-start-column="22" selection-end-line="321" selection-end-column="38" />
+    <entry file="file://$PROJECT_DIR$/DATA/Datasets/Adult/FULL/DO_16.data">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/EXP/MANU/fullPlainAdult-2021-09-19-01:12:17-Stats.csv">
+      <provider selected="true" editor-type-id="csv-text-editor">
+        <state relative-caret-position="270">
+          <caret line="18" selection-start-line="18" selection-end-line="18" />
         </state>
       </provider>
+      <provider editor-type-id="csv-table-editor">
+        <state showInfoPanel="true" fixedHeaders="false" rowLines="3" />
+      </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/CONFIG/DAPPLE.config">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="195">
-          <caret line="13" column="25" lean-forward="true" selection-start-line="13" selection-start-column="25" selection-end-line="13" selection-end-column="25" />
+        <state relative-caret-position="255">
+          <caret line="17" column="39" selection-start-line="17" selection-start-column="39" selection-end-line="17" selection-end-column="39" />
         </state>
       </provider>
     </entry>
diff --git a/CONFIG/DAPPLE.config b/CONFIG/DAPPLE.config
index 3118e9b505c6eca41ed3b7dfe26e6fe883ff85f8..2c12e8e4cb52ce79186666a4f2d5bce24fde7652 100755
--- a/CONFIG/DAPPLE.config
+++ b/CONFIG/DAPPLE.config
@@ -1,39 +1,40 @@
 # Experiments parameters
  perf{
-      testBuildingBlocks="true";
+      testBuildingBlocks="false";
       PrivacyPreservation="true";
       microBench="false";
       MLAlgorithm="vfdt";
       runs_number ="1";
       thread_number="14";
       remoteClient="false";
-      Incremental="false";
-      OutputPath="/home/rania/CLionProjects/DAPPLE-2.0/EXP/DSN/";
-      scenarioName ="big";
-      debug="false";
-      maxTrainSize="100";
-      maxTestSize="400";
+      Incremental="true";
+      OutputPath="/home/rania/CLionProjects/DAPPLE-2.0/EXP/MANU/";
+      scenarioName ="fullCipherAdult";
+      debug="true";
+      maxTrainSize="2261";
+      maxTestSize="500";
  }
 
  # The dataset configuration parameters
  dataset{
      mainPath = "/home/rania/CLionProjects/DAPPLE-2.0/";
-     path="/home/rania/CLionProjects/DAPPLE-2.0/DATA/Datasets/Nursery/FULL/";
-     clearPath= "/home/rania/CLionProjects/DAPPLE-2.0/DATA/Datasets/Nursery/FULL/";
+     path="/home/rania/CLionProjects/DAPPLE-2.0/DATA/Datasets/Adult/FULL/";
+     clearPath= "/home/rania/CLionProjects/DAPPLE-2.0/DATA/Datasets/Adult/FULL/";
      chunk_prefix="DO";
      class_number="2";
-     dimension="9";
+     dimension="16";
      chunk_number="1";
  }
 
  # The vfdt algorithm parameters
  vfdt{
+
      delta="0.000001";
      tau="1";
      grace="50";
-     max_depth="10";
-     threshold_number="3";
-     maxNodes="60";
+     max_depth="30";
+     threshold_number="2";
+     maxNodes="1000";
  }
 
  # DTPKC parameters
diff --git a/CRYPTO/DTPKC.cpp b/CRYPTO/DTPKC.cpp
index c641e37665640c47b8e4dd26b5d4e6ade20d5828..8edec1721757d16fcf654c93aabae39400da7711 100755
--- a/CRYPTO/DTPKC.cpp
+++ b/CRYPTO/DTPKC.cpp
@@ -12,9 +12,10 @@
 
 #include <thread>
 #include "DTPKC.h"
+#include "../UTIL/math_util.hh"
 
 
-mpz_class DTPKC :: n,DTPKC :: g, DTPKC :: n2, DTPKC :: pkw;
+mpz_class DTPKC :: n,DTPKC :: g, DTPKC :: n2, DTPKC :: pkw, DTPKC:: randomR, DTPKC:: randomGR, DTPKC::powPK;
 int DTPKC :: size;
 mpz_class DTPKC :: p, DTPKC :: q, DTPKC :: a, DTPKC :: SK, DTPKC :: SK0, DTPKC :: SK1;
 int DTPKC :: blindVal;
@@ -24,6 +25,11 @@ double DTPKC:: timeSU;
 double DTPKC:: bdwMU;
 double DTPKC:: bdwSU;
 int DTPKC::cmpCtr;
+bool  DTPKC::optim;
+
+
+mpz_class DTPKC :: R1, DTPKC :: R2, DTPKC :: R3, DTPKC :: R4;
+Cipher DTPKC :: CR1, DTPKC :: CR2, DTPKC :: CR3, DTPKC :: CR4;
 
 
 std::chrono::milliseconds DTPKC :: delay;
@@ -51,7 +57,7 @@ std::chrono::milliseconds DTPKC :: delay;
 **/
 
 void
-DTPKC::keygen(int pr, gmp_randstate_t state, std::chrono::milliseconds delay,  uint nbits, int error, bool useORE, int bl)
+DTPKC::keygen(int pr, gmp_randstate_t state, std::chrono::milliseconds delay,  uint nbits, int error, bool optim, int bl)
 {
     precision=pr;
     DTPKC::timeMU = 0.0;
@@ -69,6 +75,7 @@ DTPKC::keygen(int pr, gmp_randstate_t state, std::chrono::milliseconds delay,  u
     mpz_class  s, tita,invlambda;
     size = nbits;
     DTPKC::delay = delay;
+    DTPKC::optim = optim;
 
     bool valid = false;
     do {
@@ -126,8 +133,29 @@ DTPKC::keygen(int pr, gmp_randstate_t state, std::chrono::milliseconds delay,  u
 
         if ( Sdec(inter) == 0 ) valid = true;
 
+
+        gmp_randstate_t state;
+
+        // Generate a random nupmber r
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state,time(NULL));
+        randomR=mpz_class_get_z_bits(size);
+        gmp_randclear(state);
+
+        randomGR=mpz_class_powm (g,randomR,n2);
+
+        powPK=mpz_class_powm (pkw,randomR,n2);
+
     }while(!valid);
+    R1= mpz_class_get_z_bits(blindVal);
+    R2= mpz_class_get_z_bits(blindVal);
+    R3= mpz_class_get_z_bits(blindVal);
+    R4= mpz_class_get_z_bits(blindVal);
 
+    CR1 = enc(R1, pkw);
+    CR2 = enc(R2, pkw);
+    CR3 = enc(R3, pkw);
+    CR4 = enc(R4, pkw);
 
 
 }
@@ -161,24 +189,40 @@ Cipher DTPKC :: enc(mpz_class plaintext, mpz_class pkey)
 
     gmp_randstate_t state;
     mpz_class pkeyPowR, r ;
+    Cipher c;
+
+    if (!optim) {
+
+        // Generate a random nupmber r
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state,time(NULL));
+        r = mpz_class_get_z_bits(size);
+        gmp_randclear(state);
+        c.T2=mpz_class_powm (g,r,n2);
+        pkeyPowR=mpz_class_powm (pkey,r,n2);
+        c.T1 = (((1+plaintext*n))*(pkeyPowR))%n2;
+    }
+    else {
+        r = randomR;
+        c.T2=randomGR;
+        pkeyPowR = powPK;
+        mpz_class inter = (1+plaintext*n);
+        fastmul(c.T1, inter , (pkeyPowR) );
+        c.T1 =   c.T1 % n2;
+    }
 
-    // Generate a random nupmber r
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(size);
-    gmp_randclear(state);
 
     // Initialize the cipher
-    Cipher c;
+
 
     //  Compute power ( g, r*tita )  mod N square
-    pkeyPowR=mpz_class_powm (pkey,r,n2);
+
 
     // (T1=  g, r*tita )  mod N square * (1+mN))mod N square
-    c.T1 = (((1+plaintext*n))*(pkeyPowR))%n2;
+
 
     // T2 = power (g, r) mod N square
-    c.T2=mpz_class_powm (g,r,n2);
+
 
     // Set the public key
     c.Pub=pkey;
@@ -363,7 +407,15 @@ DTPKC::PSdec0(Cipher c)
 {
    // pc : partial cipher
    Cipher pc;
-   pc.T1= mpz_class_powm(c.T1,SK0,n2);
+   if (!optim)
+   {
+       //pc.T1= mpz_class_powm(c.T1,SK0,n2);
+       fastpow2(pc.T1, c.T1,SK0, n2);
+   }else
+   {
+       fastpow(pc.T1, c.T1,SK0, n2);
+   }
+
    pc.T2=c.T2;
    pc.Pub=c.Pub;
 
@@ -396,11 +448,23 @@ mpz_class
 DTPKC::PSdec1(Cipher c,Cipher pc)
 {
     // pc2 : partial cipher  2
-    mpz_class pc2;
-    pc2=mpz_class_powm(c.T1,SK1,n2);
+    mpz_class pc2, res ;
+    if (!optim ) {
+     //   pc2 = mpz_class_powm(c.T1, SK1, n2);
+     //   res = pc2 * pc.T1;
 
-    return L(pc2*pc.T1);
+        fastpow2(pc2, c.T1, SK1, n2);
 
+        fastmul2(res, pc2, pc.T1);
+
+    }
+    else {
+        fastpow(pc2, c.T1, SK1, n2);
+
+        fastmul(res, pc2, pc.T1);
+
+    }
+    return L(res);
 }
 
 /**
@@ -832,3 +896,18 @@ std::vector<mpz_class> DTPKC::Unpackdec(Cipher c, int slot, int sep) {
 
     return unpack(tmp, slot, sep);
 }
+
+
+/*std::map<mpz_class, mpz_class> DTPKC::precompute(mpz_class g, int size) {
+
+    std :: map <mpz_class,mpz_class> precompute;
+
+    for (mpz_class i=0;i<size+1;i++)
+    {
+        precompute.insert(std::make_pair(i,));
+    }
+
+
+    return precompute;
+
+}*/
\ No newline at end of file
diff --git a/CRYPTO/DTPKC.h b/CRYPTO/DTPKC.h
index b80992332a1206a26dd22489aa8611c78cee908d..d37f192412d62e9785400fe962862f90ca5f6261 100755
--- a/CRYPTO/DTPKC.h
+++ b/CRYPTO/DTPKC.h
@@ -23,6 +23,7 @@
 #include <fstream>
 #include <netinet/in.h>
 #include <chrono>
+#include <map>
 
 
 using namespace std;
@@ -110,7 +111,7 @@ public :
      */
 
     public :
-            static mpz_class n, g, n2, pkw;
+            static mpz_class n, g, n2, pkw, randomR, randomGR, powPK;
             static int size;
             static int blindVal;
             static  int precision;
@@ -121,9 +122,13 @@ public :
             static double bdwSU;
             static double bdwMU;
             static int cmpCtr;
+            static bool optim;
 
 
-    private :
+            static mpz_class R1, R2, R3, R4;
+            static Cipher CR1, CR2, CR3, CR4;
+
+private :
             static mpz_class p, q, a, SK, SK0, SK1;
 
      /******* Functions **********/
@@ -197,7 +202,8 @@ public :
 public :
     static std::vector<mpz_class> unpack(mpz_class c, int slot, int sep);
 
-
+//public :
+//    static std::map <mpz_class, mpz_class > precompute(mpz_class g, int size);
 
 };
 
diff --git a/CRYPTO/EvalAddPow2.cpp b/CRYPTO/EvalAddPow2.cpp
index a0c67e3335582399f1b5e3d9419381002319ab63..e8e3ca55906361b1b11d545fca37c8d4f9a76f17 100755
--- a/CRYPTO/EvalAddPow2.cpp
+++ b/CRYPTO/EvalAddPow2.cpp
@@ -30,12 +30,20 @@ EvalAddPow2::EvalAddPow2_U1_step1()
     std::vector <Cipher> res(4);
 
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
 
-    S1=dtpkc.enc(r,A.Pub);
+    if(!dtpkc.optim) {
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state,time(NULL));
+        gmp_randclear(state);
+        S1=dtpkc.enc(r,A.Pub);
+    } else {
+        r = dtpkc.R1;
+        S1=dtpkc.CR1;
+    }
+
+
+
 
     // B + r
     S2.T1= S1.T1*B.T1;
@@ -95,8 +103,11 @@ Cipher EvalAddPow2::EvalAddPow2_U1_step3(Cipher res2)
     S4.T1 = A.T1 * res2.T1;
     S4.T2 = A.T2 * res2.T2;
 
+        if(!dtpkc.optim)
+            C_R =  dtpkc.enc(r, A.Pub);
+        else
+            C_R = dtpkc.CR1;
 
-        C_R =  dtpkc.enc(r, A.Pub);
         S5.T1=mpz_class_powm( C_R.T1,dtpkc.n-r,dtpkc.n2);
         S5.T2=mpz_class_powm( C_R.T2,dtpkc.n-r,dtpkc.n2);
         S5.Pub = A.Pub;
diff --git a/CRYPTO/EvalCmp.cpp b/CRYPTO/EvalCmp.cpp
index 334100361cff4c9107aaf4d13fd6facb3af3eeb0..4d2aac8f5494ab0128ae6330b4a7ba6c449fddb4 100755
--- a/CRYPTO/EvalCmp.cpp
+++ b/CRYPTO/EvalCmp.cpp
@@ -18,14 +18,21 @@ EvalCmp::EvalCmp_U1_step1() {
     Cipher S1, S2, S3, S4;
     std::vector<Cipher> res(4);
 
-
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state, time(NULL));
-
-    r = mpz_class_get_z_bits(dtpkc.blindVal);
-    r2 = mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
-    Cipher C_R = dtpkc.enc(r2, A.Pub);
+    Cipher C_R;
+
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        r2 = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+        C_R = dtpkc.enc(r2, A.Pub);
+    }else{
+        r = dtpkc.R1;
+        r2 = dtpkc.R2;
+        C_R = dtpkc.CR2;
+    }
 
 //#pragma omp sections
     {
diff --git a/CRYPTO/EvalCmp100.cpp b/CRYPTO/EvalCmp100.cpp
index e30c3bce29abe13d66282ed7a7ab5473c95b17bc..e0e7db3c0683ab1b33ab0af10ec203aa5e8e5767 100755
--- a/CRYPTO/EvalCmp100.cpp
+++ b/CRYPTO/EvalCmp100.cpp
@@ -20,13 +20,21 @@ EvalCmp100::EvalCmp_U1_step1() {
     std::vector<Cipher> res(4);
 
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state, time(NULL));
-
-    r = mpz_class_get_z_bits(dtpkc.blindVal);
-    r2 = mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
-    Cipher C_R = dtpkc.enc(r2, A.Pub);
+    Cipher C_R;
+
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        r2 = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+        C_R = dtpkc.enc(r2, A.Pub);
+    }else{
+        r = dtpkc.R1;
+        r2 = dtpkc.R2;
+        C_R = dtpkc.CR2;
+    }
 
             S1.T1 = mpz_class_powm(A.T1, r*100, dtpkc.n2);
             S1.T2 = mpz_class_powm(A.T2, r*100, dtpkc.n2);
diff --git a/CRYPTO/EvalDiv.cpp b/CRYPTO/EvalDiv.cpp
index d7842b2f78b090f2ebf65daac32d5a3f85289f0d..bdf4c031e1dc5fcbf2856b8759597adf5e617308 100755
--- a/CRYPTO/EvalDiv.cpp
+++ b/CRYPTO/EvalDiv.cpp
@@ -71,11 +71,19 @@ EvalDiv ::EvalDiv_U1_step1()
     Cipher S1, S2,S3, S4, S5, S6, S7, S8, S9;
 
     // Generate two random numbers : used for multiplicative cryptographic blinding
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    rx=mpz_class_get_z_bits(dtpkc.blindVal);
-    ry=mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
+
+    if(!dtpkc.optim) {
+
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        rx = mpz_class_get_z_bits(dtpkc.blindVal);
+        ry = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+    }
+    else{
+        rx = dtpkc.R1;
+        ry = dtpkc.R2;
+    }
 
     S1.T1=mpz_class_powm(a.T1,rx,dtpkc.n2);
     S1.T2=mpz_class_powm(a.T2,rx,dtpkc.n2);
@@ -179,7 +187,11 @@ EvalDiv ::EvalDiv_U1_step3(Cipher S7)
     Cipher S8, S88, S9;
 
     // encrypt ry
-    S8 = dtpkc.enc(ry,a.Pub);
+    if(!dtpkc.optim) {
+        S8 = dtpkc.enc(ry,a.Pub);
+    }else{
+        S8 = dtpkc.CR2;
+    }
 
     // compute -ry
     S88.T1=mpz_class_powm(S8.T1,dtpkc.n-1,dtpkc.n2);
diff --git a/CRYPTO/EvalDiv100.cpp b/CRYPTO/EvalDiv100.cpp
index 84c1c387c564955bfa863271a6c1f8e8184f2da2..d4b3f8f4e34b230c3314f2db735743958d02b736 100755
--- a/CRYPTO/EvalDiv100.cpp
+++ b/CRYPTO/EvalDiv100.cpp
@@ -18,14 +18,20 @@ EvalDiv100 ::EvalDiv_U1_step1()
     gmp_randstate_t state;
     Cipher S1, S2,S3, S4, S5, S6, S7, S8, S9;
 
-
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-
-    rx=mpz_class_get_z_bits(dtpkc.blindVal);
-    ry=mpz_class_get_z_bits(dtpkc.blindVal);
-
-    gmp_randclear(state);
+    // Generate two random numbers : used for multiplicative cryptographic blinding
+
+    if(!dtpkc.optim) {
+
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        rx = mpz_class_get_z_bits(dtpkc.blindVal);
+        ry = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+    }
+    else{
+        rx = dtpkc.R1;
+        ry = dtpkc.R2;
+    }
 
     S2.T1=mpz_class_powm(a.T1,rx,dtpkc.n2);
     S2.T2=mpz_class_powm(a.T2,rx,dtpkc.n2);
diff --git a/CRYPTO/EvalDotProd.cpp b/CRYPTO/EvalDotProd.cpp
index 0ecdb128657d0f6938c1de6ac6e015f9a7b7c90a..010dfe3abb5bc7d8e928319d3f19c04dab6accf5 100755
--- a/CRYPTO/EvalDotProd.cpp
+++ b/CRYPTO/EvalDotProd.cpp
@@ -20,13 +20,21 @@ std::vector<Cipher> EvalDotProd::EvalDotProd_U1_step1()
     gmp_randstate_t state;
     std::vector<Cipher> res;
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    r1=mpz_class_get_z_bits(dtpkc.blindVal);
-    r2=mpz_class_get_z_bits(dtpkc.blindVal);
+        r1 = mpz_class_get_z_bits(dtpkc.blindVal);
+        r2 = mpz_class_get_z_bits(dtpkc.blindVal);
 
-    gmp_randclear(state);
+        gmp_randclear(state);
+    }else{
+
+
+        r1 = dtpkc.R1;
+        r2 = dtpkc.R2;
+
+    }
 
     for (int i=0; i< size ; i++)
     {
@@ -70,7 +78,12 @@ Cipher EvalDotProd::EvalDotProd_U2_step2(std::vector<Cipher> val)
     gmp_randinit_default(state);
     gmp_randseed_ui(state,time(NULL));
 
-    r3=mpz_class_get_z_bits(dtpkc.blindVal);
+    if(!dtpkc.optim) {
+        r3 = mpz_class_get_z_bits(dtpkc.blindVal);
+    }
+    else{
+        r3 = dtpkc.R3;
+    }
 
     gmp_randclear(state);
 
diff --git a/CRYPTO/EvalEntropy.cpp b/CRYPTO/EvalEntropy.cpp
index c63eaec140dfb191c8e7772bf268330fe7aef0df..b6373a6d40cf4530df026fc1c35082e25be57d33 100755
--- a/CRYPTO/EvalEntropy.cpp
+++ b/CRYPTO/EvalEntropy.cpp
@@ -67,13 +67,21 @@ EvalEntropy::EvalEntropy_U1_step1()
 
 
     // Generate two random numbers : used for multiplicative cryptographic blinding
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
 
-    rx=mpz_class_get_z_bits(dtpkc.blindVal);
-    ry=mpz_class_get_z_bits(dtpkc.blindVal);
 
-    gmp_randclear(state);
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state,time(NULL));
+        rx = mpz_class_get_z_bits(dtpkc.blindVal);
+        ry = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+    }
+    else{
+        rx = dtpkc.R1;
+        ry = dtpkc.R2;
+    }
+
+
 
     // -rx*T
     S1.T1=mpz_class_powm(T.T1,rx,dtpkc.n2);
diff --git a/CRYPTO/EvalExpo.cpp b/CRYPTO/EvalExpo.cpp
index 3222a16de687a01e4d54f36406bddb7b470c499d..98b2af1a931a9232a875eb72651c5a7efda300dd 100755
--- a/CRYPTO/EvalExpo.cpp
+++ b/CRYPTO/EvalExpo.cpp
@@ -19,13 +19,19 @@ EvalExpo::EvalSig_U1_step1()
     gmp_randstate_t state;
     Cipher S1, S2;
 
+    if(!dtpkc.optim) {
     gmp_randinit_default(state);
     gmp_randseed_ui(state,time(NULL));
-
     r=mpz_class_get_z_bits(300);
-
     gmp_randclear(state);
 
+    }
+    else{
+
+        r = dtpkc.R1;
+
+    }
+
     Cipher C_R = dtpkc.enc(mpz_class_log(r,1),u.Pub);
 
     //cout << "C_R" << C_R << endl;
diff --git a/CRYPTO/EvalHBound.cpp b/CRYPTO/EvalHBound.cpp
index 179775ead18b3df4d8ea8752304887a9d38214ba..733ebc634793d396e71b80f5307ff2f3a0ba8046 100755
--- a/CRYPTO/EvalHBound.cpp
+++ b/CRYPTO/EvalHBound.cpp
@@ -59,12 +59,15 @@ std::vector<Cipher> EvalHBound::EvalHBound_U1_step1()
     gmp_randstate_t state;
     Cipher S1, S11,S2;
 
-
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-
-    gmp_randclear(state);
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+    }else{
+
+        r = dtpkc.R1;
+    }
 
     EvalDiv evalDiv(a,b,dtpkc);
     std::vector <Cipher> res = evalDiv.EvalDiv_U1_step1();
diff --git a/CRYPTO/EvalLog.cpp b/CRYPTO/EvalLog.cpp
index bf87254b956cc24d9985f0bcae0c87e9ac02475e..6c97492baeff5f6de56a5561bc139626fc6efd58 100755
--- a/CRYPTO/EvalLog.cpp
+++ b/CRYPTO/EvalLog.cpp
@@ -26,14 +26,16 @@ EvalLog::EvalLog_U1_step1()
     u.T2 = u.T2 * one.T2;
 
     //cout << u << endl;
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-
-    r=mpz_class_get_z_bits(200);
-
-    gmp_randclear(state);
+        r = mpz_class_get_z_bits(200);
 
+        gmp_randclear(state);
+    }else{
+        r = dtpkc.R1;
+    }
 
     S1.T1= mpz_class_powm(u.T1,r,dtpkc.n2);
     S1.T2= mpz_class_powm(u.T2,r,dtpkc.n2);
diff --git a/CRYPTO/EvalLrUpdate.cpp b/CRYPTO/EvalLrUpdate.cpp
index 4b7fad45e84ee535b92d5f1b32a603cb5cd14198..cd9dc61f6383aa22c2998e4f15b15a92e3f15749 100755
--- a/CRYPTO/EvalLrUpdate.cpp
+++ b/CRYPTO/EvalLrUpdate.cpp
@@ -20,15 +20,18 @@ std::vector<Cipher> EvalLrUpdate::EvalLrUpdate_U1_step1()
 
     gmp_randstate_t state;
     std::vector<Cipher> res;
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-
-    r1=mpz_class_get_z_bits(dtpkc.blindVal);
-    r2=mpz_class_get_z_bits(dtpkc.blindVal);
-
-    gmp_randclear(state);
+        r1 = mpz_class_get_z_bits(dtpkc.blindVal);
+        r2 = mpz_class_get_z_bits(dtpkc.blindVal);
 
+        gmp_randclear(state);
+    }else{
+        r1 = dtpkc.R1;
+        r2 = dtpkc.R2;
+    }
     for (int i=0; i< a.size(); i++){
         Cipher inter, inter2;
 
diff --git a/CRYPTO/EvalMult.cpp b/CRYPTO/EvalMult.cpp
index 123d10d2fe25fd291b1675406d73ef9dc725c048..57f8b991015bcd2723c460e427403644780e839e 100755
--- a/CRYPTO/EvalMult.cpp
+++ b/CRYPTO/EvalMult.cpp
@@ -62,13 +62,18 @@ EvalMult::EvalMult_U1_step1()
     std::vector <Cipher> res(4);
 
     // Generate the blinding value
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
-
-    S1=dtpkc.enc(r,A.Pub);
-
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+
+        S1 = dtpkc.enc(r, A.Pub);
+    }else{
+
+        r = dtpkc.R1;
+        S1 = dtpkc.CR1;
+    }
     // A + r
     S2.T1= S1.T1*A.T1;
     S2.T2= S1.T1*A.T2;
diff --git a/CRYPTO/EvalProba.cpp b/CRYPTO/EvalProba.cpp
index fcfcfdfbc90d918a5196aed910c979e2a25e9778..b158010df7a0a44a3aad45ce9aea03b71f8cbb45 100755
--- a/CRYPTO/EvalProba.cpp
+++ b/CRYPTO/EvalProba.cpp
@@ -18,14 +18,17 @@ EvalProba::EvalProba_U1_step1()
 
     std::vector<Cipher> S6K (Tk.size()*2);
 
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
 
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-
-    gmp_randclear(state);
+        gmp_randclear(state);
 
+    }else{
+        r = dtpkc.R1;
+    }
     for (int i=0;i<Tk.size();i++)
     {
 
diff --git a/CRYPTO/EvalSigmoid.cpp b/CRYPTO/EvalSigmoid.cpp
index 1f9ae6b84763f86a25eed68c6c4d6735535c2937..98204020daa73853480d29ce74567f50083905be 100755
--- a/CRYPTO/EvalSigmoid.cpp
+++ b/CRYPTO/EvalSigmoid.cpp
@@ -18,14 +18,16 @@ EvalSigmoid::EvalSig_U1_step1()
 
     gmp_randstate_t state;
     Cipher S1, S2;
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-
-    r=mpz_class_get_z_bits(300);
-
-    gmp_randclear(state);
+        r = mpz_class_get_z_bits(300);
 
+        gmp_randclear(state);
+    }else{
+        r = dtpkc.R1;
+    }
     Cipher C_R = dtpkc.enc(mpz_class_log(r,1),u.Pub);
 
     //cout << "C_R" << C_R << endl;
diff --git a/CRYPTO/EvalSqrt.cpp b/CRYPTO/EvalSqrt.cpp
index 9ddc9cdcac32fcdbed65da9c4d00764e8af27324..161169adf41b5d4077cea63833e353d33e6480ec 100755
--- a/CRYPTO/EvalSqrt.cpp
+++ b/CRYPTO/EvalSqrt.cpp
@@ -58,14 +58,16 @@ std::vector<Cipher>  EvalSqrt::EvalHBound_U1_step1()
     gmp_randstate_t state;
     Cipher S1, S11,S2;
 
+    if(!dtpkc.optim) {
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
 
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-
-    gmp_randclear(state);
-
+        gmp_randclear(state);
 
+    }else{
+        r = dtpkc.R1;
+    }
 
     S11.T1=mpz_class_powm(a.T1,r,dtpkc.n2);
     S11.T2=mpz_class_powm(a.T2,r,dtpkc.n2);
diff --git a/CRYPTO/EvalStandardDiv.cpp b/CRYPTO/EvalStandardDiv.cpp
index 81381d18526b4504faf3c084b3ba944f0bc40115..ac8acfc6a4a7083862d9c5c6bdaa6160f7e25e6d 100755
--- a/CRYPTO/EvalStandardDiv.cpp
+++ b/CRYPTO/EvalStandardDiv.cpp
@@ -32,11 +32,15 @@ std::vector<Cipher> EvalStandardDiv::EvalStandardDiv_U1_step1()
     EvalSub evalSub(o1,o2,dtpkc);
     o = evalSub.EvalSub_U1();
 
-    // Generate cryptographic blinding value
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state,time(NULL));
-    r=mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
+    if(!dtpkc.optim) {
+        // Generate cryptographic blinding value
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
+    }else{
+        r = dtpkc.R1;
+    }
 
     // compute r *(o1 -o2)
     S1.T1=mpz_class_powm(o.T1,r,dtpkc.n2);
diff --git a/CRYPTO/SkeySwitch.cpp b/CRYPTO/SkeySwitch.cpp
index a38d58f6e0ca52a58c60e699d895c72a0baa335b..ce141fc56004bc4f1685bb03f6144c5ec601868b 100755
--- a/CRYPTO/SkeySwitch.cpp
+++ b/CRYPTO/SkeySwitch.cpp
@@ -26,15 +26,20 @@ SkeySwitch ::SkeySwitch_U1_step1()
     Cipher S1, S2, S3, S4;
     std::vector <Cipher> res(4);
 
-    // Generate two random numbers : used for multiplicative cryptographic blinding
-    gmp_randinit_default(state);
-    gmp_randseed_ui(state, time(NULL));
+    if(!dtpkc.optim) {
+        // Generate two random numbers : used for multiplicative cryptographic blinding
+        gmp_randinit_default(state);
+        gmp_randseed_ui(state, time(NULL));
 
-    r = mpz_class_get_z_bits(dtpkc.blindVal);
-    gmp_randclear(state);
+        r = mpz_class_get_z_bits(dtpkc.blindVal);
+        gmp_randclear(state);
 
-    S1 = dtpkc.enc(r,A.Pub);
+        S1 = dtpkc.enc(r, A.Pub);
 
+    }else{
+        r = dtpkc.R1;
+        S1 = dtpkc.CR1;
+    }
     //A+r
     S2.T1= A.T1*S1.T1;
     S2.T2= A.T2*S1.T2;
diff --git a/SER/dtpkc.ser b/SER/dtpkc.ser
index e8baa9b62b5e5ee34f0dd050dd1c54906cec5904..40da25264327764aefcb37cacbbc9fd993411326 100644
--- a/SER/dtpkc.ser
+++ b/SER/dtpkc.ser
@@ -1,11 +1,11 @@
-100841564869239866090574886378461303766611604006965997954206127580251661994300321218269441900873811440576720393838551914861780471114140658433274349084840345584872726448837457387405611263583719782196200231564376115047185503764874464357216062331662542610398130739604392486270424647960209292713150072984597114187
--9097336795030758117307578539013631811372357166861457957710136130479428632935590814916533745471234079211484656872244719707466261424359008727723240004447272297642927274078627414289306712512422518851603862703365683229592483702089697622247469068704240261975945406843797365150952338650066980407821940434799622271577489963502412652344614184562800878469521176334845937601886355637647256980103856058234033041888770757167760554300212060227504859564684257415049142508332670687317463925175950170519267796227480445444529043613861312336505976838708276783782407541441108826583621738387961153658023518466983795926439883345862911300
-10169021205277111931026219204213227775970078244242943170543658550832682790325927966298276500852480854360335895076690988705230757405325842398967919386777517535796926174220080909785131612805614615899614293368509600858760314675079490041696484075202746516311125634073366554887818964656293490914379117104263589441855254350511939198531935026400836451378522127190836320404413474183850652203927015974191779181185002772469531257767702253646717910850865274391884651056623576629235525832840107031310235353360400983432399435889917458996189007916345669236972147839177228499708014792269337695636004413421041924334020193368316670969
-442316344977348091093637192526484148810421484294772237424155075136938412591273011314065217559093851340967107330480079702398640228428777525263913796959987761273954499255054442043182939597724785048833347626670756039395006389095024064474521567983631312695676953270647868805003630095609535226769887998810902529182011254138653064883853251242689126623678925762170696099373928610419791710980205582362348114747083562221799648836525161548423561429796556960920608389491912276579872837474058181866161693506077310220918886495769644052871198967087724392020240991964528500513746158968607731816429646999539440820406901287874161830706943012778864877794237635725943521063209294623855100176182618994369324843741205948804224748816363798320148268009370782722843194286864963562696406271974089684983785721071975221935412140308230103335798453809477325041273085430392955877032839652742071788027330135863704101778229732310833021284543944017803600950013899266225373595053409068501659754528250435206162600762065825752982790221450366759616957970713891520045521540448833844683026737181974146926838406640052876412404551101383939601020291827618979238279316898448580897028409263721322298875995484054547697750905120783355748575948375750437152025514861322338245104013815353615787986998779471315686564458908441285334397279455590039560454296513920838027430102630584565875367495281331939073949630058191212167101889371160185210858454575990407499372313779179484809810705523457143432191880013161122927823519563954886485381326748687111402892645727220468820366643920483935323419309194182490527505230099311488020515386883503776297692083045944328155421938003804306214252763169528370374623426243544722845626571023665862171203090090560022804191664433750431250015875513367505171329356581743546889749626058130429385225557233981990213139393215499095571026007013965793623181650988295619932547267451
+125749612203826895728818844452098338543693176445640629912009329390324216575187481527889963210391297408299013953812699370422938402670840715022221337080443948821780712900103139343142074878732783586567049542350480127094828398607825818303067739500876146945941487578318793784485332234877362986345595653939077541447
+-11007343144478438604531014486264573676722848676981013241451170198195487131197467697211101258578390949777215676089562551623533257729481003547104603250255044701324485732253191151424225596023320457506826232780964595874909060364626116650136206810678112208669709486860235773459510190316905361781051161603825894453438267824822866974945535631267769186461050652902779641136961741231196813844339417878906141966783917153167098288592382660562747551052729145147989473327136090922338322617854775105726926985373748608530030765375636729538800913674010405097737828454051984619469164435961461028226174073256598502731681115293988113074
+15812964969412850147672257238726227010923393158705213728808782793612375883828590171912820706586592874745349505045277509358854226300655913522511654814924808974353197308490470053290391950199819992862001838011348902402192240414718551085299082730347005403885596587665245507115688287345060482009032023908877972495407791591967185844603368246416305828521309602389726500309691722545174259665931294985299899546513330384148173883591519192032561988825269051427329916351302854725276962474624645252818753011169018280071563023247022665353139025576412053553431990431017780592452039929760602972060028916536003673887688632142002853809
+277108582552547236135980882350711762343953660006214895934636540752292669636111435751911136042593203723160548813757064863418981627181174115857985157872358509488050070097457362957314554405613794479913713650248783816565393474651118050536952302930948632677835146235430329144502204158358449280473364366583146414921795680790691791062274063954899124492744567640333929998902317254114248776507039932252947070709922520309233521611509620159848738337260086267103512669359455994953909919738333028796501851806926009168067526869836995976960960407155982777820461246981918257065276980801190924214301321515786998262919882640275420904359425286737681338545848469099993456792046944832726880158915701838474919341128777745283907110598823937193121691318056592853205140086233542079188733346431541981731994404339247104068131232297569687128823849248852281696421564318192253280382443787710041161046195445774225388834466423626221343310863408339321232737853404684791249338834820321155835744007483012679246678716321483204392035074789312353299849115137826729746240126544352848129726490453377376939062052746026177904952452734061288495144024552491586053410743330934598421031093674075440409975574159060839775768016748010864557858548301852233227559079527280252948004116489327757423446629522043099857092000911117847556746117756137002050507546253210281400046719685613339474604447960997753413581868131272657318673260695891753308214260473922599768996080284946754786149016418171279072774840544673908700953021125005897018094353155009863310021654683454491369741871361592437486650680584276625937922038683278126747442183901968140141072673512146062295313006986249972978357341938117709762076351424508548727822997704299763054548106401084989136678725075412332069739040999108337070363806018721715604404267110743040666228854953612512450983946811200056589793831889695955020568667631414513607016000
 1024
-11225679320527476976016957142181763817178454682815355914561889197328896054343493005701197716336223692434773919922404202821496726924657938818124315185726859
-8983114695325314166899896831573776292897359718394442781414651289893085322376636820471997786799606197571247670019546385909266018318781942191338274025385793
-143454871364348315389645590835639359033665945934666486746161810517709577243990573901793631493759801678316207561504981799760161766192368479817648692491123097798875571426319646672758772103027108074025897415453893693014524657240286597934062617406500519103690928589940903925635573439283573064435262488032047832943
-25210391217309966522643721594615325941652901001741499488551531895062915498575080304567360475218452860144180098459637978715445117778535164608318587271210081344019677649011578617637909377010902426595449755441420034626674570445874436056847472284039851695127031179503612633920423471303741463208035152598846500384
-176415574922174518987192897691450784155748467445667014582926778214080693167776788688294296721735421027271970230568502831762406812134196365729851733866335130711427309152189721848035800740870726933366839079843623896584749604146936457191263334462690690090566912408703292946810278320777927288322690488129417696979
-236128979954433759166174900395214664941774497519033309019648744853269734741460671927473697191670709982701703169061178647252134870951609592180439411852955536039054671973364297442269782358867184025464417730126336056828110659429532498778209231018165330645338612529465222031846971169113308435941671929723771539560560400098686802326004234442009009617377872197510830151913226570866822158563772399730898190023221526879335679207981741775629065416741278592495892317181760837869381500871181676959271310350706375512693257556488445983168244235040994282589967149172306711632406261741424253727938273074625617702765370807115472853891803326481852266164174760014463821507584564940568769869871879878131489692080429752088897449034473030160349140234795172994366439942879904258689634641878966702040163576466299138934308750675011323756697892231216819926136984912749400679103377967683232764297664682056541863369774722791303925058327041656814950157
+11707904116548966305010875600747897957541148674109101279698422020659247669624180448665197056124708478848839644042573998379129095236932382418893857869028449
+10740574141368436402450672075563210917529292225682471044094708253688244780903477894354510950256809283905208603299034777415453511155486259318133363185748903
+127550355637145420030975652063747593965765087934569189156670098382750903469075497909182870759652817004153969858628684353747342761911736562081413733235005019707124361583915923839361150210850149147619978053557018024831390403473140489445207911461952780659954665592747905514644770866337735909712420722964645878943
+31437403050956723932204711113024584635923294111410157478002332347581054143796870381972490802597824352074753488453174842605734600667710178755555334270110981593325613745675107970398599641905977129031537437694539083491138512778843822661181179948217441357044683382517863043927384413067742641925964656679505691024
+37744035392498280914334945564459348852307832259502937830804882806928005247302609799019783910224186544172014199774805800773471289215101809690002937758783772715350515726509531818343974072899929286141939832207863095100581192763894995426943327121660665906787946378389204053119261564989558061655689764137587054697
+284328657230520087316555311524217781732125365673918295069580184705228061640689900926810143534135779336329462539620144320495076234580752501534080863057392727698080652634078624458565836853649654227103906216557236420702078382576380744734909557425938149013020715241853008861818934319327690143210828726259906512589319435598046891270865928352445364495022495966344079663246023031743121313541988814054856307276138023380312614376584511541692868194377243733591753125853792537995266916356816917780379849994736695372158551655386957683404219025142382098491031819823110906142414944014171815900233837388904010093524662505896200333849859485195189356125988191701619051138387697995665250552839416662026498694645309340061880814242028894831499555734214241672720603779875397425764494707931885894445704827320513537035826014759779299295141848316877294769932822802848445628232290443227889273865899922561915248250707802190113292703537352890930223671
diff --git a/TEST/TESTBuildingBlocks.cpp b/TEST/TESTBuildingBlocks.cpp
index 620d47264c6350dc8ac2401fb9b22ab0e746aab2..622aa5bf30a8cfbc6a11f17f148c986dd922cd2a 100755
--- a/TEST/TESTBuildingBlocks.cpp
+++ b/TEST/TESTBuildingBlocks.cpp
@@ -284,7 +284,7 @@ int TESTBuildingBlocks::validate(DTPKC dtpkc)
 }
 
 
-void TESTBuildingBlocks::run (bool deserialize, int keysize, int prec, int error, string filename) {
+void TESTBuildingBlocks::run (bool deserialize, int keysize, int prec, int error, string filename, bool optim, string outputfile) {
 
     DTPKC dtpkc;
     int cpt=0;
@@ -323,7 +323,7 @@ void TESTBuildingBlocks::run (bool deserialize, int keysize, int prec, int error
 
 
     std::ofstream stats;
-    stats.open( "buildingblocks-Stats.csv");
+    stats.open(outputfile);
 
     stats <<"SKS,SE,STS,SHBC,SSig,SDP,SD,SM,SC,SLog,SSqrt,SExpo,SPU"<<endl;
 
@@ -333,6 +333,7 @@ void TESTBuildingBlocks::run (bool deserialize, int keysize, int prec, int error
     if (deserialize) {
         dtpkc.deserializeDtpkc(filename);
         dtpkc.blindVal = prec;
+        dtpkc.optim = false;
         pkey = dtpkc.pkw;
 
     } else {
@@ -340,7 +341,7 @@ void TESTBuildingBlocks::run (bool deserialize, int keysize, int prec, int error
         gmp_randinit_default(randstate);
         gmp_randseed_ui(randstate, time(NULL));
         std::chrono::milliseconds delay(1000);
-        dtpkc.keygen(prec, randstate, delay, keysize, error);
+        dtpkc.keygen(prec, randstate, delay, keysize, error, optim,200 );
 
         // Generate public key
         dtpkc.getKey(pkey, skey);
diff --git a/TEST/TESTBuildingBlocks.h b/TEST/TESTBuildingBlocks.h
index 07405827c515bc66c2044dd2e6b0335e11c1cc6f..780a17a808b97786d34d8d49e0263322f8240a67 100755
--- a/TEST/TESTBuildingBlocks.h
+++ b/TEST/TESTBuildingBlocks.h
@@ -22,7 +22,7 @@
 #define DAPPLE_TESTBUILDINGBLOCKS_H
 
 class TESTBuildingBlocks{
-public : void run(bool deserialize, int keysize, int prec, int error, string filename);
+public : void run(bool deserialize, int keysize, int prec, int error, string filename, bool optim =false, string outputfile="buildingBlock.csv");
 public : int validate(DTPKC dtpkc);
 public : void TrunGlobal (bool deserialize, int keysize, int prec, int error, string filename);
 };
diff --git a/TEST/TESTElementaryOps.cpp b/TEST/TESTElementaryOps.cpp
index 23ee4e0ba542d8e1543afbb98d2d932b580f17fe..f36b610d00a4f7b5d5c7337b4e6606fdd383d943 100755
--- a/TEST/TESTElementaryOps.cpp
+++ b/TEST/TESTElementaryOps.cpp
@@ -7,26 +7,27 @@
 using namespace std;
 
 
-void TESTElementaryOps::run (bool deserialize, int keysize, int prec, int error, string filename) {
+void TESTElementaryOps::run (bool deserialize, int keysize, int prec, int error, string filename, bool optim ) {
 
     DTPKC dtpkc;
     mpz_class pkey, skey, newPkey, newSkey, r, C2;
     mpz_class A, B, C_2;
     DTPKC::Cipher C_A, C_B, C, C_1, S;
     gmp_randstate_t randstate;
-    int N = 10;
+    int N =1;//= 10;
     double init, encrypt, decrypt, dec1, dec2, expo, mult, gmpRandom, gmpExp, gmpSqrt, gmpLog, gmpMult, gmpDiv,gmpSub;
 
     /***
      * Initialisation
      */
+    keysize = 1024;
     auto begin = chrono::high_resolution_clock::now();
     for(int i=0; i <N ; i++)
     {
         gmp_randinit_default(randstate);
         gmp_randseed_ui(randstate,time(NULL));
         std::chrono::milliseconds delay(1000);
-        dtpkc.keygen(prec,randstate, delay, keysize, error);
+        dtpkc.keygen(prec,randstate, delay, keysize, error, optim, 200 );
 
         // Generate public key
         dtpkc.getKey(pkey,skey);
@@ -45,22 +46,25 @@ void TESTElementaryOps::run (bool deserialize, int keysize, int prec, int error,
     //Encryption
 
 
-    A = mpz_class_get_z_bits(15);
+    A = 10740;//mpz_class_get_z_bits(15);
     gmp_randinit_default(randstate);
     gmp_randseed_ui(randstate,time(NULL));
-    B = mpz_class_get_z_bits(15);
-
-    //cout << "A= " << A << "B= " << B << endl;
+    B = 10740;// mpz_class_get_z_bits(15);
+    cout << "A= " << A << endl;
 
     // Encrypt operands
-    /*N=100000;
+    N=1;
     begin = chrono::high_resolution_clock::now();
     for(int i=0; i <N ; i++) {
         C_A = dtpkc.enc(A, pkey);
     }
     end = chrono::high_resolution_clock::now();
     duration = end  - begin ;
-    encrypt = duration.count()/N;*/
+    encrypt = duration.count()/N;
+
+    cout << "CA= " << C_A << endl;
+
+    //return;
 
     C_B = dtpkc.enc(B,pkey);
 
@@ -68,51 +72,83 @@ void TESTElementaryOps::run (bool deserialize, int keysize, int prec, int error,
     C_A = dtpkc.enc(A,pkey);
 
     // Partial decryption part 1
-/*N=1000000;
+N=100;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
     C_1 = dtpkc.PSdec0(C_A);
 }
 end = chrono::high_resolution_clock::now();
 duration = end  - begin ;
-dec1 = duration.count()/N;*/
+dec1 = duration.count()/N;
 
 // Partial decryption part 2
-/*N=1000000;
+N=100;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
     C_2 = dtpkc.PSdec1(C_A, C_1);
 }
 end = chrono::high_resolution_clock::now();
 duration = end  - begin ;
-dec2 = duration.count()/N;*/
+dec2 = duration.count()/N;
 
+cout << C_2 << endl;
 // Expo
-/*N=10000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
-    S.T1 = mpz_class_powm(C_A.T1, r, dtpkc.n2);
-    S.T2 = mpz_class_powm(C_A.T2, r, dtpkc.n2);
+    if(!optim) {
+
+        fastpow2(S.T1, C_A.T1, r, dtpkc.n2);
+
+        fastpow2(S.T2, C_A.T2, r, dtpkc.n2);
+
+    } else{
+
+        fastpow(S.T1, C_A.T1, r, dtpkc.n2);
+
+        fastpow(S.T2, C_A.T2, r, dtpkc.n2);
+    }
 }
 end = chrono::high_resolution_clock::now();
 duration = end  - begin ;
-expo = duration.count()/N;*/
+expo = duration.count()/N;
 
+    N = 1000;
+if(!optim) {
 // Mult
-/*N=10000000000;
-begin = chrono::high_resolution_clock::now();
-for(int i=0; i <N ; i++) {
-    C.T1 = C_A.T1 * C_B.T1;
-    C.T2 = C_A.T2 * C_B.T2;
-}
-end = chrono::high_resolution_clock::now();
-duration = end  - begin ;
-mult = duration.count()/N;*/
 
+    begin = chrono::high_resolution_clock::now();
+    for (int i = 0; i < N; i++) {
+
+
+        fastmul2(C.T1, C_A.T1, C_B.T1);
+        fastmul2(C.T2, C_A.T2, C_B.T2);
+
+    }
+    end = chrono::high_resolution_clock::now();
+    duration = end - begin;
+    mult = duration.count() / N;
+}else{
+
+
+    begin = chrono::high_resolution_clock::now();
+    for (int i = 0; i < N; i++) {
+
+            fastmul(C.T1, C_A.T1, C_B.T1);
+            fastmul(C.T2, C_A.T2, C_B.T2);
+
+    }
+    end = chrono::high_resolution_clock::now();
+    duration = end - begin;
+    mult = duration.count() / N;
+
+
+}
+/*
 mpz_class r1,r2;
 
 // gmp random number generation
-/*N=100000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -123,10 +159,10 @@ duration = end  - begin ;
 gmpRandom = duration.count()/N;*/
 
 
-
 /*
+
 // gmp number expo
-N=100000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -136,11 +172,11 @@ for(int i=0; i <N ; i++) {
 end = chrono::high_resolution_clock::now();
 duration = end  - begin ;
 gmpExp = duration.count()/N;
-*/
 
-/*
+
+
 // gmp number log
-N=100000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -149,12 +185,12 @@ for(int i=0; i <N ; i++) {
 }
 end = chrono::high_resolution_clock::now();
 duration = end  - begin ;
-gmpLog = duration.count()/N;*/
+gmpLog = duration.count()/N;
+
 
 
-/*
 // gmp number sqrt
-N=1000000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -169,7 +205,7 @@ gmpSqrt = duration.count()/N;
 r2=mpz_class_get_z_bits(200);
 
 // gmp number Mult
-N=10000000000;
+N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -183,7 +219,7 @@ gmpMult= duration.count()/N;*/
 
 
 // gmp number div
-/*N=10000000000;
+/*N=1000;
 begin = chrono::high_resolution_clock::now();
 for(int i=0; i <N ; i++) {
 
@@ -197,7 +233,7 @@ gmpDiv= duration.count()/N;*/
 
 
 // gmp number div
-    N=1000000;
+ /*   N=10000;
     begin = chrono::high_resolution_clock::now();
     for(int i=0; i <N ; i++) {
 
@@ -208,23 +244,23 @@ gmpDiv= duration.count()/N;*/
     }
     end = chrono::high_resolution_clock::now();
     duration = end  - begin ;
-    gmpSub= duration.count()/N;
+    gmpSub= duration.count()/N;*/
 
 
-cout << "gmpSub = " <<  gmpSub<< endl;
-/*cout << "gmpDiv = " <<  gmpDiv<< endl;
-cout << "gmpMult = " <<  gmpMult<< endl;
-cout << "gmpSqrt = " <<  gmpSqrt << endl;*/
-/*cout << "gmpLog = " <<  gmpLog << endl;
-cout << "gmpExp = " <<  gmpExp << endl;
-cout << "gmpRandom = " <<  gmpRandom << endl;
-cout << "init = " <<  init << endl;
+//cout << "gmpSub = " <<  gmpSub<< endl;
+//cout << "gmpDiv = " <<  gmpDiv<< endl;
+//cout << "gmpMult = " <<  gmpMult<< endl;
+//cout << "gmpSqrt = " <<  gmpSqrt << endl;
+//cout << "gmpLog = " <<  gmpLog << endl;
+//cout << "gmpExp = " <<  gmpExp << endl;
+//cout << "gmpRandom = " <<  gmpRandom << endl;
+//cout << "init = " <<  init << endl;
 cout << "enc = " <<  encrypt << endl;
-cout << "dec = " <<  decrypt << endl;
+//cout << "dec = " <<  decrypt << endl;
 cout << "dec1 = " <<  dec1 << endl;
 cout << "dec2 = " <<  dec2 << endl;
-cout << "expo = " <<  expo << endl;
-cout << "mult = " <<  mult << endl;*/
+cout << "SMult = " <<  expo << endl;
+cout << "SAdd = " <<  mult << endl;
 
 }
 
diff --git a/TEST/TESTElementaryOps.h b/TEST/TESTElementaryOps.h
index a713a05e9d70a3cd80fef27c6cc1dc55de3b5ec7..8ddd68c55a4436c62aecc7667558209b7e1c1e51 100755
--- a/TEST/TESTElementaryOps.h
+++ b/TEST/TESTElementaryOps.h
@@ -23,7 +23,7 @@
 
 class TESTElementaryOps{
 
-public : void run(bool deserialize, int keysize, int prec, int error, string filename);
+public : void run(bool deserialize, int keysize, int prec, int error, string filename, bool optim = false );
 
 };
 #endif //DAPPLE_TESTBUILDINGBLOCKS_H
diff --git a/TEST/main.cpp b/TEST/main.cpp
index c0d18967e482255fbfdc183d9cb73c35c12ddc1c..1b0f287a7078f9b7b70b80d6830ef2bc0e81c083 100755
--- a/TEST/main.cpp
+++ b/TEST/main.cpp
@@ -1355,7 +1355,8 @@ else {
         for (int i = 0; i < runs_number ; i++) {
 
             TESTBuildingBlocks testBuildingBlocks;
-            testBuildingBlocks.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer);
+            testBuildingBlocks.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer, false, logfile+"NON");
+            testBuildingBlocks.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer, optim, logfile+"opt");
 
             //TESTBuildingBlocks testBuildingBlocks;
             //testBuildingBlocks.TrunGlobal(deserialize, keySize, blindVal, DTPKC_Err, pathSer);
@@ -1366,7 +1367,8 @@ else {
 
 
             //TESTElementaryOps testOps;
-            //testOps.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer);
+            //testOps.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer, false);
+            //testOps.run(deserialize, keySize, blindVal, DTPKC_Err, pathSer, true );
 
         }
 
diff --git a/UTIL/math_util.cc b/UTIL/math_util.cc
index 3f3f2e44b1043a4eb05468394e15b92c8ece026c..3b69574a754ef52957f825265ce85f21b216417f 100755
--- a/UTIL/math_util.cc
+++ b/UTIL/math_util.cc
@@ -23,6 +23,13 @@
 #include "../UTIL/math_util.hh"
 #include <vector>
 #include <mpfr.h>
+#include "gmp.h"
+#include "../LIB/gmp-6.1.2/gmp-impl.h"
+#include "../LIB/gmp-6.1.2/longlong.h"
+
+
+#define HANDLE_NEGATIVE_EXPONENT 1
+
 
 using namespace std;
 
@@ -216,8 +223,772 @@ mpz_class mpz_class_crt(const vector<mpz_class> &v, const vector<mpz_class> &m)
 
 
 
+void  fastmul2(mpz_class &c, mpz_class &a, mpz_class &b)
+{
+    //mpz_t w,u, v;
+
+    mpz_ptr w; mpz_srcptr u; mpz_srcptr v;
+    w= c.get_mpz_t();
+
+    u = a.get_mpz_t();
+    v =  b.get_mpz_t();
+
+    mp_size_t usize;
+    mp_size_t vsize;
+    mp_size_t wsize;
+    mp_size_t sign_product;
+    mp_ptr up, vp;
+    mp_ptr wp;
+    mp_ptr free_me;
+    size_t free_me_size;
+    mp_limb_t cy_limb;
+    TMP_DECL;
+
+    usize = SIZ (u);
+    vsize = SIZ (v);
+    sign_product = usize ^ vsize;
+    usize = ABS (usize);
+    vsize = ABS (vsize);
+
+    mpz_init2(w, usize + vsize);
+
+
+
+    if (usize < vsize)
+    {
+        MPZ_SRCPTR_SWAP (u, v);
+        MP_SIZE_T_SWAP (usize, vsize);
+    }
+
+    if (vsize == 0)
+    {
+        SIZ (w) = 0;
+        return;
+    }
+
+
+
+
+#ifdef HAVE_NATIVE_mpn_mul_2
+    if (vsize <= 2)
+    {
+        wp = MPZ_REALLOC (w, usize+vsize);
+        if (vsize == 1)
+            cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+        else
+        {
+            cy_limb = mpn_mul_2 (wp, PTR (u), usize, PTR (v));
+            usize++;
+        }
+        wp[usize] = cy_limb;
+        usize += (cy_limb != 0);
+        SIZ (w) = (sign_product >= 0 ? usize : -usize);
+        return;
+    }
+#else
+        if (vsize == 1)
+    {
+      wp = MPZ_REALLOC (w, usize+1);
+      cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+      wp[usize] = cy_limb;
+      usize += (cy_limb != 0);
+      SIZ (w) = (sign_product >= 0 ? ((int) usize) : -(int) usize); // (int)  added by PM
+      return;
+    }
+#endif
+
+
+    TMP_MARK;
+    free_me = NULL;
+    up = PTR (u);
+    vp = PTR (v);
+    wp = PTR (w);
+
+    /* Ensure W has space enough to store the result.  */
+    wsize = usize + vsize;
+    if (ALLOC (w) < wsize)
+    {
+        if (wp == up || wp == vp)
+        {
+            free_me = wp;
+            free_me_size = (size_t) ALLOC (w); // (size_t) added by PM
+        }
+        else
+            (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
+
+        ALLOC (w) = (int) wsize; // (int) added by PM
+        wp = (mp_ptr) (*__gmp_allocate_func) ((size_t) wsize * GMP_LIMB_BYTES);
+        PTR (w) = wp;
+    }
+    else
+    {
+        /* Make U and V not overlap with W.  */
+        if (wp == up)
+        {
+            /* W and U are identical.  Allocate temporary space for U.  */
+            up = TMP_ALLOC_LIMBS (usize);
+            /* Is V identical too?  Keep it identical with U.  */
+            if (wp == vp)
+                vp = up;
+            /* Copy to the temporary space.  */
+            MPN_COPY (up, wp, usize);
+        }
+        else if (wp == vp)
+        {
+            /* W and V are identical.  Allocate temporary space for V.  */
+            vp = TMP_ALLOC_LIMBS (vsize);
+            /* Copy to the temporary space.  */
+            MPN_COPY (vp, wp, vsize);
+        }
+    }
+
+    if (up == vp)
+    {
+        mpn_sqr (wp, up, usize);
+        cy_limb = wp[wsize - 1];
+    }
+    else
+    {
+        //mpn_fft_mul(wp, up, usize, vp, vsize);
+        mpn_mul_basecase(wp, up, usize, vp, vsize);
+    }
+
+    wsize -= cy_limb == 0;
+
+    SIZ (w) = sign_product < 0 ? ((int) -wsize) : (int) wsize; // (int) added by PM
+    if (free_me != NULL)
+        (*__gmp_free_func) (free_me, free_me_size * GMP_LIMB_BYTES);
+    TMP_FREE;
+        }
+
+
+
+void  fastmul(mpz_class &c, mpz_class &a, mpz_class &b)
+{
+    //mpz_t w,u, v;
+
+    mpz_ptr w; mpz_srcptr u; mpz_srcptr v;
+    w= c.get_mpz_t();
+
+    u = a.get_mpz_t();
+    v =  b.get_mpz_t();
+
+    mp_size_t usize;
+    mp_size_t vsize;
+    mp_size_t wsize;
+    mp_size_t sign_product;
+    mp_ptr up, vp;
+    mp_ptr wp;
+    mp_ptr free_me;
+    size_t free_me_size;
+    mp_limb_t cy_limb;
+    TMP_DECL;
+
+    usize = SIZ (u);
+    vsize = SIZ (v);
+    sign_product = usize ^ vsize;
+    usize = ABS (usize);
+    vsize = ABS (vsize);
+
+    mpz_init2(w, usize + vsize);
+
+
+
+    if (usize < vsize)
+    {
+        MPZ_SRCPTR_SWAP (u, v);
+        MP_SIZE_T_SWAP (usize, vsize);
+    }
+
+    if (vsize == 0)
+    {
+        SIZ (w) = 0;
+        return;
+    }
+
+
+
+
+#ifdef HAVE_NATIVE_mpn_mul_2
+    if (vsize <= 2)
+    {
+        wp = MPZ_REALLOC (w, usize+vsize);
+        if (vsize == 1)
+            cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+        else
+        {
+            cy_limb = mpn_mul_2 (wp, PTR (u), usize, PTR (v));
+            usize++;
+        }
+        wp[usize] = cy_limb;
+        usize += (cy_limb != 0);
+        SIZ (w) = (sign_product >= 0 ? usize : -usize);
+        return;
+    }
+#else
+        if (vsize == 1)
+    {
+      wp = MPZ_REALLOC (w, usize+1);
+      cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+      wp[usize] = cy_limb;
+      usize += (cy_limb != 0);
+      SIZ (w) = (sign_product >= 0 ? ((int) usize) : -(int) usize); // (int)  added by PM
+      return;
+    }
+#endif
+
+
+    TMP_MARK;
+    free_me = NULL;
+    up = PTR (u);
+    vp = PTR (v);
+    wp = PTR (w);
+
+    /* Ensure W has space enough to store the result.  */
+    wsize = usize + vsize;
+    if (ALLOC (w) < wsize)
+    {
+        if (wp == up || wp == vp)
+        {
+            free_me = wp;
+            free_me_size = (size_t) ALLOC (w); // (size_t) added by PM
+        }
+        else
+            (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
+
+        ALLOC (w) = (int) wsize; // (int) added by PM
+        wp = (mp_ptr) (*__gmp_allocate_func) ((size_t) wsize * GMP_LIMB_BYTES);
+        PTR (w) = wp;
+    }
+    else
+    {
+        /* Make U and V not overlap with W.  */
+        if (wp == up)
+        {
+            /* W and U are identical.  Allocate temporary space for U.  */
+            up = TMP_ALLOC_LIMBS (usize);
+            /* Is V identical too?  Keep it identical with U.  */
+            if (wp == vp)
+                vp = up;
+            /* Copy to the temporary space.  */
+            MPN_COPY (up, wp, usize);
+        }
+        else if (wp == vp)
+        {
+            /* W and V are identical.  Allocate temporary space for V.  */
+            vp = TMP_ALLOC_LIMBS (vsize);
+            /* Copy to the temporary space.  */
+            MPN_COPY (vp, wp, vsize);
+        }
+    }
+
+    if (up == vp)
+    {
+        mpn_sqr (wp, up, usize);
+        cy_limb = wp[wsize - 1];
+    }
+    else
+    {
+        //mpn_mul_basecase(wp, up, usize, vp, vsize);
+        //mpn_mul(wp, up, usize, vp, vsize);
+        mpn_fft_mul(wp, up, usize, vp, vsize);
+    }
+
+    wsize -= cy_limb == 0;
+
+    SIZ (w) = sign_product < 0 ? ((int) -wsize) : (int) wsize; // (int) added by PM
+    if (free_me != NULL)
+        (*__gmp_free_func) (free_me, free_me_size * GMP_LIMB_BYTES);
+    TMP_FREE;
+}
+
+
+void fastpow(mpz_class &d, mpz_class &a, mpz_class &b_, mpz_class &c)
+{
+
+    mpz_class r_;
+    mpz_ptr r = r_.get_mpz_t();
+
+    mpz_srcptr b; mpz_srcptr e; mpz_srcptr m;
+    b = a.get_mpz_t();
+    e =  b_.get_mpz_t();
+    m = c.get_mpz_t();
+    //cout << v << endl;
+
+    mp_size_t n, nodd, ncnt;
+    int cnt;
+    mp_ptr rp, tp;
+    mp_srcptr bp, ep, mp;
+    mp_size_t rn, bn, es, en, itch;
+    mpz_t new_b;			/* note: value lives long via 'b' */
+    TMP_DECL;
+
+    n = ABSIZ(m);
+    if (UNLIKELY (n == 0))
+        DIVIDE_BY_ZERO;
+
+    mp = PTR(m);
+
+    TMP_MARK;
+
+
+    es = SIZ(e);
+    if (UNLIKELY (es <= 0))
+    {
+        if (es == 0)
+        {
+            /* b^0 mod m,  b is anything and m is non-zero.
+               Result is 1 mod m, i.e., 1 or 0 depending on if m = 1.  */
+            SIZ(r) = n != 1 || mp[0] != 1;
+            MPZ_NEWALLOC (r, 1)[0] = 1;
+            TMP_FREE;	/* we haven't really allocated anything here */
+            return ;//mpz_class(r);
+        }
+#if HANDLE_NEGATIVE_EXPONENT
+MPZ_TMP_INIT (new_b, n + 1);
+      if (UNLIKELY (! mpz_invert (new_b, b, m)))
+	DIVIDE_BY_ZERO;
+      b = new_b;
+      es = -es;
+#else
+        DIVIDE_BY_ZERO;
+#endif
+    }
+    en = es;
+
+    bn = ABSIZ(b);
+
+    if (UNLIKELY (bn == 0))
+    {
+        SIZ(r) = 0;
+        TMP_FREE;
+        return;// mpz_class(r);
+    }
+
+    ep = PTR(e);
+
+    /* Handle (b^1 mod m) early, since mpn_pow* do not handle that case.  */
+    if (UNLIKELY (en == 1 && ep[0] == 1))
+    {
+        rp = TMP_ALLOC_LIMBS (n);
+        bp = PTR(b);
+        if (bn >= n)
+        {
+            mp_ptr qp = TMP_ALLOC_LIMBS (bn - n + 1);
+            mpn_tdiv_qr (qp, rp, 0L, bp, bn, mp, n);
+            rn = n;
+            MPN_NORMALIZE (rp, rn);
+
+            if (rn != 0 && SIZ(b) < 0)
+            {
+                mpn_sub (rp, mp, n, rp, rn);
+                rn = n;
+                MPN_NORMALIZE_NOT_ZERO (rp, rn);
+            }
+        }
+
+        else
+        {
+            if (SIZ(b) < 0)
+            {
+                mpn_sub (rp, mp, n, bp, bn);
+                rn = n;
+                MPN_NORMALIZE_NOT_ZERO (rp, rn);
+            }
+            else
+            {
+                MPN_COPY (rp, bp, bn);
+                rn = bn;
+            }
+        }
+        goto ret;
+    }
+
+    /* Remove low zero limbs from M.  This loop will terminate for correctly
+    represented mpz numbers.  */
+    ncnt = 0;
+    while (UNLIKELY (mp[0] == 0))
+    {
+        mp++;
+        ncnt++;
+    }
+    nodd = n - ncnt;
+    cnt = 0;
+    if (mp[0] % 2 == 0)
+    {
+        mp_ptr newmp = TMP_ALLOC_LIMBS (nodd);
+        count_trailing_zeros (cnt, mp[0]);
+        mpn_rshift (newmp, mp, nodd, cnt);
+        nodd -= newmp[nodd - 1] == 0;
+        mp = newmp;
+        ncnt++;
+    }
+
+    if (ncnt != 0)
+    {
+        /* We will call both mpn_powm and mpn_powlo.  */
+        /* rp needs n, mpn_powlo needs 4n, the 2 mpn_binvert might need more */
+        mp_size_t n_largest_binvert = MAX (ncnt, nodd);
+        mp_size_t itch_binvert = mpn_binvert_itch (n_largest_binvert);
+        itch = 3 * n + MAX (itch_binvert, 2 * n);
+    }
+    else
+    {
+        /* We will call just mpn_powm.  */
+        mp_size_t itch_binvert = mpn_binvert_itch (nodd);
+        itch = n + MAX (itch_binvert, 2 * n);
+    }
+
+    tp = TMP_ALLOC_LIMBS (itch);
+
+    rp = tp;  tp += n;
+
+    bp = PTR(b);
+    mpn_powm (rp, bp, bn, ep, en, mp, nodd, tp);
+
+    rn = n;
+
+    if (ncnt != 0)
+    {
+        mp_ptr r2, xp, yp, odd_inv_2exp;
+        unsigned long t;
+        int bcnt;
+
+        if (bn < ncnt)
+        {
+            mp_ptr newbp = TMP_ALLOC_LIMBS (ncnt);
+            MPN_COPY (newbp, bp, bn);
+            MPN_ZERO (newbp + bn, ncnt - bn);
+            bp = newbp;
+        }
+
+        r2 = tp;
+
+        if (bp[0] % 2 == 0)
+        {
+            if (en > 1)
+            {
+                MPN_ZERO (r2, ncnt);
+                goto zero;
+            }
+
+            ASSERT (en == 1);
+            t = (ncnt - (cnt != 0)) * GMP_NUMB_BITS + cnt;
+
+            /* Count number of low zero bits in B, up to 3.  */
+            bcnt = (0x1213 >> ((bp[0] & 7) << 1)) & 0x3;
+            /* Note that ep[0] * bcnt might overflow, but that just results
+               in a missed optimization.  */
+            if (ep[0] * bcnt >= t)
+            {
+                MPN_ZERO (r2, ncnt);
+                goto zero;
+            }
+        }
+
+        mpn_powlo (r2, bp, ep, en, ncnt, tp + ncnt);
+
+        zero:
+        if (nodd < ncnt)
+        {
+            mp_ptr newmp = TMP_ALLOC_LIMBS (ncnt);
+            MPN_COPY (newmp, mp, nodd);
+            MPN_ZERO (newmp + nodd, ncnt - nodd);
+            mp = newmp;
+        }
+
+        odd_inv_2exp = tp + n;
+        mpn_binvert (odd_inv_2exp, mp, ncnt, tp + 2 * n);
+
+        mpn_sub (r2, r2, ncnt, rp, nodd > ncnt ? ncnt : nodd);
+
+        xp = tp + 2 * n;
+        mpn_mullo_n (xp, odd_inv_2exp, r2, ncnt);
+
+        if (cnt != 0)
+            xp[ncnt - 1] &= (CNST_LIMB(1) << cnt) - 1;
+
+        yp = tp;
+        if (ncnt > nodd)
+            mpn_mul (yp, xp, ncnt, mp, nodd);
+        else
+            mpn_mul (yp, mp, nodd, xp, ncnt);
+
+        mpn_add (rp, yp, n, rp, nodd);
+
+        ASSERT (nodd + ncnt >= n);
+        ASSERT (nodd + ncnt <= n + 1);
+    }
+
+
+    MPN_NORMALIZE (rp, rn);
+
+    if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0)
+    {
+        mpn_sub (rp, PTR(m), n, rp, rn);
+        rn = n;
+        MPN_NORMALIZE (rp, rn);
+    }
+
+    ret:
+        MPZ_NEWALLOC (r, rn);
+        SIZ(r) = rn;
+        MPN_COPY (PTR(r), rp, rn);
+
+        TMP_FREE;
+
+
+    d = mpz_class(r);
+
+    //return d;
+}
+
+
+
+void fastpow2(mpz_class &d, mpz_class &a, mpz_class &b_, mpz_class &c)
+{
+
+    mpz_class r_;
+    mpz_ptr r = r_.get_mpz_t();
+
+    mpz_srcptr b; mpz_srcptr e; mpz_srcptr m;
+    b = a.get_mpz_t();
+    e =  b_.get_mpz_t();
+    m = c.get_mpz_t();
+    //cout << v << endl;
+
+    mp_size_t n, nodd, ncnt;
+    int cnt;
+    mp_ptr rp, tp;
+    mp_srcptr bp, ep, mp;
+    mp_size_t rn, bn, es, en, itch;
+    mpz_t new_b;			/* note: value lives long via 'b' */
+    TMP_DECL;
+
+    n = ABSIZ(m);
+    if (UNLIKELY (n == 0))
+        DIVIDE_BY_ZERO;
+
+    mp = PTR(m);
+
+    TMP_MARK;
+
+
+    es = SIZ(e);
+    if (UNLIKELY (es <= 0))
+    {
+        if (es == 0)
+        {
+            /* b^0 mod m,  b is anything and m is non-zero.
+               Result is 1 mod m, i.e., 1 or 0 depending on if m = 1.  */
+            SIZ(r) = n != 1 || mp[0] != 1;
+            MPZ_NEWALLOC (r, 1)[0] = 1;
+            TMP_FREE;	/* we haven't really allocated anything here */
+            return ;//mpz_class(r);
+        }
+#if HANDLE_NEGATIVE_EXPONENT
+        MPZ_TMP_INIT (new_b, n + 1);
+        if (UNLIKELY (! mpz_invert (new_b, b, m)))
+            DIVIDE_BY_ZERO;
+        b = new_b;
+        es = -es;
+#else
+        DIVIDE_BY_ZERO;
+#endif
+    }
+    en = es;
+
+    bn = ABSIZ(b);
+
+    if (UNLIKELY (bn == 0))
+    {
+        SIZ(r) = 0;
+        TMP_FREE;
+        return;// mpz_class(r);
+    }
+
+    ep = PTR(e);
+
+    /* Handle (b^1 mod m) early, since mpn_pow* do not handle that case.  */
+    if (UNLIKELY (en == 1 && ep[0] == 1))
+    {
+        rp = TMP_ALLOC_LIMBS (n);
+        bp = PTR(b);
+        if (bn >= n)
+        {
+            mp_ptr qp = TMP_ALLOC_LIMBS (bn - n + 1);
+            mpn_tdiv_qr (qp, rp, 0L, bp, bn, mp, n);
+            rn = n;
+            MPN_NORMALIZE (rp, rn);
+
+            if (rn != 0 && SIZ(b) < 0)
+            {
+                mpn_sub (rp, mp, n, rp, rn);
+                rn = n;
+                MPN_NORMALIZE_NOT_ZERO (rp, rn);
+            }
+        }
+
+        else
+        {
+            if (SIZ(b) < 0)
+            {
+                mpn_sub (rp, mp, n, bp, bn);
+                rn = n;
+                MPN_NORMALIZE_NOT_ZERO (rp, rn);
+            }
+            else
+            {
+                MPN_COPY (rp, bp, bn);
+                rn = bn;
+            }
+        }
+        goto ret;
+    }
+
+    /* Remove low zero limbs from M.  This loop will terminate for correctly
+    represented mpz numbers.  */
+    ncnt = 0;
+    while (UNLIKELY (mp[0] == 0))
+    {
+        mp++;
+        ncnt++;
+    }
+    nodd = n - ncnt;
+    cnt = 0;
+    if (mp[0] % 2 == 0)
+    {
+        mp_ptr newmp = TMP_ALLOC_LIMBS (nodd);
+        count_trailing_zeros (cnt, mp[0]);
+        mpn_rshift (newmp, mp, nodd, cnt);
+        nodd -= newmp[nodd - 1] == 0;
+        mp = newmp;
+        ncnt++;
+    }
+
+    if (ncnt != 0)
+    {
+        /* We will call both mpn_powm and mpn_powlo.  */
+        /* rp needs n, mpn_powlo needs 4n, the 2 mpn_binvert might need more */
+        mp_size_t n_largest_binvert = MAX (ncnt, nodd);
+        mp_size_t itch_binvert = mpn_binvert_itch (n_largest_binvert);
+        itch = 3 * n + MAX (itch_binvert, 2 * n);
+    }
+    else
+    {
+        /* We will call just mpn_powm.  */
+        mp_size_t itch_binvert = mpn_binvert_itch (nodd);
+        itch = n + MAX (itch_binvert, 2 * n);
+    }
+
+    tp = TMP_ALLOC_LIMBS (itch);
+
+    rp = tp;  tp += n;
+
+    bp = PTR(b);
+    mpn_powm (rp, bp, bn, ep, en, mp, nodd, tp);
+
+    rn = n;
+
+    if (ncnt != 0)
+    {
+        mp_ptr r2, xp, yp, odd_inv_2exp;
+        unsigned long t;
+        int bcnt;
+
+        if (bn < ncnt)
+        {
+            mp_ptr newbp = TMP_ALLOC_LIMBS (ncnt);
+            MPN_COPY (newbp, bp, bn);
+            MPN_ZERO (newbp + bn, ncnt - bn);
+            bp = newbp;
+        }
+
+        r2 = tp;
+
+        if (bp[0] % 2 == 0)
+        {
+            if (en > 1)
+            {
+                MPN_ZERO (r2, ncnt);
+                goto zero;
+            }
+
+            ASSERT (en == 1);
+            t = (ncnt - (cnt != 0)) * GMP_NUMB_BITS + cnt;
+
+            /* Count number of low zero bits in B, up to 3.  */
+            bcnt = (0x1213 >> ((bp[0] & 7) << 1)) & 0x3;
+            /* Note that ep[0] * bcnt might overflow, but that just results
+               in a missed optimization.  */
+            if (ep[0] * bcnt >= t)
+            {
+                MPN_ZERO (r2, ncnt);
+                goto zero;
+            }
+        }
+
+        mpn_powlo (r2, bp, ep, en, ncnt, tp + ncnt);
+
+        zero:
+        if (nodd < ncnt)
+        {
+            mp_ptr newmp = TMP_ALLOC_LIMBS (ncnt);
+            MPN_COPY (newmp, mp, nodd);
+            MPN_ZERO (newmp + nodd, ncnt - nodd);
+            mp = newmp;
+        }
+
+        odd_inv_2exp = tp + n;
+        mpn_binvert (odd_inv_2exp, mp, ncnt, tp + 2 * n);
+
+        mpn_sub (r2, r2, ncnt, rp, nodd > ncnt ? ncnt : nodd);
+
+        xp = tp + 2 * n;
+        mpn_mullo_n (xp, odd_inv_2exp, r2, ncnt);
+
+        if (cnt != 0)
+            xp[ncnt - 1] &= (CNST_LIMB(1) << cnt) - 1;
+
+        yp = tp;
+        if (ncnt > nodd)
+            mpn_fft_mul(yp, xp, ncnt, mp, nodd);
+        else
+            mpn_fft_mul (yp, mp, nodd, xp, ncnt);
+
+        mpn_add (rp, yp, n, rp, nodd);
+
+        ASSERT (nodd + ncnt >= n);
+        ASSERT (nodd + ncnt <= n + 1);
+    }
+
+
+    MPN_NORMALIZE (rp, rn);
+
+    if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0)
+    {
+        mpn_sub (rp, PTR(m), n, rp, rn);
+        rn = n;
+        MPN_NORMALIZE (rp, rn);
+    }
+
+    ret:
+    MPZ_NEWALLOC (r, rn);
+    SIZ(r) = rn;
+    MPN_COPY (PTR(r), rp, rn);
+
+    TMP_FREE;
+
+
+    d = mpz_class(r);
+
+    //return d;
+}
+
+
+
 
-FixedPointExp::FixedPointExp(mpz_t& g, mpz_t& p, int fieldsize)
+                FixedPointExp::FixedPointExp(mpz_t& g, mpz_t& p, int fieldsize)
 {
     mpz_init(m_g);
     mpz_init(m_p);
diff --git a/UTIL/math_util.hh b/UTIL/math_util.hh
index 537578f5797f13349232dceb7510cc5b4b6793cd..10dc45dc0b94ae7df8291a80e16053230dd26082 100755
--- a/UTIL/math_util.hh
+++ b/UTIL/math_util.hh
@@ -79,6 +79,11 @@ mpz_class mpz_class_exp_mul(mpz_class op, int prec);
 
 mpz_class mpz_class_log (mpz_class op, int lambda);
 
+void fastmul(mpz_class &c, mpz_class &a, mpz_class &b);
+void fastmul2(mpz_class &c, mpz_class &a, mpz_class &b);
+
+void fastpow(mpz_class &d, mpz_class &a, mpz_class &b_, mpz_class &c);
+void fastpow2(mpz_class &d, mpz_class &a, mpz_class &b_, mpz_class &c);
 mpz_class mpz_class_crt(const std::vector<mpz_class> &v, const std::vector<mpz_class> &m);
 
 inline mpz_class mpz_class_crt_2(const mpz_class &v1, const mpz_class &v2, const mpz_class &m1, const mpz_class &m2)
@@ -95,7 +100,6 @@ public:
 public:
     void powerMod(mpz_t& result, mpz_t& e);
 
-
     
 private:
     //create table
diff --git a/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache b/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache
index 9ee65a51b794f25e15b57d5f3565be0d59cdd0a2..da7a019fa0f6d000aab54caefb361cca3717372f 100644
--- a/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache
+++ b/cmake-build-debug/CMakeFiles/DAPPLE.dir/CXX.includecache
@@ -33,6 +33,8 @@ netinet/in.h
 -
 chrono
 -
+map
+-
 
 /home/rania/CLionProjects/DAPPLE-2.0/CRYPTO/EvalAdd.h
 DTPKC.h
diff --git a/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal b/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal
index ca5e116cf2417e483b0384ebca5d58b75d0a48f6..5b10db532ab819629330099cb1f832de7681ca7c 100644
--- a/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal
+++ b/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.internal
@@ -4,6 +4,7 @@
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o
  /home/rania/CLionProjects/DAPPLE-2.0/CRYPTO/DTPKC.cpp
  /home/rania/CLionProjects/DAPPLE-2.0/CRYPTO/DTPKC.h
+ /home/rania/CLionProjects/DAPPLE-2.0/UTIL/math_util.hh
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/mpz_class.hh
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/num_th_alg.hh
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/util_gmp_rand.h
@@ -671,6 +672,13 @@ CMakeFiles/DAPPLE.dir/TEST/main.cpp.o
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/num_th_alg.hh
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/util_gmp_rand.h
 CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/config.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/fac_table.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/fib_table.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/gmp-impl.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/gmp-mparam.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/longlong.h
+ /home/rania/CLionProjects/DAPPLE-2.0/LIB/gmp-6.1.2/mp_bases.h
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/math_util.cc
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/math_util.hh
  /home/rania/CLionProjects/DAPPLE-2.0/UTIL/mpz_class.hh
diff --git a/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make b/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make
index ed575eb508b55eeb57e7538d6400f5b0dafd64ac..da3baefcf9cb5a9197a1b2c10fe2cbb949f2f707 100644
--- a/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make
+++ b/cmake-build-debug/CMakeFiles/DAPPLE.dir/depend.make
@@ -3,6 +3,7 @@
 
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../CRYPTO/DTPKC.cpp
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../CRYPTO/DTPKC.h
+CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../UTIL/math_util.hh
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../UTIL/mpz_class.hh
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../UTIL/num_th_alg.hh
 CMakeFiles/DAPPLE.dir/CRYPTO/DTPKC.cpp.o: ../UTIL/util_gmp_rand.h
@@ -670,6 +671,13 @@ CMakeFiles/DAPPLE.dir/TEST/main.cpp.o: ../UTIL/mpz_class.hh
 CMakeFiles/DAPPLE.dir/TEST/main.cpp.o: ../UTIL/num_th_alg.hh
 CMakeFiles/DAPPLE.dir/TEST/main.cpp.o: ../UTIL/util_gmp_rand.h
 
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/config.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/fac_table.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/fib_table.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/gmp-impl.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/gmp-mparam.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/longlong.h
+CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../LIB/gmp-6.1.2/mp_bases.h
 CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../UTIL/math_util.cc
 CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../UTIL/math_util.hh
 CMakeFiles/DAPPLE.dir/UTIL/math_util.cc.o: ../UTIL/mpz_class.hh