-
Notifications
You must be signed in to change notification settings - Fork 6
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
Plotting and subtyping AbstractFloat
#92
Comments
I can also mention that at some point I want to add plotting support to the polynomial and series types as well. But that is a future problem. |
While it makes sense to have |
The way that Julia treats rad2deg(z::AbstractFloat) = z * (180 / oftype(z, pi)) from Base would work perfectly fine for |
But I agree that it doesn't make perfect sense to have Defining I think we can agree that for |
I don't have a strong opinion. Since |
Mostly solved by #108 |
I want to be able to plot the
Number
types we define in Arblib.jl directly using Plots.jl. Currentlyplot([Arb(1)])
fails becausefloat(::Arb)
defaults toAbstractFloat(::Arb)
which is not defined. There are two ways to solve this, either we definefloat(x::Arb) = x
directly or we makeArb
a subtype ofAbstractFloat
in which caseAbstractFloat(::Arb)
will work. Similar things happen forArf
.For
Arf
I think it makes perfect sense to subtypeAbstractFloat
, after all it's essentially identical to aBigFloat
which does subtype that. ForArb
I'm not entirely sure, we could maybe see it as anAbstractFloat
with the radius being some extra information. In practice I think this would work quite well, and everything that makes sense on anAbstractFloat
I believe makes sense on anArb
as well. The alternative would be to definefloat(x::Arb) = x
, so we would treat it as a float in practice but not subtype it, I'm not sure if that is better in any way. I can note here thatfloat
doesn't have to return a subtype ofAbstractFloat
, for examplefloat(::Complex{Int})
isComplex{Float64}
.For
Acb
I believe we want to handle it similar toComplex{Arb}
, which would mean adding these two plot recipesHowever I realised that many methods, at least in Julia Base, starts by doing
float(x)
on any input, so it could still be beneficial to definefloat(x::Acb) = Acb
. I can also mention that it doesn't make sense to haveAcb <: AbstractFloat
sinceAbstractFloat <: Real
.Finally a comment about plotting balls. In the above plotting an
Arb
or anAcb
would plot the midpoint of the ball. In many cases this makes sense, when working with high precision balls with small radius which is exactly what Arb is optimized for. This covers most of my uses. However in some cases you would like to plot the whole ball, including the radius. It would be nice if we could come up with a convenient method for doing that as well, possibly through some@userplot
recipe.The text was updated successfully, but these errors were encountered: