diff --git a/CMakeLists.User.txt b/CMakeLists.User.txt index 31b38a1d0..7a819142c 100644 --- a/CMakeLists.User.txt +++ b/CMakeLists.User.txt @@ -17,7 +17,7 @@ cmake_minimum_required (VERSION 3.5.1) ### If you need your application to be linked statically, then run "cmake .. -DBUILD_STATIC=ON" project(demo CXX) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) option( BUILD_STATIC "Set to ON to include static versions of the library" OFF) find_package(OpenFHE) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20b2168ee..a53e1abac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,8 @@ endif() ### To use gcc/g++ on a Macintosh, you must set the Compilers ### here, not inside the project ##if(APPLE) -## set(CMAKE_C_COMPILER "/usr/local/bin/gcc-7") -## set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-7") +## set(CMAKE_C_COMPILER "/usr/local/bin/gcc-10") +## set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-10") ##endif() ### TODO: for now, we use CLang for Mac @@ -27,7 +27,7 @@ project (OpenFHE C CXX) set(OPENFHE_VERSION_MAJOR 1) set(OPENFHE_VERSION_MINOR 0) -set(OPENFHE_VERSION_PATCH 1) +set(OPENFHE_VERSION_PATCH 2) set(OPENFHE_VERSION ${OPENFHE_VERSION_MAJOR}.${OPENFHE_VERSION_MINOR}.${OPENFHE_VERSION_PATCH}) set(CMAKE_CXX_STANDARD 17) @@ -270,7 +270,11 @@ else() endif() if(ARCHITECTURE) - message(STATUS "Architecture is " ${ARCHITECTURE}) + if (${ARCHITECTURE} MATCHES "i386") + message(SEND_ERROR "The " ${ARCHITECTURE} " architecture is not supported") + else() + message(STATUS "Architecture is " ${ARCHITECTURE}) + endif() endif() # Size checks @@ -361,20 +365,21 @@ install(FILES ${CMAKE_BINARY_DIR}/src/core/config_core.h DESTINATION include/ope find_program(TAR "gtar") find_program(TAR "tar") -### several of the third-party tools use auto-make and autoconf -### we need to make sure that they are installed -execute_process(COMMAND autogen --version OUTPUT_VARIABLE AUTOGEN_VER) -# execute_process in MINGW by default does not run in a shell -if(MINGW) - execute_process(COMMAND sh autoconf --version OUTPUT_VARIABLE AUTOCONF_VER) -else() - execute_process(COMMAND autoconf --version OUTPUT_VARIABLE AUTOCONF_VER) -endif() - -string(LENGTH "${AUTOCONF_VER}" AUTOCONF_VER_LEN) +if(WITH_TCM OR WITH_NTL) + ### tcmalloc, NTL and GMP require autoconf/automake/libtool to be installed. + ### we need to make sure that they are: + execute_process(COMMAND autogen --version OUTPUT_VARIABLE AUTOGEN_VER) + # execute_process in MINGW by default does not run in a shell + if(MINGW) + execute_process(COMMAND sh autoconf --version OUTPUT_VARIABLE AUTOCONF_VER) + else() + execute_process(COMMAND autoconf --version OUTPUT_VARIABLE AUTOCONF_VER) + endif() -if( ${AUTOCONF_VER_LEN} EQUAL 0 ) - message(SEND_ERROR "Autoconf is not installed.") + string(LENGTH "${AUTOCONF_VER}" AUTOCONF_VER_LEN) + if( ${AUTOCONF_VER_LEN} EQUAL 0 ) + message(SEND_ERROR "Autoconf is not installed.") + endif() endif() #-------------------------------------------------------------------- diff --git a/README.md b/README.md index 58d8fc59d..b0f345834 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ OpenFHE also includes the following multiparty extensions of FHE: * Threshold FHE for BGV, BFV, and CKKS schemes * Proxy Re-Encryption for BGV, BFV, and CKKS schemes +OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above. + ## Links and Resources * [OpenFHE documentation](https://openfhe-development.readthedocs.io/en/latest/) diff --git a/docs/sphinx_rsts/intro/directory_structure.rst b/docs/sphinx_rsts/intro/directory_structure.rst index 5cda32ac1..620dcfa1d 100644 --- a/docs/sphinx_rsts/intro/directory_structure.rst +++ b/docs/sphinx_rsts/intro/directory_structure.rst @@ -25,7 +25,7 @@ The descriptions of library components are as follows: "benchmark","Code for benchmarking OpenFHE library components, using the Google Benchmark frameworks" "build","Binaries and build scripts (this folder is created by the user)" - "doc","Documentation of library components, including doxygen documentation generated by the make process." + "doc","Documentation of library components." "docker","Docker file and documentation." "src","Library source code. Each subcomponent has four or five subdirectories: include (for library header files), lib (for library source files), unittest (for google test cases), examples (for code samples), and optionally extras (for additional code samples)." "third-party","Code for distributions from third parties (includes NTL/GMP + git submodules for tcmalloc, cereal, google test, and google benchmark)" diff --git a/docs/sphinx_rsts/intro/installation/gmp_ntl.rst b/docs/sphinx_rsts/intro/installation/gmp_ntl.rst index 1f0a5f1d0..674556312 100644 --- a/docs/sphinx_rsts/intro/installation/gmp_ntl.rst +++ b/docs/sphinx_rsts/intro/installation/gmp_ntl.rst @@ -3,13 +3,32 @@ Instructions for installing GMP and NTL ======================================= -This section describes how to install GMP and NTL onto your system, and how to use them in OpenFHE. +This section describes how to install GMP and NTL onto your system, and how to use them in OpenFHE. Install ``autoconf`` if it is not already present: +.. topic:: on Linux + +:: + + sudo apt-get install autoconf + +.. topic:: on MacOS + +:: + + brew install autoconf + +.. topic:: on Windows + +:: + + pacman -S autoconf + .. note:: scroll to the bottom for an all-in-one install script The standard binary install using tools like ``apt-get`` will not work, and manual installation of GMP and NTL from the source code is needed. The steps are detailed below. Installing GMP and NTL for OpenFHE: + 1. First, download gmp-6.1.2.tar.lz from https://ftp.gnu.org/gnu/gmp/ :: diff --git a/docs/sphinx_rsts/intro/installation/installation.rst b/docs/sphinx_rsts/intro/installation/installation.rst index 65a4d49c7..7016af2fe 100644 --- a/docs/sphinx_rsts/intro/installation/installation.rst +++ b/docs/sphinx_rsts/intro/installation/installation.rst @@ -25,10 +25,10 @@ Welcome to the OpenFHE installation instructions! For OS-specific instructions, Build Instructions ################## -We use CMake to build OpenFHE. +We use CMake to build OpenFHE. OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above. -1. Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make, and autoconf. +1. Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make. 2. Clone the OpenFHE repo to your local machine. diff --git a/docs/sphinx_rsts/intro/installation/linux.rst b/docs/sphinx_rsts/intro/installation/linux.rst index 7a0b4fc1e..08f56d877 100644 --- a/docs/sphinx_rsts/intro/installation/linux.rst +++ b/docs/sphinx_rsts/intro/installation/linux.rst @@ -12,8 +12,8 @@ Installing OpenFHE on Linux sudo yum install cmake3 ln -s /usr/bin/cmake3 ~/bin/cmake - If you need to install a specific version of gcc, do the following (this example is for g++ v7): - ``sudo yum install devtoolset-7-gcc-c++`` + If you need to install a specific version of gcc, do the following (this example is for g++ v10): + ``sudo yum install devtoolset-10-gcc-c++`` 1. Install pre-requisites (if not already installed) and set the default compiler. @@ -22,21 +22,20 @@ Installing OpenFHE on Linux Note that ``sudo apt-get install g++-`` can be used to install a specific version of the compiler. You can use "g++ --version" to check the version of g++ that is found by the system. - Install ``g++``, ``cmake``, ``make``, and ``autoconf``. Sample commands using apt-get are listed below. It is possible that these are already installed + Install ``g++``, ``cmake`` and ``make``. Sample commands using apt-get are listed below. It is possible that these are already installed :: sudo apt-get install build-essential #this already includes g++ sudo apt-get install cmake - sudo apt-get install autoconf .. topic:: clang Typically g++ is the default compiler for Linux but clang++ can also be installed. - First install clang++, e.g., ``sudo apt-get install clang-9`` to install clang 9. + First install clang++, e.g., ``sudo apt-get install clang-11`` to install clang 11. - If installing an older version of clang, e.g., v6, you may also need to install OpenMP. The commands for this case are + If installing an older version of clang, you may also need to install OpenMP. The commands for this case are :: @@ -45,12 +44,12 @@ Installing OpenFHE on Linux sudo apt-get install libomp-dev - Then run the following two commands to configure clang/clang++ as the default compiler for C and C++ (default paths are used here). For clang 9: + Then run the following two commands to configure clang/clang++ as the default compiler for C and C++ (default paths are used here). For clang 11: :: - export CC=/usr/bin/clang-9 - export CXX=/usr/bin/clang++-9 + export CC=/usr/bin/clang-11 + export CXX=/usr/bin/clang++-11 For a default version of clang, e.g., v6 in Ubuntu 20.04: @@ -75,7 +74,14 @@ Installing OpenFHE on Linux .. note:: Note that cmake will check for any system dependencies that are needed for the build process. -4. The OpenFHE distribution includes some external libraries, such as ``GMP``. ``NTL`` and ``tcmalloc``. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options). +4. The OpenFHE distribution includes some external libraries, such as ``GMP``, ``NTL`` and ``tcmalloc``. If you want to use any of these libraries: + a) install ``autoconf``: + + :: + + sudo apt-get install autoconf + + b) enable them when you run cmake to force them to build (see instructions on cmake options). 5. Build OpenFHE by running the following command (this will take few minutes; using the ``-j `` command-line flag is suggested to speed up the build) @@ -114,13 +120,3 @@ To remove the files built by make, you can execute make clean To change the compiler, e.g., from g++ to clang++, or completely remove any cmake/make build files, delete the "build" folder and recreate it. - -Installing pre-requisites for doxygen -------------------------------------- - -To generate doxygen documentation, doxygen and graphviz dot need to be installed: - - :: - - sudo apt-get install doxygen - sudo apt-get install graphviz \ No newline at end of file diff --git a/docs/sphinx_rsts/intro/installation/macos.rst b/docs/sphinx_rsts/intro/installation/macos.rst index e86a714a4..e2f892a42 100644 --- a/docs/sphinx_rsts/intro/installation/macos.rst +++ b/docs/sphinx_rsts/intro/installation/macos.rst @@ -8,12 +8,11 @@ These instructions were tested in macOS Mojave but should also work for other re /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" -2. Install pre-requisites ``cmake``, ``autoconf``, and ``OpenMP`` library using Homebrew: +2. Install pre-requisites ``cmake`` and ``OpenMP`` library using Homebrew: :: brew install cmake - brew install autoconf brew install libomp 3. Clone the repo. @@ -40,7 +39,14 @@ Cmake will check for any system dependencies that are needed for the build proce If you get an error about OMP asking to rerun cmake, just run "cmake .." once more. -5. The OpenFHE distribution includes some external libraries, such as GMP. NTL and tcmalloc. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options). +5. The OpenFHE distribution includes some external libraries, such as ``GMP``, ``NTL`` and ``tcmalloc``. If you want to use any of these libraries: + a) install ``autoconf`` using Homebrew: + + :: + + brew install autoconf + + b) enable them when you run cmake to force them to build (see instructions on cmake options) 6. Build OpenFHE by running the following command (this will take few minutes; using the ``-j #`` make command-line flag is suggested to speed up the build, where # is the number of cores on your machine). @@ -76,4 +82,4 @@ To remove the files built by make, you can execute :: - make clean \ No newline at end of file + make clean diff --git a/docs/sphinx_rsts/intro/installation/windows.rst b/docs/sphinx_rsts/intro/installation/windows.rst index 345b6bc63..2d7a60148 100644 --- a/docs/sphinx_rsts/intro/installation/windows.rst +++ b/docs/sphinx_rsts/intro/installation/windows.rst @@ -16,7 +16,6 @@ to update all packages (you may need to run it twice as it often fails the first pacman -S mingw-w64-x86_64-gcc pacman -S mingw-w64-x86_64-cmake - pacman -S autoconf pacman -S make pacman -S git @@ -32,7 +31,15 @@ to update all packages (you may need to run it twice as it often fails the first Note that cmake will check for any system dependencies that are needed for the build process. -4. The OpenFHE distribution includes some external libraries, such as ``GMP`` and ``NTL``. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options). +4. The OpenFHE distribution includes some external libraries, such as ``GMP`` and ``NTL``. If you want to use any of these libraries: + + a) install ``autoconf``: + + :: + + pacman -S autoconf + + b) enable them when you run cmake to force them to build (see instructions on cmake options). 5. Build OpenFHE by running the following command (this will take few minutes; using the ``-j `` make command-line flag is suggested to speed up the build where threads is typically the number of cores or threads on your machine) @@ -87,12 +94,3 @@ To remove the files built by make, you can execute :: make clean - -Installing pre-requisites for doxygen -------------------------------------- -To generate doxygen documentation, doxygen and graphviz dot need to be installed: - -:: - - pacman -S doxygen - pacman -S mingw-w64-x86_64-graphviz diff --git a/docs/sphinx_rsts/misc/contributors.rst b/docs/sphinx_rsts/misc/contributors.rst index b7d7f0ca0..b7f0611da 100644 --- a/docs/sphinx_rsts/misc/contributors.rst +++ b/docs/sphinx_rsts/misc/contributors.rst @@ -57,6 +57,8 @@ We gratefully acknowledge intellectual and software contributions to the library * Daniele Micciancio (University of California San Diego, Duality Technologies) +* Rener Oliveira (BOCOM BBM Bank) + * Antonis Papadimitriou (Duality Technologies) * Nishanth Pasham (New Jersey Institute of Technology) @@ -67,6 +69,8 @@ We gratefully acknowledge intellectual and software contributions to the library * Ian Quah (Duality Technologies) +* Bastiaan Quast (International Telecommunication Union) + * Saraswathy Ramanathapuram Vancheeswaran (Duality Technologies) * Kurt Rohloff (Duality Technologies) diff --git a/docs/sphinx_rsts/misc/publications.rst b/docs/sphinx_rsts/misc/publications.rst index 04b1efcb5..d28dcc0f8 100644 --- a/docs/sphinx_rsts/misc/publications.rst +++ b/docs/sphinx_rsts/misc/publications.rst @@ -6,16 +6,16 @@ Homomorphic Encryption - Liu, Z., Micciancio, D., and Polyakov, Y., “Large-Precision Homomorphic Sign Evaluation using FHEW/TFHE Bootstrapping”, - [https://eprint.iacr.org/2021/1337]. + ASIACRYPT 2022 [https://eprint.iacr.org/2021/1337]. + +- Kim, A., Papadimitriou, A., and Polyakov, Y., “Approximate + Homomorphic Encryption with Reduced Approximation Error”, + CT-RSA 2022 [https://eprint.iacr.org/2020/1118]. - Kim, A., Polyakov, Y., and Zucca, V., “Revisiting Homomorphic Encryption Schemes for Finite Fields”, ASIACRYPT 2021 [https://eprint.iacr.org/2021/204]. -- Kim, A., Papadimitriou, A., and Polyakov, Y., “Approximate - Homomorphic Encryption with Reduced Approximation Error”, - [https://eprint.iacr.org/2020/1118]. - - Micciancio, D. and Polyakov, Y., “Bootstrapping in FHEW-like Cryptosystems”, WAHC 2021 – 9th Workshop on Encrypted Computing & Applied Homomorphic Cryptography [https://eprint.iacr.org/2020/086]. @@ -23,12 +23,12 @@ Homomorphic Encryption - Al Badawi, A., Polyakov, Y., Mi Mi Aung, K., Veeravalli, B., and Rohloff, K., “Implementation and Performance Evaluation of RNS Variants of the BFV Homomorphic Encryption Scheme”, IEEE Transactions - on Emerging Topics in Computing (IEEE TETC), to appear + on Emerging Topics in Computing (IEEE TETC), 2021, Vol. 9, No. 2., pp. 941-956 [https://eprint.iacr.org/2018/589]. - Blatt, M., Gusev, A., Polyakov, Y., Rohloff, K., and Vaikuntanathan, V., “Optimized Homomorphic Encryption Solution for Secure Genome-Wide - Association Studies”, BMC Medical Genomics, to appear + Association Studies”, BMC Medical Genomics, 2020, Vol. 13, Suppl. 7, No. 83 [https://eprint.iacr.org/2019/223]. - Halevi, S., Polyakov, Y., and Shoup, V., “An Improved RNS Variant of diff --git a/docs/static_docs/Release_Notes.md b/docs/static_docs/Release_Notes.md index 21e8d3e40..3560509aa 100644 --- a/docs/static_docs/Release_Notes.md +++ b/docs/static_docs/Release_Notes.md @@ -1,3 +1,8 @@ +12/23/2022: OpenFHE 1.0.2 (stable) is released + +* Fixes several compilation errors affecting selected environments +* Includes several documentation fixes + 11/30/2022: OpenFHE 1.0.1 (stable) is released * Fixed the serialization bug affecting DM/CGGI schemes (binfhe module) diff --git a/src/binfhe/include/binfhe-base-scheme.h b/src/binfhe/include/binfhe-base-scheme.h index 085c9eacf..43e46aa68 100644 --- a/src/binfhe/include/binfhe-base-scheme.h +++ b/src/binfhe/include/binfhe-base-scheme.h @@ -57,7 +57,7 @@ typedef struct { /** * @brief Ring GSW accumulator schemes described in - * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08 + * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086 */ class BinFHEScheme { public: diff --git a/src/binfhe/include/rgsw-acc-cggi.h b/src/binfhe/include/rgsw-acc-cggi.h index 451b9c3c3..90a31a88c 100644 --- a/src/binfhe/include/rgsw-acc-cggi.h +++ b/src/binfhe/include/rgsw-acc-cggi.h @@ -40,7 +40,7 @@ namespace lbcrypto { /** * @brief Ring GSW accumulator schemes described in - * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08 + * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086 */ class RingGSWAccumulatorCGGI : public RingGSWAccumulator { public: diff --git a/src/binfhe/include/rgsw-acc-dm.h b/src/binfhe/include/rgsw-acc-dm.h index 73da4dfc1..73bab3710 100644 --- a/src/binfhe/include/rgsw-acc-dm.h +++ b/src/binfhe/include/rgsw-acc-dm.h @@ -40,7 +40,7 @@ namespace lbcrypto { /** * @brief Ring GSW accumulator schemes described in - * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08 + * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086 */ class RingGSWAccumulatorDM : public RingGSWAccumulator { public: diff --git a/src/binfhe/include/rgsw-acc.h b/src/binfhe/include/rgsw-acc.h index f4322cd4b..1b9336d1e 100644 --- a/src/binfhe/include/rgsw-acc.h +++ b/src/binfhe/include/rgsw-acc.h @@ -43,7 +43,7 @@ namespace lbcrypto { /** * @brief Ring GSW accumulator schemes described in - * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08 + * https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086 */ class RingGSWAccumulator { public: diff --git a/src/binfhe/lib/binfhe-base-scheme.cpp b/src/binfhe/lib/binfhe-base-scheme.cpp index ce3fe877a..5cd4e2ff9 100644 --- a/src/binfhe/lib/binfhe-base-scheme.cpp +++ b/src/binfhe/lib/binfhe-base-scheme.cpp @@ -54,7 +54,7 @@ RingGSWBTKey BinFHEScheme::KeyGen(const std::shared_ptr para return ek; } -// Full evaluation as described in https://eprint.iacr.org/2020/08 +// Full evaluation as described in https://eprint.iacr.org/2020/086 LWECiphertext BinFHEScheme::EvalBinGate(const std::shared_ptr params, BINGATE gate, const RingGSWBTKey& EK, ConstLWECiphertext ct1, ConstLWECiphertext ct2) const { if (ct1 == ct2) { @@ -112,7 +112,7 @@ LWECiphertext BinFHEScheme::EvalBinGate(const std::shared_ptr params, const RingGSWBTKey& EK, ConstLWECiphertext ct) const { LWECiphertext ctprep = std::make_shared(*ct); @@ -537,7 +537,7 @@ RLWECiphertext BinFHEScheme::BootstrapFuncCore(const std::shared_ptr LWECiphertext BinFHEScheme::BootstrapFunc(const std::shared_ptr params, const RingGSWBTKey& EK, ConstLWECiphertext ct, const Func f, const NativeInteger fmod) const { diff --git a/src/binfhe/lib/rgsw-acc-cggi.cpp b/src/binfhe/lib/rgsw-acc-cggi.cpp index b45ff1bbc..ff12b7fec 100644 --- a/src/binfhe/lib/rgsw-acc-cggi.cpp +++ b/src/binfhe/lib/rgsw-acc-cggi.cpp @@ -88,7 +88,7 @@ void RingGSWAccumulatorCGGI::EvalAcc(const std::shared_ptr } } -// Encryption for the CGGI variant, as described in https://eprint.iacr.org/2020/08 +// Encryption for the CGGI variant, as described in https://eprint.iacr.org/2020/086 RingGSWEvalKey RingGSWAccumulatorCGGI::KeyGenCGGI(const std::shared_ptr params, const NativePoly& skNTT, const LWEPlaintext& m) const { NativeInteger Q = params->GetQ(); @@ -129,7 +129,7 @@ RingGSWEvalKey RingGSWAccumulatorCGGI::KeyGenCGGI(const std::shared_ptr params, const RingGSWEvalKey ek, RLWECiphertext& acc) const { uint32_t digitsG2 = params->GetDigitsG() << 1; diff --git a/src/core/include/lattice/ildcrtparams.h b/src/core/include/lattice/ildcrtparams.h index 1162a1dc6..e8aa24082 100644 --- a/src/core/include/lattice/ildcrtparams.h +++ b/src/core/include/lattice/ildcrtparams.h @@ -100,7 +100,6 @@ class ILDCRTParams : public ElemParams { OPENFHE_DEBUGEXP(cyclotomic_order); OPENFHE_DEBUGEXP(modulus); OPENFHE_DEBUGEXP(rootOfUnity); - usint numOfTower = 1; std::vector moduli; std::vector rootsOfUnity; @@ -115,7 +114,6 @@ class ILDCRTParams : public ElemParams { break; q = NextPrime(q, cyclotomic_order); - numOfTower++; } originalModulus = modulus; OPENFHE_DEBUGEXP(compositeModulus); diff --git a/src/core/lib/math/hal/bigintdyn/ubintdyn.cpp b/src/core/lib/math/hal/bigintdyn/ubintdyn.cpp index 8cdb8d256..52025b952 100644 --- a/src/core/lib/math/hal/bigintdyn/ubintdyn.cpp +++ b/src/core/lib/math/hal/bigintdyn/ubintdyn.cpp @@ -1200,7 +1200,6 @@ ubint ubint::ModExp(const ubint& b, const ubint& modulus) const ubint product(1); ubint Exp(b); - unsigned int loops = 0; #if 1 while (true) { // product is multiplied only if lsb bitvalue is 1 @@ -1216,7 +1215,6 @@ ubint ubint::ModExp(const ubint& b, const ubint& modulus) const } mid = mid * mid; mid = (mid.Mod(modulus)); - loops++; } #else while (true) { @@ -1228,7 +1226,6 @@ ubint ubint::ModExp(const ubint& b, const ubint& modulus) const break; } mid = (mid.ModMul(mid, modulus)); - loops++; } #endif return product; diff --git a/src/pke/examples/simple-real-numbers.cpp b/src/pke/examples/simple-real-numbers.cpp index 120740e44..20ee7dba7 100644 --- a/src/pke/examples/simple-real-numbers.cpp +++ b/src/pke/examples/simple-real-numbers.cpp @@ -154,10 +154,13 @@ int main() { * right shift and positive to left shift. Look at the output of this demo for * an illustration of this. * - * Keep in mind that rotations work on the entire ring dimension, not the - * specified batch size. This means that, if ring dimension is 8 and batch - * size is 4, then an input (1,2,3,4,0,0,0,0) rotated by 2 will become - * (3,4,0,0,0,0,1,2) and not (3,4,1,2,0,0,0,0). Also, as someone can observe + * Keep in mind that rotations work over the batch size or entire ring dimension (if the batch size is not specified). + * This means that, if ring dimension is 8 and batch + * size is not specified, then an input (1,2,3,4,0,0,0,0) rotated by 2 will become + * (3,4,0,0,0,0,1,2) and not (3,4,1,2,0,0,0,0). + * If ring dimension is 8 and batch + * size is set to 4, then the rotation of (1,2,3,4) by 2 will become (3,4,1,2). + * Also, as someone can observe * in the output of this demo, since CKKS is approximate, zeros are not exact * - they're just very small numbers. */