-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Minimal bindings for optional arb package #17194
Comments
comment:2
This probably does not matter as long as the bindings are not part of the sage coercion world, but I suppose then you'd want to handle precision in a similar way to |
comment:3
Sage should arguably have a Anyway, I took a quick look at the code, and it seems fine to me. |
comment:4
The question is how the relation to |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:8
As a follow-up, minimal bindings for the |
comment:9
The code looks ok to me. A small detail is that precision must be >= 2, not just positive (this is required by |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:12
Please don't use |
comment:13
I disagree with
You should have a |
comment:14
And |
comment:15
Replying to @jdemeyer:
What alternative do you recommend? Calling Concerning renaming I'll try to implement a parent, but it will take some time. The parent would then be |
comment:16
Replying to @cheuberg:
Try the import and catch |
comment:17
You could possibly make it so that one can choose between two different implementations of
So you might look up how those are implemented. I don't have an opinion on whether this is better than what you're doing right now. |
comment:18
Replying to @cheuberg:
Yes, I would do that. The implementations are also quite different.
I slightly prefer the shorter name |
comment:20
Replying to @jdemeyer:
Yes, it works, thanks. |
comment:67
Replying to @cheuberg:
So I think we agree:
No, I guess I wasn't clear, sorry. Imho the fact that comparisons of sage objects (or at least of sage Elements) can fall back to comparing types at all is dreadful. I was saying (as an aside, not as a remark on your code) that I would be tempted to implement safer comparison methods in addition to your implementation of Python comparisons (and with the same semantics in the case where we compare balls to balls) because Sage comparisons are dangerous in general.
I don't know if it is possible, and I doubt it is a good idea to circumvent the coercion system even if it can lead to problems.
Forget it, I think I convinced myself that it was ok—as long as a ball is understood as representing a single real number, of course. (And never as a subset of the real line whose image by a given function needs to be bounded, say.)
I wouldn't say that: after all, it does not hold true that for all x, y in [-1,1], x=y...
Yes, but that argument would be (almost) equally valid in the case of (I will be offline for a few days. If anyone would like to take over the review, please feel free.) |
comment:68
Replying to @mezzarobba:
This is correct. |
comment:69
(Replying in several chunks due to trac timeouts when I try to reply in one go, sorry). Replying to @mezzarobba:
I agree.
We can always do that later because it would not change behaviour.
So let's forget this idea. |
comment:70
Replying to @mezzarobba:
I do not understand your point. If
No, I do not want that. For reference, I quote here from the Arb manual: "Identical pointers are understood to give permission for algebraic simplification. This assumption is made to improve performance. For example, the call |
comment:71
Replying to @cheuberg:
Yes. |
comment:72
So despite what I said about being offline for a few days, I could have a look at your last changes before disappearing. Replying to @cheuberg:
Ok, that was very badly expressed once again. Sorry about that, I'm trying to do too many things at once All I was trying to say essentially is that if your think of balls as ranges, not approximate reals, then code like
looks correct, while it violates the rule about aliasing in arb that you quoted. I guess one could come up with more subtle examples with A few more quick comments:
None of the above is really urgent or important and the current state of the code looks good to me, so I'm setting the ticket to positive review to avoid delaying it too much. But please feel free to make changes here if you want, and then I'll try to review them when I come back. |
Reviewer: Marc Mezzarobba |
comment:73
Replying to @mezzarobba:
Thank you.
While I think that your points above are valid, I do not want to make changes here any more. |
comment:74
Replying to @mezzarobba:
Anything
Yes, unfortunately I haven't added any code yet to underflow or overflow gracefully when converting to MPFR. When developing, I deliberately wanted this to crash rather than fail silently. I should probably fix Rather than changing |
comment:75
Replying to @cheuberg:
Great, thanks for your work on these bindings! I'll do what I can to help. |
comment:76
Replying to @fredrik-johansson:
What should we do to convert a |
comment:77
Replying to @mezzarobba:
|
comment:78
Replying to @fredrik-johansson:
Ok, I missed that function, thanks! |
comment:79
Another question that we may want to think about is whether and how to expose exact (by which I mean |
comment:80
|
comment:81
Replying to @mezzarobba:
This is now #17809.
It was hard to provoke this with available functions, but it did crash sage. This is now #17811.
This is #17810. |
Changed branch from u/cheuberg/17194-arb to |
In #16747, the optional arb package is proposed for inclusion in sage. That ticket did not have any bindings for the Sage library.
In the present ticket, rather minimal bindings are provided.
As a proof of concept, the digamma function of a
RealIntervalFieldElement
is implemented by converting it to anRealBall
, computing the digamma function via the arb library, and converting the result back.Depends on #16747
Depends on #17688
CC: @sagetrac-alina @fredrik-johansson @sagetrac-ktkohl @sagetrac-skropf @jdemeyer @mezzarobba
Component: numerical
Keywords: arb, digamma function, real interval field
Author: Clemens Heuberger, Marc Mezzarobba
Branch/Commit:
195a6ee
Reviewer: Marc Mezzarobba
Issue created by migration from https://trac.sagemath.org/ticket/17194
The text was updated successfully, but these errors were encountered: