Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FLINT ball arithmetic for special functions #3286

Merged
merged 8 commits into from
Aug 6, 2024

Conversation

d-torrance
Copy link
Member

We add support for FLINT's real and complex ball types to the interpreter. (Prior to FLINT 3, they were available in the Arb library, so we'll need to link against it in older systems.) Eventually, it would be great if these were available at top level, maybe even as coefficients of polynomials. But for right now, we just use them to bolster our support of special functions.

For example, many of our special functions now only take real arguments. But with FLINT, we can support complex and real interval arguments, as well. For example:

Before

i1 : zeta(1/2 + ii * 14.134725141734695)
stdio:1:1:(3): error: expected a real number

After

i1 : zeta(1/2 + ii * 14.134725141734695)

o1 = -1.04800845464933e-16+6.5803236815108e-16*ii

o1 : CC (of precision 53)

We also move several special functions that were previously handled by Boost Math over to FLINT. There are two (inverseRegularizedBeta and inverseRegularizedGamma -- both useful for computing quantiles of important probability distributions) that don't appear to be available in FLINT, however, so we aren't able to get rid of Boost Math entirely.

This is a draft for now until I get the cmake build working and update the tests and documentation.

@d-torrance
Copy link
Member Author

I'm going to backport FLINT 3 for the PPA so we don't need to build it for all the Ubuntu GitHub builds. Hopefully, this fixes the weird "element not invertible" errors we're getting again (see also #2973 (comment)).

@mahrud
Copy link
Member

mahrud commented Jun 16, 2024

That may be useful for some people, though alternatively once #3288 is working we don't need to use 22.04 for github builds.

@d-torrance
Copy link
Member Author

The "element not invertible" errors are still happening with the PPA FLINT 3 package...

@mahrud
Copy link
Member

mahrud commented Jul 3, 2024

The problem here was that ubuntu's flint was too old, and putting the newer version was incompatible with factory, right? Did you try putting newer flint together with a newer factory (and possibly normaliz) on PPA? Those are the only libraries that we use and depend on flint.

@d-torrance
Copy link
Member Author

Yes, that was the problem. I haven't tried backporting the others to Ubuntu 22.04 since I figured it would be easier to just wait for #3288.

@mahrud
Copy link
Member

mahrud commented Jul 3, 2024

I don't know when that might happen -- I don't have a macos and I don't think Mike or anyone else has looked at it.

@d-torrance
Copy link
Member Author

I suppose I could cherry-pick the Ubuntu-only changes from that PR for this one. Would that be ok?

@mahrud
Copy link
Member

mahrud commented Jul 3, 2024

You could do that, but I'm confused, why is M2 working on Ubuntu 22.04 not important?

@d-torrance
Copy link
Member Author

It's definitely important! I was specifically thinking about not having to spend the time building FLINT 3 during the GitHub builds. Otherwise, in Ubuntu 22.04, we can either build FLINT 3 (cmake) or build against FLINT 2 + Arb (autotools).

@mahrud
Copy link
Member

mahrud commented Jul 3, 2024

But that's not why this PR is failing, right? The cmake-ubuntu builds compile flint, but they still fail, and the autotools-ubuntu build also failed last time.

@d-torrance
Copy link
Member Author

The autotools-ubuntu build failed last time because it was still using the FLINT 3 PPA package that caused the weird BeginningMacaulay2 example error. And it looks like that's what's causing the cmake builds to fail, too -- they built FLINT 3 but are using the packaged factory.

I just pushed a new version requiring Factory 4.4.0 (the first version with FLINT 3 support) in the cmake build, so hopefully that will fix those builds.

@d-torrance d-torrance force-pushed the flint-arb branch 2 times, most recently from 752e011 to a0a014a Compare July 20, 2024 02:52
@d-torrance d-torrance marked this pull request as ready for review July 20, 2024 02:53
@@ -85,7 +85,7 @@ jobs:
sudo apt-get install -y -q --no-install-recommends libboost-stacktrace-dev \
libncurses-dev libncurses5-dev libreadline-dev libeigen3-dev liblapack-dev libxml2-dev \
libgc-dev libgdbm-dev libglpk-dev libgmp3-dev libgtest-dev libmpfr-dev libmpfi-dev libntl-dev gfan \
libgivaro-dev libboost-regex-dev fflas-ffpack libflint-dev libmps-dev libfrobby-dev \
libgivaro-dev libboost-regex-dev fflas-ffpack libflint-dev libflint-arb-dev libmps-dev libfrobby-dev \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just resign to using the ppa package for flint and factory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly laziness. :)

I deleted the FLINT package from the PPA because of the BeginningMacaulay2 example bug. It would likely be fixed by packaging factory for the PPA, but I haven't done that. I figure that we'll likely be switching to Ubuntu 24.04 soon enough that I'm not sure if it's worth the effort.

@mahrud
Copy link
Member

mahrud commented Jul 27, 2024

Once #3288 is merged, could you rebase this just to confirm that the actions don't build flint? Then I think we can merge this.

@d-torrance
Copy link
Member Author

Once #3288 is merged, could you rebase this just to confirm that the actions don't build flint? Then I think we can merge this.

Sure thing!

@d-torrance d-torrance marked this pull request as draft July 27, 2024 13:58
We require FLINT 3 (and thus Factory 4.4.0) in the cmake build.
@d-torrance d-torrance marked this pull request as ready for review August 5, 2024 17:16
@d-torrance
Copy link
Member Author

I've rebased this onto development and none of the actions build flint!

@d-torrance d-torrance merged commit 9369e3e into Macaulay2:development Aug 6, 2024
5 checks passed
@d-torrance d-torrance deleted the flint-arb branch September 3, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants