Skip to content

Commit

Permalink
Merge pull request #144 from kalmarek/fix/series-constructors
Browse files Browse the repository at this point in the history
Fix/series constructors
  • Loading branch information
Joel-Dahne authored Dec 14, 2021
2 parents 57ee7e2 + 8272fc9 commit 122a13e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 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.6.0"
version = "0.6.1"

[deps]
Arb_jll = "d9960996-1013-53c9-9ba4-74a4155039c3"
Expand Down
11 changes: 8 additions & 3 deletions src/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,17 @@ for (TSeries, TPoly) in [(:ArbSeries, :ArbPoly), (:AcbSeries, :AcbPoly)]
)
p = $TSeries(degree = degree, prec = prec)
@inbounds p[0] = coeffs[1]
@inbounds p[1] = coeffs[2]
if degree >= 1
@inbounds p[1] = coeffs[2]
end
return p
end

@eval $TSeries(p::Union{$TPoly,$TSeries}; prec::Integer = precision(p)) =
set!($TSeries(degree = degree(p), prec = prec), p)
@eval $TSeries(
p::Union{$TPoly,$TSeries};
degree::Integer = degree(p),
prec::Integer = precision(p),
) = set_trunc!($TSeries(degree = degree, prec = prec), p, degree + 1)
end
function AcbSeries(p::Union{ArbPoly,ArbSeries}; degree = degree(p), prec = precision(p))
res = AcbSeries(degree = degree, prec = prec)
Expand Down
9 changes: 8 additions & 1 deletion test/series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@
TSeries((5.0,)) ==
TSeries(T[5]) ==
TSeries(T(5))
@test TSeries(TSeries((1, 2))) == TSeries(ArbPoly((1, 2))) == TSeries((1, 2))
@test TSeries(TSeries((1, 2))) ==
TSeries(ArbPoly((1, 2))) ==
TSeries(TSeries((1, 2, 3)), degree = 1) ==
TSeries(ArbPoly((1, 2, 3)), degree = 1) ==
TSeries((1, 2))

# A previous bug always set both coefficients
@test Arblib.cstruct(TSeries((2, 1), degree = 0)).length == 1

@test precision(TSeries(degree = 1, prec = 64)) == 64
@test precision(TSeries(0, degree = 1, prec = 64)) == 64
Expand Down

2 comments on commit 122a13e

@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/50554

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.6.1 -m "<description of version>" 122a13e1cd7bfa0b04e5110be692080dc4551f61
git push origin v0.6.1

Please sign in to comment.