Home > Cryptography, HElib > Guide to HElib (#1)

Guide to HElib (#1)

Shai Halevi has released an implementation of the BGV cryptosystem over on github. I know a lot of people (myself include) have been wanting to play with FHE to get a better understanding of it. A while back I started a sage implementation of BGV (which I have never released). That helped a lot in understanding BGV. If anyone is interested in the very beta version of my sage code, let me know.

Given that HElib has now been released, I wanted to start playing with it and release my notes. So, here goes. In post #1 I will go over installation and playing with some of the test programs that come with HElib.

Install (Compilation)

Installation/compilation of HElib is quite easy if you get things right. First of all you will need NTL (number theory library). I tried using the default version of NTL for my version of Ubuntu, but HElib wouldn’t compile. So, get the newest version 6.0.0. Compile and install (./configure; make; make check; make install).

Then head over to github and clone the git repository (git clone https://github.com/shaih/HElib.git). Compilation of HElib is pretty easy (cd HElib/src; make). This will build a library against which you can statically compile your own code which can use HElib. There are, however, also some test programs you might be interested in (named Test_*). To compile these do (make test).

Test_General

Within Test_General.cpp we can learn a lot about HElib and how to use it in code. First off is the main function. There are a lot of parameters. Running (./Test_General_x –help) explains what these parameters are (to some degree). I’ll go in more detail on some of them here. The parameters are:

R is the number of rounds
p is the plaintext base [default=2]
r is the lifting [default=1]
d is the degree of the field extension [default==1]
(d == 0 => factors[0] defined the extension)
c is number of columns in the key-switching matrices [default=2]
k is the security parameter [default=80]
L is the # of primes in the modulus chain [default=4*R]
s is the minimum number of slots [default=4]
m is a specific modulus

R is the number of rounds of testing (basically a parameter to a for loop around the testing). p is the plaintext base. Basically this is the plaintext space. Setting p=2 basically says that plaintexts are in {0,1}. p should be a prime number. d as it says is the degree of the field extension. GHS12 explains (section 2.3) what this is:

We note that the values in the plaintext slots are not just bits, rather they are polynomials modulo the irreducible F_j’s, so they can be used to represents elements in extension fields GF(2^d).

k as said, is the security parameter. A default of 80 is 80 bits of security. The length of the modulus chain, L, allowes for “leveled” FHE. L reduces or eliminates the amount of bootstrapping (see BGV11). Finally, s tells how many (at a minimum) number of plaintext slots you’d like. Set this too high and it will complain.

The basic parameters given in the file are pretty good for testing. Take a look at the GHS12 paper for more on parameter tuning. In that paper they look specifically at tuning BGV for AES.

  1. David
    May 7, 2013 at 9:23 am

    I am trying to compile HElib on Windows using VS8, but so far no success. Can you add a section detailing how to get the library working on Windows? Thx.

    • pwnhome
      May 7, 2013 at 5:19 pm

      Probably won’t post a comprehensive section on HElib for Windows any time soon (hardly use Windows these days). Do you have NTL built? They have Windows instructions. What errors are you getting?

      • David
        May 7, 2013 at 8:16 pm

        Yes, I managet to get NTL compiled on windows. However, HElib is not compiling. Here are some of the error I am getting:
        error C2668: ‘log’ : ambiguous call to overloaded function
        error C2065: ‘__func__’ : undeclared identifie
        error C2065: ‘__func__’ : undeclared identifier
        error C2065: ‘M_PI’ : undeclared identifier
        error C2039: ‘zMstar’ : is not a member of ‘FHEcontext’
        error C2039: ‘M’ : is not a member of ‘PAlgebra’
        error C2065: ‘M_PI’ : undeclared identifier
        error C2039: ‘zMstar’ : is not a member of ‘FHEcontext’

        When I created the HElib project in VS8, I simply imported the .cpp and .h files and referenced the ntl.lib library.
        Is there extra configurations in VS8 that need to be added?

      • pwnhome
        May 8, 2013 at 5:52 am

        Did you add the NTL header files to VS8? As HElib uses NTL, the compiler needs to know where the NTL header files are. Are there file names and line numbers associated with those error messages? For example, where is the call to ‘log’ that is referenced in the first error?

  2. David
    May 10, 2013 at 5:45 pm

    Yes, I already added the NTL header file to the project.
    Here are more details about the errors:
    Error 6 error C2668: ‘log’ : ambiguous call to overloaded function c:\documents and settings\daghir\my documents\visual studio 2008\projects\helib\helib-master\src\cgauss.cpp 89 HElib

    Error 24 error C2065: ‘__func__’ : undeclared identifier c:\documents and settings\daghir\my documents\visual studio 2008\projects\helib\helib-master\src\cmodulus.cpp 152 HElib

    Error 4 error C2065: ‘M_PI’ : undeclared identifier c:\documents and settings\daghir\my documents\visual studio 2008\projects\helib\helib-master\src\cgauss.cpp 33 HElib

    Error 109 error C2039: ‘zMstar’ : is not a member of ‘FHEcontext’ c:\documents and settings\daghir\my documents\visual studio 2008\projects\helib\helib-master\src\old-test_fhe.cpp 18 HElib

    Error 110 error C2039: ‘M’ : is not a member of ‘PAlgebra’ c:\documents and settings\daghir\my documents\visual studio 2008\projects\helib\helib-master\src\old-test_fhe.cpp 34 HElib

    • pwnhome
      May 27, 2013 at 12:32 pm

      Not really sure what is up and I haven’t had any time to play with compiling the library in Windows. Good luck though. Sorry I couldn’t help more.

  3. George
    May 28, 2013 at 6:33 am

    Dear pwnhoem,

    I was also trying to compile HElib in Linux, and what get is

    In file included from bluestein.cpp:33:
    bluestein.h:64: error: expected initializer before ‘<’ token
    compilation terminated due to -Wfatal-errors.
    make: *** [bluestein.o] Error 1

    Do you have any ideas what could cause it?

    Cheers.

    • pwnhome
      May 28, 2013 at 6:42 am

      I believe I had the same problem and it had to do with not having the proper version of NTL installed. Make sure you have NTL 6.0.0 (see link in my post).

  4. George
    May 28, 2013 at 7:20 am

    Dear pwnhome,

    thank you for your quick reply! I installed NTL 6.0.0, just as you advised in your post. And when I run “make check”, I see something like … for all the tests.

    making QuadTest
    make[1]: Entering directory `/home/George/Downloads/ntl-6.0.0/src’
    g++ -I../include -I. -O2 -o QuadTest QuadTest.c ntl.a -lm #LSTAT
    make[1]: Leaving directory `/home/George/Downloads/ntl-6.0.0/src’
    running QuadTest
    QuadTest OK

    But I still get the following error every time I try to install HElib:

    ~/Downloads/HElib-master/src$ make
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c bluestein.cpp
    In file included from bluestein.cpp:33:
    bluestein.h:64: error: expected initializer before ‘<’ token
    compilation terminated due to -Wfatal-errors.
    make: *** [bluestein.o] Error 1

  5. George
    May 28, 2013 at 8:46 am

    upd: was an internal error. Solved it by adding to the CFLAGS (line 19 in the Makefile) the exact path to where NTL is installed in:
    CFLAGS = -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -I$$HOME/Downloads/ntl-6.0.0/include/

    That solved it! Had this problem only because I couldn’t (didn’t have root rights) install NTL in the standard /usr/local directory.

    • pwnhome
      May 28, 2013 at 9:07 am

      Glad you got it working. I was going to guess that there was something wrong with how NTL header files were being included.

  6. George
    May 29, 2013 at 3:42 am

    Excited to see further articles in the “Guide to HElib” series!

  7. ram
    June 19, 2013 at 4:11 am

    Dear pwnhome,
    I installed NTL 6.0.0 successfully.But Iam getting following errors when I am trying to “make” HElib/src…..Requesting help in this issue.
    Thank you,

    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c NumbTh.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c timing.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c bluestein.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c PAlgebra.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c CModulus.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c FHEContext.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c IndexSet.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c DoubleCRT.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c SingleCRT.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c FHE.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c KeySwitching.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c Ctxt.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c EncryptedArray.cpp
    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c replicate.cpp
    ar ruv fhe.a NumbTh.o timing.o bluestein.o PAlgebra.o CModulus.o FHEContext.o IndexSet.o DoubleCRT.o SingleCRT.o FHE.o KeySwitching.o Ctxt.o EncryptedArray.o replicate.o
    ar: creating fhe.a
    a – NumbTh.o
    a – timing.o
    a – bluestein.o
    a – PAlgebra.o
    a – CModulus.o
    a – FHEContext.o
    a – IndexSet.o
    a – DoubleCRT.o
    a – SingleCRT.o
    a – FHE.o
    a – KeySwitching.o
    a – Ctxt.o
    a – EncryptedArray.o
    a – replicate.o

    • pwnhome
      June 19, 2013 at 5:41 am

      Those don’t look like errors at all. It looks like everything has compiled properly. Do you have an fhe.a file in the directory after this is run? If so, everything is correct.

  8. ram
    June 19, 2013 at 6:33 am

    Thanks for quick reply.I have fhe.h file but when I execute ” make test” it gave me like this:

    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -o Test_General_x Test_General.cpp fhe.a -L/usr/local/lib -lntl -lgmp -lm
    /usr/bin/ld: cannot find -lgmp
    collect2: error: ld returned 1 exit status
    make: *** [Test_General_x] Error 1

    due to which I thought there was ERROR in “make”.
    Thank you
    cheers

    • pwnhome
      June 19, 2013 at 6:47 am

      Okay, that is a problem. You need libgmp. Should be available in your package repositories. Might need the -dev version too. In ubuntu, the two packages are libgmp10 and libgmp-dev.

  9. ram
    June 19, 2013 at 6:50 am

    okay …I will do that…Thank you very much. waiting to see more articles from you.
    Thank you

  10. ram
    June 24, 2013 at 6:09 am

    Dear pwnhome,
    Do I need to edit my ” Makefile ” when I compile my programs using HElib…I am not good at it…so Can you please help me know how to edit my MakeFile to link my program while compiling..
    Thanks in advance,

    • pwnhome
      June 24, 2013 at 2:29 pm

      Which Makefile? Did you create your own or are you using the one from post #3? If using the one from post #3, yes you’ll have to modify it and the details are in the post.

  11. ram
    June 24, 2013 at 10:15 pm

    thanks .I didn’t see your post#3….That’s what I actually need.sorry for troubling you .

  12. nixfreak
    July 15, 2013 at 1:52 pm

    Compile HElib on Ubuntu 12
    1. Install build-essential, libgmp3c2 and libgmp3-dev
    2. download latested NTL – cd into /src and ./configure, make ,make check, make install
    3. Compile HElib download zip or clone the master; cd /src and make, make test.

    Should have a working compiled version of HElib now.

    • Pradeep
      January 6, 2017 at 6:58 am

      Hi dear, whatever you told i have done that but what should I do to get the output of the Test_General.cpp. I mean which command I should use. I tried with ./a.out but it’s not working.
      Thanks

      • pmishra2017
        January 8, 2017 at 8:40 am

        I resolved my problem. Thank you

  13. Bruce
    September 20, 2013 at 8:06 am

    Dear pwnhome,
    I installed NTL 6.0.0 successfully.But Iam getting following errors when I am trying to “make” HElib/src…..Requesting help in this issue.
    Thank you,

    g++ -g -O2 -Wfatal-errors -Wshadow -Wall -I/usr/local/include -c NumbTh.cpp
    In file included from NumbTh.cpp:16:
    NumbTh.h:25:20: error: NTL/ZZ.h: No such file or directory
    NumbTh.h:26:22: error: NTL/ZZ_p.h: No such file or directory
    NumbTh.h:27:21: error: NTL/ZZX.h: No such file or directory
    NumbTh.h:28:22: error: NTL/GF2X.h: No such file or directory
    NumbTh.h:29:24: error: NTL/vec_ZZ.h: No such file or directory
    NumbTh.h:30:25: error: NTL/xdouble.h: No such file or directory
    NumbTh.h:31:28: error: NTL/mat_lzz_pE.h: No such file or directory
    NumbTh.h:32:26: error: NTL/mat_GF2E.h: No such file or directory
    NumbTh.h:33:33: error: NTL/lzz_pXFactoring.h: No such file or directory
    NumbTh.h:34:31: error: NTL/GF2XFactoring.h: No such file or directory
    In file included from NumbTh.cpp:16:
    NumbTh.h:41: error: expected constructor, destructor, or type conversion before ‘typedef’
    compilation terminated due to -Wfatal-errors.

    I installed the NTL in the following path:
    /home/bruce/sw/
    but the program can’t find that library ,how to solve this problem?
    Wating for your reply ,Thank you!

  14. Bruce
    September 20, 2013 at 8:11 am

    Dear pwnhome,
    Should I install gmp before installing the NTL?
    I’m not good at it,thanks in advance!

  15. Bruce
    September 20, 2013 at 8:40 am

    Thank you! I have solved the problem ,Excited to see further articles in the “Guide to HElib” series!

    • pwnhome
      October 24, 2013 at 7:47 am

      Glad you solved your problem. I’ve been pretty busy, but will hopefully have time eventually to do another post.

  16. l0re
    October 11, 2013 at 4:39 pm

    Hi, thank you for the infos! I would be really interested in you sage efforts. Would be great, if you put the source somewhere.

  17. kasmire
    October 25, 2013 at 3:47 am

    Hello pwnhome,
    am having problem compiling the HELib. am using eclipse on windows to compile the lib but am getting several error message:

    **** Rebuild of configuration Debug for project FHEcode ****

    **** Internal Builder is used for build ****
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\SingleCRT.o ..\HElib\src\SingleCRT.cpp
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\bluestein.o ..\HElib\src\bluestein.cpp
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\DoubleCRT.o ..\HElib\src\DoubleCRT.cpp
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\replicate.o ..\HElib\src\replicate.cpp
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\cgauss.o ..\HElib\src\cgauss.cpp
    ..\HElib\src\cgauss.cpp: In function `int main()’:
    ..\HElib\src\cgauss.cpp:53: warning: unused variable ‘s’
    g++ -IC:\boost -ID:\Downloads\WinNTL-6_0_0\WinNTL-6_0_0\include -O0 -g3 -Wall -c -fmessage-length=0 -o HElib\src\PAlgebraMod.o ..\HElib\src\PAlgebraMod.cpp
    ..\HElib\src\PAlgebraMod.cpp:53: error: `PAlgebraModTwo’ has not been declared
    ..\HElib\src\PAlgebraMod.cpp: In function `void init(const NTL::GF2X&)’:
    ..\HElib\src\PAlgebraMod.cpp:56: error: `zmStar’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:57: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:57: error: type `’ argument given to `delete’, expected pointer
    ..\HElib\src\PAlgebraMod.cpp:58: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:59: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:60: error: `crtCoeffs’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:58: warning: unused variable ‘PhimXmod’
    ..\HElib\src\PAlgebraMod.cpp:59: warning: unused variable ‘factors’
    ..\HElib\src\PAlgebraMod.cpp:60: warning: unused variable ‘crtCoeffs’
    ..\HElib\src\PAlgebraMod.cpp:66: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:66: error: type `’ argument given to `delete’, expected pointer
    ..\HElib\src\PAlgebraMod.cpp:67: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:67: error: `zmStar’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:72: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:75: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:81: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:101: error: `crtCoeffs’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp: At global scope:
    ..\HElib\src\PAlgebraMod.cpp:157: error: `PAlgebraMod2r’ has not been declared
    ..\HElib\src\PAlgebraMod.cpp: In function `void init(long unsigned int)’:
    ..\HElib\src\PAlgebraMod.cpp:163: error: `zmStar’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:163: error: `modTwo’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:167: error: `rr’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:168: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:168: error: type `’ argument given to `delete’, expected pointer
    ..\HElib\src\PAlgebraMod.cpp:169: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:170: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:171: error: `crtCoeffs’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:167: warning: unused variable ‘rr’
    ..\HElib\src\PAlgebraMod.cpp:169: warning: unused variable ‘PhimXmod’
    ..\HElib\src\PAlgebraMod.cpp:170: warning: unused variable ‘factors’
    ..\HElib\src\PAlgebraMod.cpp:171: warning: unused variable ‘crtCoeffs’
    ..\HElib\src\PAlgebraMod.cpp:193: error: `rr’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:196: error: `mod2rContext’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:198: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:198: error: type `’ argument given to `delete’, expected pointer
    ..\HElib\src\PAlgebraMod.cpp:199: error: `PhimXmod’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:200: error: `factors’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:205: error: `crtCoeffs’ was not declared in this scope
    ..\HElib\src\PAlgebraMod.cpp:193: warning: unused variable ‘rr’
    ..\HElib\src\PAlgebraMod.cpp:196: warning: unused variable ‘mod2rContext’
    ..\HElib\src\PAlgebraMod.cpp: At global scope:
    ..\HElib\src\PAlgebraMod.cpp:219: error: expected initializer before ‘<' token
    ..\HElib\src\PAlgebraMod.cpp:229: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:229: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:229: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:231: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:231: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:231: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:236: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:245: error: explicit instantiation of non-template `bool PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:245: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:246: error: explicit instantiation of non-template `bool PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:246: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:253: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:270: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:270: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:270: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:272: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:272: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:272: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:279: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:297: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:297: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:297: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:299: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:299: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:299: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:305: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:321: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:321: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:321: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:323: error: variable or field `PAlgebraModTmpl' declared void
    ..\HElib\src\PAlgebraMod.cpp:323: error: explicit instantiation of non-template `int PAlgebraModTmpl'
    ..\HElib\src\PAlgebraMod.cpp:323: error: expected `;' before '<' token
    ..\HElib\src\PAlgebraMod.cpp:336: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:365: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:399: error: expected initializer before '<' token
    ..\HElib\src\PAlgebraMod.cpp:449: error: expected initializer before '<' token
    Build error occurred, build is stopped
    Time consumed: 5516 ms.

    I will appreciate if you can be of help. Thanks

    • iman
      November 5, 2014 at 6:14 am

      I have the same problem. Did you get any solution?

  18. Abhilash K Pai
    March 17, 2014 at 3:23 am

    Thank you for such an informative post…

    I am beginner in HElib and i have a doubt regarding on how to do read a matrix which is as follows:

    2.4600000e+002 7.0000000e+001 2.5247914e+000
    1.3400000e+002 8.2000000e+001 -1.4981969e+000
    1.3800000e+002 1.3100000e+002 -4.7089386e-001
    7.4000000e+001 1.7100000e+002 -3.0689932e+000
    3.8000000e+001 2.0500000e+002 -1.5707963e+000
    6.5000000e+001 2.3600000e+002 -2.9267773e+000
    2.8000000e+001 4.7000000e+001 1.9974238e+000
    2.7000000e+002 7.1000000e+001 -9.0724060e-001

    please help me… thnk you..

  19. Sundhara Kumar
    July 11, 2014 at 2:00 am

    can u mail me the sage code that u had implemented? i also want to explore in FHE

  20. edwardz
    July 11, 2015 at 9:19 pm

    can u mail me the sage code that u had implemented? i also want to explore in FHE. thx!

  21. Gaurav
    June 19, 2016 at 1:35 pm

    Can anybody hep me with this?? Error while make…
    g++ -g -O2 -c CModulus.cpp
    CModulus.cpp: In member function ‘void Cmodulus::FFT(NTL::vec_long&, const NTL::ZZX&, long int) const’:
    CModulus.cpp:200:5: error: ‘PreconditionedRemainder’ was not declared in this scope
    PreconditionedRemainder prem(zz_p::modulus(), sz);
    ^
    CModulus.cpp:200:29: error: expected ‘;’ before ‘prem’
    PreconditionedRemainder prem(zz_p::modulus(), sz);
    ^
    CModulus.cpp:204:44: error: ‘prem’ was not declared in this scope
    tmp.rep[i].LoopHole() = prem(x.rep[i]);
    ^
    make: *** [CModulus.o] Error 1

  22. Dinh Ton
    February 22, 2019 at 10:37 pm

    Can you mail me the sage code that you implemented?
    Thanks,

  1. June 16, 2016 at 8:38 pm

Leave a reply to Bruce Cancel reply