Questions tagged [ntl]

NTL is a high-performance, portable C++ library licensed under GPL providing data structures and algorithms for arbitrary length integers; for vectors, matrices, and polynomials over the integers and over finite fields; and for arbitrary precision floating point arithmetic.

NTL (A Library For Doing Number Theory) is a high-performance, portable C++ library licensed under GPL providing data structures and algorithms for arbitrary length integers; for vectors, matrices, and polynomials over the integers and over finite fields; and for arbitrary precision floating point arithmetic.

See https://libntl.org/ for more details.

81 questions
2
votes
2 answers

how to include NTL using CMake

I use this line to compile a simple program: g++ main.cc -lntl -lm -lgmp How do you include this into CMake? find_package(NTL REQUIRED) find_package(GMP REQUIRED) Doesn't work. And gives the following error: CMake Error at CMakeLists.txt:30…
kirill_igum
  • 3,953
  • 5
  • 47
  • 73
1
vote
1 answer

How to link a C++ program to the NTL library using Bazel

I would like to using Bazel to build a C++ project that links to some external libraries such as NTL. However, I can't find a way to make Bazel to build any program that includes NTL. Here is an example. Consider the following file…
DWS
  • 215
  • 2
  • 10
1
vote
1 answer

Why did it show "InvMod: inverse undefined" when used CRT algorithm in NTL library?

I tried to use NTL library to implement my cryptographic algorithm. However, it showed me someting wromg about CRT algorithm. CRT is short for Incremental Chinese Remaindering and it is defined as following: long CRT(ZZ& a, ZZ& p, const ZZ& A, const…
Land
  • 171
  • 11
1
vote
1 answer

Cannot run HElib well, but it builds on Windows 10 x64

I'd really appreciate some help getting HElib to work on Windows 10 x64 using the MSVC 2017 compiler. I successfully managed to compile its dependency, NTL, using the same compiler by following this tutorial and also ran its tests, so it seems to…
PhantomR
  • 605
  • 4
  • 16
1
vote
1 answer

Inverting a ZZ_p matrix in NTL

I am trying to generate a random binary matrix and its inverse mod q where q is a power of 2. Sometimes when the determinant of my matrix is invertible modulo q (so the matrix over Z_q is invertible), I am getting the error "InvMod:inverse undefined…
user11235
  • 11
  • 1
1
vote
1 answer

Where is "struct _ntl_gbigint_body" defined?

I am browsing NTL code, but can' find struct _ntl_gbigint_body definition: $ grep -r _ntl_gbigint_body * include/NTL/ZZ.h:WrappedPtr<_ntl_gbigint_body, Deleter> rep; include/NTL/lip.h:struct _ntl_gbigint_body; include/NTL/lip.h:typedef…
Nan Xiao
  • 16,671
  • 18
  • 103
  • 164
1
vote
1 answer

JNI build shared library using static NTL library

I wrote C++ code for JNI then built shared library. This shared lib is using NTL static library. But it gets following error. Compiler configuration and error (Netbeans): g++ -c -O2 -s -I/usr/lib/jvm/default-java/include…
Maxr
  • 45
  • 4
1
vote
1 answer

Convert polynomial ZZX or ZZ_pX to string

NTL how to convert polynomial (ZZX or ZZ_pX) to string and how to assign string input to the polynomial like cin and cout operators? I tried like the following: ZZX a = conv("[2 3 12]") But it gets error.
Maxr
  • 45
  • 4
1
vote
1 answer

Extended polynomials in library NTL

There is code is written using NTL library: int main() { ZZ_p::init(ZZ(5)); // define GF(5) ZZ_pX P; BuildIrred(P, 4); // generate an irreducible polynomial P // of degree 4 over GF(5) …
magrif
  • 396
  • 4
  • 20
1
vote
1 answer

NTL Library ref_GF2 Run-time Error

I am using the NTL C++ Library. On trying to execute the following code: NTL::ref_GF2 *zero = new NTL::ref_GF2(); NTL::ref_GF2 *one = new NTL::ref_GF2(); set(*one); I am getting an EXC_BAD_INSTRUCTION error: ref_GF2 operator=(long a) { unsigned…
1
vote
2 answers

How to use Gdb debugger to find value of ZZ object from Number Theory Library?

I use gdb debugger to print values of a variable which is of type ZZ. This data type is defined in Number Theory Library or NTL. When I use "print x" to find out my variable's value I obtain something like this: print x $1 = {rep=0xab2cc54}. I…
1
vote
1 answer

Cannot link statically program with ntl library

When I want to create a static build for my code (I want to run this code on the server) I get a strange problem: /usr/local/lib/libntl.a(lip.o): In function `redc(void*, void*, long, unsigned long,…
pkruk
  • 809
  • 1
  • 7
  • 24
1
vote
2 answers

NTL - how to get the integer representation of an element in GF(2^n)

Is there a way to get the integer representation of that vector of coefficients? i.e. in a way that the highest degree coefficient is the MSB of that integer and the coefficient of x^0 is the LSB? when using the method BytesFromGF2X it results in a…
Bush
  • 2,433
  • 5
  • 34
  • 57
1
vote
2 answers

Compiling my Boost/NTL program with c++ on Linux

I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++. Both sides consist of several headers and cpp files. Both project compile…
Martin Lauridsen
  • 341
  • 4
  • 12
1
vote
1 answer

Generating random element in $GF(2^x)$ in NTL

I'm trying to study part of the NTL functionality related to finite field arithmetics, but something weird is happening. I'm trying to generate 2 random elements in the field $GF(2^8)$ and do addition and subtraction with them. But it seems that the…
Bush
  • 2,433
  • 5
  • 34
  • 57