Skip to content

Commit

Permalink
Add inverse chebyshev transform plan for Dual (#904)
Browse files Browse the repository at this point in the history
* Add inverse chebyshev transform plan for Dual

* Test inverse Chebyshev transform for dual numbers

* Version bump to v0.13.23
  • Loading branch information
LucasAschenbach authored Aug 17, 2023
1 parent f4cae23 commit 94db178
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFun"
uuid = "28f2ccd6-bb30-5033-b560-165f7b14dc2f"
version = "0.13.22"
version = "0.13.23"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
7 changes: 4 additions & 3 deletions ext/ApproxFunDualNumbersExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ using ApproxFun
using ApproxFun: TransformPlan, ITransformPlan
import ApproxFunBase: valsdomain_type_promote
using DomainSets
import FastTransforms: ChebyshevTransformPlan, plan_chebyshevtransform,
plan_chebyshevtransform!, plan_ichebyshevtransform,
plan_ichebyshevtransform!
import FastTransforms: ChebyshevTransformPlan, IChebyshevTransformPlan,
plan_chebyshevtransform, plan_chebyshevtransform!,
plan_ichebyshevtransform, plan_ichebyshevtransform!

# Dual number support. Should there be realpart and dualpart of Space and Domain?
DualNumbers.realpart(f::Fun{S,T}) where {S,T<:Dual} = Fun(space(f),realpart.(coefficients(f)))
Expand Down Expand Up @@ -45,6 +45,7 @@ plan_ichebyshevtransform(v::AbstractVector{D}, ::Val{kind}) where {D<:Dual,kind}


Base.:(*)(P::ChebyshevTransformPlan,v::AbstractVector{<:Dual}) = dual.(P*realpart.(v),P*dualpart.(v))
Base.:(*)(P::IChebyshevTransformPlan,v::AbstractVector{<:Dual}) = dual.(P*realpart.(v),P*dualpart.(v))

#TODO: Hardy{false}
for (OP,TransPlan) in ((:plan_transform,:TransformPlan),(:plan_itransform,:ITransformPlan)),
Expand Down
3 changes: 3 additions & 0 deletions test/ExtrasTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ include(joinpath(@__DIR__, "testutils.jl"))
f=Fun(x->exp(dual(x,1)),-1..1)
@test coefficients(realpart(f)) == realpart.(coefficients(f))
@test coefficients(dualpart(f)) == dualpart.(coefficients(f))

# Test inverse Chebyshev transform for dual numbers
@test all(absdual.(transform(space(f),values(f)) - coefficients(f)) .< 10eps())
end

@testset "Eig test #336" begin
Expand Down

2 comments on commit 94db178

@jishnub
Copy link
Member

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/89866

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.13.23 -m "<description of version>" 94db1780077b337e4d0c45ab32b18b68040c189e
git push origin v0.13.23

Please sign in to comment.