Skip to content

Commit e9a6e3b

Browse files
authored
Avoid non-fftwNumber Chebyshev U transform, which breaks auto-diff (#44)
* Restrict usage of Chebyshev U transform to fftwNumber * Update chebyshev.jl * Update test_chebyshev.jl * Update test_chebyshev.jl
1 parent 5811413 commit e9a6e3b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/classical/chebyshev.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ Jacobi(C::ChebyshevU{T}) where T = Jacobi(one(T)/2,one(T)/2)
100100
factorize(L::SubQuasiArray{T,2,<:ChebyshevT,<:Tuple{<:Inclusion,<:OneTo}}) where T =
101101
TransformFactorization(grid(L), plan_chebyshevtransform(Array{T}(undef, size(L,2))))
102102

103-
factorize(L::SubQuasiArray{T,2,<:ChebyshevU,<:Tuple{<:Inclusion,<:OneTo}}) where T =
103+
# TODO: extend plan_chebyshevutransform
104+
factorize(L::SubQuasiArray{T,2,<:ChebyshevU,<:Tuple{<:Inclusion,<:OneTo}}) where T<:FastTransforms.fftwNumber =
104105
TransformFactorization(grid(L), plan_chebyshevutransform(Array{T}(undef, size(L,2))))
105106

106107

@@ -171,6 +172,7 @@ function \(w_A::WeightedChebyshevT, w_B::WeightedChebyshevU)
171172
_BandedMatrix(Vcat(Fill(one(T)/2, 1, ∞), Zeros{T}(1, ∞), Fill(-one(T)/2, 1, ∞)), ℵ₀, 2, 0)
172173
end
173174

175+
\(w_A::WeightedChebyshevU, w_B::WeightedChebyshevT) = inv(w_B \ w_A)
174176
\(T::ChebyshevT, U::ChebyshevU) = inv(U \ T)
175177

176178
####

test/test_chebyshev.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
150150
@test sum(WT; dims=1)[:,1:10] zeros(1,9)]
151151
@test sum(WT[:,1]) π
152152
@test iszero(sum(WT[:,2]))
153+
154+
WU = Weighted(ChebyshevU())
155+
@test (WT \ WU)[1:10,1:10] inv(WU \ WT)[1:10,1:10]
156+
@test_skip (WU \ WT)[1,1] == 2
153157
end
154158

155159
@testset "mapped" begin

0 commit comments

Comments
 (0)