Skip to content

Commit

Permalink
Merge pull request #157 from kalmarek/update-series-struct
Browse files Browse the repository at this point in the history
Update struct for Series
  • Loading branch information
Joel-Dahne authored Aug 1, 2022
2 parents 5e81504 + 634ddab commit 11cf77b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Arblib"
uuid = "fb37089c-8514-4489-9461-98f9c8763369"
authors = ["Marek Kaluba <[email protected]>", "Sascha Timme <Sascha Timme <[email protected]>", "Joel Dahne <[email protected]>"]
version = "0.7.3"
version = "0.8.0"

[deps]
Arb_jll = "d9960996-1013-53c9-9ba4-74a4155039c3"
Expand Down
6 changes: 4 additions & 2 deletions src/precision.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Base.precision(x::ArbTypes) = x.prec
Base.precision(x::MagLike) = DEFAULT_PRECISION[]
# disambiguation
Base.precision(::MagOrRef) = DEFAULT_PRECISION[]
# ArbSeries and AcbSeries don't store their precision
Base.precision(x::Union{ArbSeries,AcbSeries}) = precision(x.poly)

@inline _precision(x::Union{ArbTypes,BigFloat}) = precision(x)
@inline _precision(z::Complex) = max(_precision(real(z)), _precision(imag(z)))
Expand Down Expand Up @@ -60,7 +62,7 @@ Base.setprecision(A::T, prec::Integer) where {T<:Union{AcbMatrix,AcbRefMatrix}}

Base.setprecision(poly::ArbPoly, prec::Integer) = ArbPoly(poly.arb_poly; prec)
Base.setprecision(series::ArbSeries, prec::Integer) =
ArbSeries(series.arb_poly, degree = degree(series); prec)
ArbSeries(series, degree = degree(series); prec)
Base.setprecision(poly::AcbPoly, prec::Integer) = AcbPoly(poly.acb_poly; prec)
Base.setprecision(series::AcbSeries, prec::Integer) =
AcbSeries(series.acb_poly, degree = degree(series); prec)
AcbSeries(series, degree = degree(series); prec)
20 changes: 14 additions & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ end

"""
ArbSeries <: Number
This type should be considered experimental, the interface for it
might change in the future.
"""
struct ArbSeries <: Number
arb_poly::arb_poly_struct
poly::ArbPoly
degree::Int
prec::Int

ArbSeries(; degree::Integer = 0, prec::Integer = DEFAULT_PRECISION[]) =
fit_length!(new(arb_poly_struct(), degree, prec), degree + 1)
fit_length!(new(ArbPoly(; prec), degree), degree + 1)
end

"""
Expand All @@ -113,14 +115,16 @@ end

"""
AcbSeries <: Number
This type should be considered experimental, the interface for it
might change in the future.
"""
struct AcbSeries <: Number
acb_poly::acb_poly_struct
poly::AcbPoly
degree::Int
prec::Int

AcbSeries(; degree::Integer = 0, prec::Integer = DEFAULT_PRECISION[]) =
fit_length!(new(acb_poly_struct(), degree, prec), degree + 1)
fit_length!(new(AcbPoly(; prec), degree), degree + 1)
end

"""
Expand Down Expand Up @@ -235,6 +239,10 @@ for (T, prefix) in (
end
end

# ArbSeries and AcbSeries requires a different cstruct implementation
cstruct(x::ArbSeries) = cstruct(x.poly)
cstruct(x::AcbSeries) = cstruct(x.poly)

# handle Ref types
for prefix in [:mag, :arf, :arb, :acb]
T = Symbol(uppercasefirst(string(prefix)))
Expand Down

2 comments on commit 11cf77b

@Joel-Dahne
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/65448

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.0 -m "<description of version>" 11cf77b84968c85e577ae70fb93c3eeb77897e7b
git push origin v0.8.0

Please sign in to comment.