Skip to content

Commit 2e33f50

Browse files
authored
Support expansion of non-type inferred functions (#105)
* Support expansion of non-type inferred functions * Update adaptivetransform.jl * Update adaptivetransform.jl * Update adaptivetransform.jl
1 parent bc64208 commit 2e33f50

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.6.4"
4+
version = "0.6.5"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/adaptivetransform.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
12
transform_ldiv(A::AbstractQuasiArray{T}, f::AbstractQuasiArray{V}, ::Tuple{<:Any,InfiniteCardinal{0}}) where {T,V} =
2-
adaptivetransform_ldiv(convert(AbstractQuasiArray{promote_type(T,V)}, A), f)
3+
adaptivetransform_ldiv(A, f)
34

45
pad(c::AbstractVector{T}, ax::Union{OneTo,OneToInf}) where T = [c; Zeros(length(ax)-length(c))]
56
pad(c, ax...) = PaddedArray(c, ax)
@@ -17,13 +18,15 @@ padresize!(cfs::PseudoBlockVector, m, ax...) = padresize!(cfs.blocks, m, ax...)
1718

1819
increasingtruncations(::OneToInf) = oneto.(2 .^ (4:∞))
1920
increasingtruncations(::BlockedUnitRange) = broadcast(n -> Block.(oneto(n)), (2 .^ (4:∞)))
20-
function adaptivetransform_ldiv(A::AbstractQuasiArray{U}, f::AbstractQuasiVector{V}) where {U,V}
21-
T = promote_type(eltype(U),eltype(V))
2221

22+
23+
function adaptivetransform_ldiv(A::AbstractQuasiArray{U}, f::AbstractQuasiVector{V}) where {U,V}
2324
r = checkpoints(A)
2425
fr = f[r]
2526
maxabsfr = norm(fr,Inf)
2627

28+
# don't use V as eltype might be Any
29+
T = promote_type(eltype(U), eltype(typeof(first(fr))))
2730
tol = 20eps(real(T))
2831
ax = axes(A,2)
2932

test/test_chebyshev.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map, WeightedBasisLayout
473473
@test h'h cosh(2) - sinh(2)/2
474474
@test f'h h'f 2.498566528528904 # 1/2 π BesselI[1, 2]
475475
end
476+
477+
@testset "non-type inferred" begin
478+
T = Chebyshev()
479+
f = x -> abs(x) 1 ? 1 : "hi"
480+
@test T \ f.(axes(T,1)) [1; zeros(∞)]
481+
end
476482
end
477483

478484
struct QuadraticMap{T} <: Map{T} end

0 commit comments

Comments
 (0)