Skip to content

Commit 6ecd066

Browse files
authored
move show methods from ApproxFun (#92)
1 parent b21e58f commit 6ecd066

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunOrthogonalPolynomials"
22
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
3-
version = "0.4.17"
3+
version = "0.5.0"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/ApproxFunOrthogonalPolynomials.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ include("Spaces/Spaces.jl")
108108
include("roots.jl")
109109
include("specialfunctions.jl")
110110
include("fastops.jl")
111+
include("show.jl")
111112

112113
end

src/show.jl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
function show(io::IO,d::Line)
2+
if d.center == angle(d) == 0 && d.α == d.β == -1.
3+
print(io,"")
4+
elseif d.α == d.β == -1.
5+
print(io,"Line(", d.center, ",", angle(d), ")")
6+
else
7+
print(io,"Line(", d.center, ",", angle(d), ",", d.α, ",", d.β, ")")
8+
end
9+
end
10+
11+
function show(io::IO,d::Ray)
12+
if d.orientation && angle(d)==0
13+
print(io,"", d.center, ",∞❫")
14+
elseif d.orientation && angle(d)==1.0π
15+
print(io,"", d.center, ",-∞❫")
16+
elseif d.orientation
17+
print(io,"", d.center, ",exp(", angle(d), "im)∞❫")
18+
elseif !d.orientation && angle(d)==0
19+
print(io,"❪∞,", d.center, "")
20+
elseif !d.orientation && angle(d)==1.0π
21+
print(io,"❪-∞,", d.center, "")
22+
else
23+
print(io,"❪exp(", angle(d), "im)∞,", d.center, "")
24+
end
25+
end
26+
27+
## Spaces
28+
29+
function show(io::IO, S::Chebyshev)
30+
print(io, "Chebyshev(")
31+
show(io,domain(S))
32+
print(io,")")
33+
end
34+
35+
function show(io::IO, S::Ultraspherical)
36+
print(io,"Ultraspherical(", order(S), ",")
37+
show(io,domain(S))
38+
print(io,")")
39+
end
40+
41+
function show(io::IO,S::Jacobi)
42+
S.a == S.b == 0 ? print(io,"Legendre(") : print(io,"Jacobi(", S.b, ",", S.a,",")
43+
show(io,domain(S))
44+
print(io,")")
45+
end
46+
47+
show(io::IO, S::Chebyshev{<:ChebyshevInterval}) = print(io, "Chebyshev()")
48+
show(io::IO, S::Ultraspherical{<:Any,<:ChebyshevInterval}) =
49+
print(io, "Ultraspherical(", order(S), ")")
50+
show(io::IO, S::Jacobi{<:ChebyshevInterval}) =
51+
S.a == S.b == 0 ? print(io,"Legendre()") : print(io,"Jacobi(", S.b, ",", S.a,")")
52+
53+
show(io::IO, S::NormalizedPolynomialSpace) = (print(io, "Normalized"); show(io, S.space))

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ include("SpeedTest.jl")
2323
include("SpeedODETest.jl")
2424
include("SpeedPDETest.jl")
2525
include("SpeedOperatorTest.jl")
26+
include("showtest.jl")

test/showtest.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@testset "show" begin
2+
@test repr(Chebyshev()) == "Chebyshev()"
3+
@test repr(NormalizedChebyshev()) == "NormalizedChebyshev()"
4+
@test repr(Ultraspherical(1)) == "Ultraspherical(1)"
5+
@test repr(Legendre()) == "Legendre()"
6+
@test repr(Jacobi(1,2)) == "Jacobi(1.0,2.0)"
7+
8+
@test repr(Chebyshev(0..1)) == "Chebyshev(0..1)"
9+
@test repr(NormalizedChebyshev(0..1)) == "NormalizedChebyshev(0..1)"
10+
@test repr(Ultraspherical(1,0..1)) == "Ultraspherical(1,0..1)"
11+
@test repr(Legendre(0..1)) == "Legendre(0..1)"
12+
@test repr(Jacobi(1,2,0..1)) == "Jacobi(1.0,2.0,0..1)"
13+
end

0 commit comments

Comments
 (0)