e-antic
(Real Embedded) Algebraic Number Theory
e-antic is a C/C++/Python library to deal with real embedded number fields built on top of ANTIC. It aims to provide the fastest possible exact arithmetic operations and comparisons.
Source tarballs can be downloaded at https://github.com/flatsurf/e-antic/releases.
This repository contains two related projects:
The dependencies are:
We compute $a^2 - 2$ in the C++ interface where $a$ is a root of $x^3 - 3x + 1$.
auto K = eantic::renf_class::make("x^3 - 3*x + 1", "x", "0.34 +/- .01");
auto a = K->gen();
auto b = a.pow(2) - 2;
Our documentation has more details about this example and also shows you how to do the same computation with the C interface and the Python interface.
If you have cloned the source repository, make sure to pull in all the third-party header-only libraries by running:
git submodule update --init
If you are distributing e-antic or you are a purist who only wants to interact with autotools directly, then you should skip to the next section. Otherwise, we strongly recommend that you install pixi and then use the following commands:
pixi run test
build e-antic and run the libeantic and pyeantic test suitespixi run sage
build e-antic and spawn SageMath with the local libeantic and pyeantic installedpixi run doc
to build and preview the documentationpixi run compile-commands
to generate a compile_commands.json
that your IDE might be able to use to make sense of this projectIf you have cloned the source directory and you decided not to use pixi, you will need to setup the configure script and Makefile using autotools. That is
git submodule update --init
./bootstrap
If you obtained a tarball of the sources or if the preceding step worked, you can now run
./configure
make
make check # to run our test suite
make install # to install into /usr/local
If you happen to have any of FLINT, Arb, or ANTIC installed in a non standard
directory, you will have to specify the CPPFLAGS
and LDFLAGS
variables for
the configure script
./configure CPPFLAGS=-I/my/path/include LDFLAGS=-L/my/path/lib
For best performance run CFLAGS="-O3" CXXFLAGS="-O3" ./configure
instead of
./configure
. You might want to add -g3
to CFLAGS
and CXXFLAGS
which
does not hurt performance but gives a better debugging experience. For the best
debugging experience, you might want to replace -O3
with -Og
or even -O0
but the latter results in poor performance.
If your compiler supports it, you can try to add -fvisibility=hidden -fvisibility-inlines-hidden
to your CXXFLAGS
. This hides internal bits in
the resulting library which have lead to crashes in the past due to conflicting
header-only libraries.
If your linker supports it, you should use ./configure --with-version-script
to shrink the resulting shared library to an exact curated list of versioned
symbols.
perf works well to profile when you make sure that CFLAGS
and CXXFLAGS
contain -fno-omit-framepointer
. You can then for example run our test suite
with perf record --call-graph dwarf make check
. Apart from perf itself there
are several ways to analyze the output,
hotspot might be the most convenient one at
the time of this writing.
For more detailed but generic instructions please refer to the INSTALL file.
If you have tried out e-antic, we are thrilled to learn about your experiences. If you ran into any problems or have suggestions for improvement, please create an issue.
If you want to contribute to e-antic, pull requests are always welcome :heart:
We are also happy to walk you through the process personally if you are unsure how to get started. Feel free to reach out in the #flatsurf stream on Zulip in any case.
e-antic is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. See https://www.gnu.org/licenses/.
If you have used this project in the preparation of a publication, please cite it as described on our zenodo page.