Skip to content

Commit d77d90e

Browse files
committed
BiInfMap
1 parent 17611db commit d77d90e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_chebyshev.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ Base.getindex(m::InvInfMap, x::Number) = m.s*( 2/(1-x) - 1)
7575
ContinuumArrays.invmap(m::InfMap{T}) where T = InvInfMap{T}(m.s)
7676
ContinuumArrays.invmap(m::InvInfMap{T}) where T = InfMap{T}(m.s)
7777

78+
struct BiInfMap{T} <: Map{T} end
79+
struct InvBiInfMap{T} <: Map{T} end
80+
81+
BiInfMap() = BiInfMap{Float64}()
82+
InvBiInfMap() = InvBiInfMap{Float64}()
83+
84+
Base.getindex(m::BiInfMap, y::Number) = iszero(y) ? y : (-1 + sqrt(1 + 4y^2))/(2y)
85+
Base.axes(m::BiInfMap{T}) where T = (Inclusion(-Inf..Inf),)
86+
Base.axes(::InvBiInfMap{T}) where T = (Inclusion(-1..1),)
87+
Base.getindex(m::InvBiInfMap, x::Number) = x/(1-x^2)
88+
ContinuumArrays.invmap(m::BiInfMap{T}) where T = InvBiInfMap{T}()
89+
ContinuumArrays.invmap(m::InvBiInfMap{T}) where T = BiInfMap{T}()
90+
91+
7892
struct FooDomain end
7993

8094
struct FooBasis <: Basis{Float64} end
@@ -200,6 +214,14 @@ Base.:(==)(::FooBasis, ::FooBasis) = true
200214
f = M/M\(exp.(x))
201215
@test f[-0.1] exp(-0.1) atol=1E-2
202216
@test f[searchsortedfirst(f, 0.5)] 0.5
217+
218+
M = T[BiInfMap(),:]
219+
@test axes(M,1) == Inclusion(-Inf .. Inf)
220+
x = axes(M,1)
221+
f = M/M\(atan.(x))
222+
@test f[-0.1] atan(-0.1) atol=1E-2
223+
@test f[0] 0 atol=1E-10
224+
@test f[searchsortedfirst(f, 0.5)] 0.5
203225
end
204226
end
205227

0 commit comments

Comments
 (0)