Skip to content

Commit

Permalink
Wrap Calcium fields/numbers (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson authored Jun 3, 2021
1 parent 87e36df commit d530e05
Show file tree
Hide file tree
Showing 19 changed files with 2,726 additions and 137 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AbstractAlgebra = "^0.17.1"
Antic_jll = "~0.200.400"
Arb_jll = "~200.1900.0"
BinaryProvider = "0.4, 0.5"
Calcium_jll = "~0.300.0"
Calcium_jll = "~0.400.0"
FLINT_jll = "^200.700.0"
LoadFlint = "^0.5.0"
RandomExtensions = "0.4.2"
Expand Down
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
append!(dependencies, [
"build_Arb.v200.1900.0.jl",
"build_Antic.v0.200.400.jl",
"build_Calcium.v0.300.0.jl",
"build_Calcium.v0.400.0.jl",
])

for file in dependencies
Expand Down
48 changes: 0 additions & 48 deletions deps/build_Calcium.v0.300.0.jl

This file was deleted.

48 changes: 48 additions & 0 deletions deps/build_Calcium.v0.400.0.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using BinaryProvider # requires BinaryProvider 0.3.0 or later

# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
products = [
LibraryProduct(prefix, ["libcalcium"], :libcalcium),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaBinaryWrappers/Calcium_jll.jl/releases/download/Calcium-v0.400.0+0"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Calcium.v0.400.0.aarch64-linux-gnu.tar.gz", "1c8a395f7f41f710cb3402f50694e372664f191a4d7f0b8ccb2566046e76d7d2"),
Linux(:aarch64, libc=:musl) => ("$bin_prefix/Calcium.v0.400.0.aarch64-linux-musl.tar.gz", "0074058f00a9ea3bd7959c319881eb0cbd810a337f158960c405de4f5ee3fc3b"),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/Calcium.v0.400.0.armv7l-linux-gnueabihf.tar.gz", "1f00a56c9c154dec2b396fc3a9fcedf3fd65595c76eeb1f4396e79a358e9e28a"),
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/Calcium.v0.400.0.armv7l-linux-musleabihf.tar.gz", "319f286c842e1927746a96f8f9fbee9dff27286dff9805d7ce0e138a756a6b58"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/Calcium.v0.400.0.i686-linux-gnu.tar.gz", "8e1abd97b0b79624f2304292574be7257ed372635f04c71446b491b52fd71e70"),
Linux(:i686, libc=:musl) => ("$bin_prefix/Calcium.v0.400.0.i686-linux-musl.tar.gz", "f74de4bf2273eb0a3f1bf48804f30f6564391a04a47e3df0d37ebba818b87541"),
Windows(:i686) => ("$bin_prefix/Calcium.v0.400.0.i686-w64-mingw32.tar.gz", "57bed6dcda3c41152352b7099bbca32a425672fe75d075f353b71dec6deba806"),
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/Calcium.v0.400.0.powerpc64le-linux-gnu.tar.gz", "aa2f22b7a62696b151b7b69efe8a28520276f5da5647152c80532f872d280f7b"),
MacOS(:x86_64) => ("$bin_prefix/Calcium.v0.400.0.x86_64-apple-darwin.tar.gz", "0618e05a9c54146ea3436ed9038a52eee83f7e7ded58c83cdb5c3f90ffbae95d"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Calcium.v0.400.0.x86_64-linux-gnu.tar.gz", "21fd1d683f056404a8e4f460dccc97c0294e829d1eaf73089a536b78c3c61fa1"),
Linux(:x86_64, libc=:musl) => ("$bin_prefix/Calcium.v0.400.0.x86_64-linux-musl.tar.gz", "03865d7aea99c28c3e586e101a1c075ad99656d5c4207a9b60568a414bfc97cc"),
FreeBSD(:x86_64) => ("$bin_prefix/Calcium.v0.400.0.x86_64-unknown-freebsd.tar.gz", "ce4c17d64a69c5aaeb105048e3164e0776edee8526982a96323bad5b4342dd47"),
Windows(:x86_64) => ("$bin_prefix/Calcium.v0.400.0.x86_64-w64-mingw32.tar.gz", "21d0b9e1ce07cff3421fa86029000685ecdc6ec7a3a05a2a83c6d66152f8fab2"),
)

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
dl_info = choose_download(download_info, platform_key_abi())
if dl_info === nothing && unsatisfied
# If we don't have a compatible .tar.gz to download, complain.
# Alternatively, you could attempt to install from a separate provider,
# build from source or something even more ambitious here.
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
end

# If we have a download, and we are unsatisfied (or the version we're
# trying to install is not itself installed) then load it up!
if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
# Download and install binaries
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ makedocs(
"Fields" => [ "fraction.md",
"rational.md",
"algebraic.md",
"complex.md",
"arb.md",
"acb.md",
"gfp.md",
Expand Down
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pages:
- Integers: integer.md
- Rationals: rational.md
- Algebraic numbers: algebraic.md
- Exact real and complex numbers: complex.md
- Finite fields: finitefield.md
- Finite field embeddings: ff_embedding.md
- P-adic fields: padic.md
Expand Down
14 changes: 6 additions & 8 deletions docs/src/algebraic.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ The default algebraic number type represents algebraic numbers
in canonical form using minimal polynomials. This works well for representing
individual algebraic numbers, but it does not provide the best
performance for field arithmetic.
To compute in a fixed subfield of $\overline{\mathbb{Q}}$,
it is typically far more efficient to fix a generator $a$
and construct an Antic number field to represent $\mathbb{Q}(a)$.

In the future, Nemo will provide an alternative implementation
of algebraic numbers using Calcium field elements instead of minimal
polynomials. The minimal polynomial representation will still be available
since it provides canonical forms with predictable behavior.
For fast calculation in $\overline{\mathbb{Q}}$,
`CalciumField` should typically be used instead (see the section
on *Exact real and complex numbers*).
Alternatively, to compute in a fixed subfield of $\overline{\mathbb{Q}}$,
you may fix a generator $a$ and construct an
Antic number field to represent $\mathbb{Q}(a)$.

## Algebraic number functionality

Expand Down
Loading

0 comments on commit d530e05

Please sign in to comment.