From 4c917440ef77e228ad19dfa4e8f0850a4b696f76 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Mon, 15 Dec 2025 20:57:26 +0000 Subject: [PATCH 1/2] Support empty Toeplitz Hankel transforms --- src/toeplitzhankel.jl | 7 +++++-- test/toeplitzhankeltests.jl | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/toeplitzhankel.jl b/src/toeplitzhankel.jl index 1c552a09..9688d54d 100644 --- a/src/toeplitzhankel.jl +++ b/src/toeplitzhankel.jl @@ -128,6 +128,7 @@ end function *(P::ChebyshevToLegendrePlanTH, v::AbstractVector{S}) where S n = length(v) + iszero(n) && return v ret = zero(S) @inbounds for k = 1:2:n ret += -v[k]/(k*(k-2)) @@ -178,7 +179,9 @@ function _leg2chebTH_TLC(::Type{S}, mn, d) where S C = hankel_partialchol(λ) T = plan_uppertoeplitz!(t, (mn..., size(C,2)), d) L = copy(C) - L[1,:] ./= 2 + if n > 0 + L[1,:] ./= 2 + end T,L,C end @@ -215,7 +218,7 @@ _sub_dim_by_one(d, m, n...) = (isone(d) ? m-1 : m, _sub_dim_by_one(d-1, n...)... function _cheb2legTH_TLC(::Type{S}, mn, d) where S n = mn[d] - t = zeros(S,n-1) + t = zeros(S,max(0,n-1)) S̃ = real(S) if n > 1 t[1:2:end] = Λ.(0:one(S̃):div(n-2,2), -half(S̃), one(S̃)) diff --git a/test/toeplitzhankeltests.jl b/test/toeplitzhankeltests.jl index 0b8731bf..f9a9029c 100644 --- a/test/toeplitzhankeltests.jl +++ b/test/toeplitzhankeltests.jl @@ -183,4 +183,13 @@ Random.seed!(0) @test pl\(pl*copy(X)) ≈ X end end + + @testset "empty" begin + @test isempty(FastTransforms.th_cheb2leg(Float64[])) + @test isempty(FastTransforms.th_leg2cheb(Float64[])) + @test isempty(FastTransforms.th_leg2chebu(Float64[])) + @test isempty(FastTransforms.th_cheb2jac(Float64[], 0.1, 0.2)) + @test isempty(FastTransforms.th_jac2cheb(Float64[], 0.1, 0.2)) + @test isempty(FastTransforms.th_ultra2ultra(Float64[], 0.1, 0.2)) + end end \ No newline at end of file From 3d6ac9287d6d25e22e44ab4866e7bdf79fc5af6c Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Mon, 15 Dec 2025 20:59:16 +0000 Subject: [PATCH 2/2] v0.17.1 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2959561e..12b89dcd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FastTransforms" uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c" -version = "0.17" +version = "0.17.1" [deps]