NTL: A Library for doing Number Theory
NTL is a high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers, and for vectors, matrices, and polynomials over the integers and over finite fields.
NTL数论库有很多Miracl没有的函数,包括LLL算法等等。
#include <NTL/ZZ.h>
#include <windows.h>
//注意包含头文件的顺序,如果顺序不对可能编译失败
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
ZZ x,y,z;
z=x+y;
return 0;
}
说明:下载WinNTL-5_5_2,在VC++ 6.0中测试成功,其他的VC++版本没有测试。
引用:
“TIP: When writing windows applications using NTL (as opposed to console applications) you might want to compile your program with the NTL_NO_MIN_MAX macro defined. This suppresses the declaration of several min and max functions in file tools.h that conflict with macro names in the MFC header files. Do not attempt to build the library with this macro defined -- only programs that use the library. ”
因为NTL的某些命名与MFC有冲突,所以生成控制台程序没错误但在MFC程序中使用的时候错误多多。如果编译出现“error C2062: type 'int' unexpected”等错误的时候,请将
#include <windows.h>
#include <NTL/ZZ.h>
改为
#include <NTL/ZZ.h>
#include <windows.h>
总之#include <windows.h>,要放在NTL头文件之下。
附件包含WinNTL-5_5_2.rar、NTL.lib及测试工程。