|
NTLib - Number Theory Library 0.9
|
NTLib is a C++ template library containing common number theory implementations. All library types and templates are compatible to one another and can easily be combined to solve mathematical programming problems.
The main motivation for NTLib was to have a generic library for Project Euler problems. As such, most of the first 100 problems can easily solved with NTLib in just a few lines of C++ code.
See here for the complete Doxygen documentation.
NTLib uses up-to-date C++ features. In particular:
As a consequence (especially because of the modules), you need recent tooling to sucessfully compile the library. A working set of tools under Ubuntu 24.04 LTS is:
Clone NTLib into a new ntlib directory:
There are no git submodules and no other dependencies are required to use NTLib.
TODO (pjungeblut): Document how to include NTLib using CMake.
If you don't just want to use but extend/adapt NTLib, this is how to build all unit tests: Move into the ntlib directory and configure CMake using the debug preset (there is also a release preset to build everything in release mode). Then build the library and unit tests using the tests preset.
To run the tests, navigate to build/debug/ (or build/release/) and run ctest.
Each module comes with its own unit test which can be build individually.
For example, consider the base module. The following can be used to build and run only the unit tests for the base module:
Note: This requires gcovr to be installed.
Note: This currently only works with clang. For other compilers, adapt the --gcov-executable flag in the root CMakeLists.txt file.
The following can be used to run all tests and execute coverage reports for the library. The report is written to build/tests/coverage/index.html.
This software is licensed under the MIT license. See LICENSE for details. NTLib is still in development. Therefore, things will break and the API/ABI will change.
Feedback is always welcome.