Skip to content

Commit

Permalink
Fix bugs hit by th_cheb2jac(x, 1,1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Oct 22, 2023
1 parent 2dcabeb commit 37489e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FastTransforms"
uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c"
version = "0.15.9"
version = "0.15.10"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
11 changes: 10 additions & 1 deletion src/toeplitzhankel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,17 @@ end
isapproxinteger(::Integer) = true
isapproxinteger(x) = isinteger(x) || x round(Int,x) || x+1 round(Int,x+1)

"""
_nearest_jacobi_par(α, γ)
_nearest_jacobi_par(α, γ) = isapproxinteger-γ) ? α : round(Int,α,RoundDown) + mod(γ,1)
returns a number that is an integer different than γ but less than 1 away from α.
"""
function _nearest_jacobi_par::T, γ::T) where T
ret = isapproxinteger-γ) ? α : round(Int,α,RoundDown) + mod(γ,1)
ret -1 ? ret + 1 : ret
end
_nearest_jacobi_par(::Integer, ::Integer) = 0
_nearest_jacobi_par(α, γ) = _nearest_jacobi_par(promote(α,γ)...)


struct Ultra2UltraPlanTH{T, Plans, Dims} <: Plan{T}
Expand Down
2 changes: 2 additions & 0 deletions test/toeplitzhankeltests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Random.seed!(0)

@test th_cheb2jac(x, 0.2, 0.3) cheb2jac(x, 0.2, 0.3)
@test th_jac2cheb(x, 0.2, 0.3) jac2cheb(x, 0.2, 0.3)
@test th_cheb2jac(x, 1, 1) cheb2jac(x, 1, 1)
@test th_jac2cheb(x, 1, 1) jac2cheb(x, 1, 1)

@test th_cheb2leg(th_leg2cheb(x)) x
@test th_leg2cheb(th_cheb2leg(x)) x
Expand Down

0 comments on commit 37489e3

Please sign in to comment.