Skip to content

Commit c7e5fd8

Browse files
authored
move show methods from ApproxFun (#23)
1 parent 96177d0 commit c7e5fd8

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunSingularities"
22
uuid = "f8fcb915-6b99-5be2-b79a-d6dbef8e6e7e"
3-
version = "0.2.5"
3+
version = "0.3.0"
44

55
[deps]
66
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
@@ -13,7 +13,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1313

1414
[compat]
1515
ApproxFunBase = "0.3.8, 0.4, 0.5, 0.6"
16-
ApproxFunOrthogonalPolynomials = "0.2.3, 0.3, 0.4"
16+
ApproxFunOrthogonalPolynomials = "0.2.3, 0.3, 0.4, 0.5"
1717
DomainSets = "0.4, 0.5"
1818
IntervalSets = "0.5, 0.6, 0.7"
1919
Reexport = "0.2, 1"

src/JacobiWeight.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,20 @@ for FUNC in (:maxspace_rule,:union_rule,:hasconversion)
474474
end
475475
end
476476
end
477+
478+
function show(io::IO,s::JacobiWeight)
479+
d=domain(s)
480+
#TODO: Get shift and weights right
481+
if s.α==s.β
482+
print(io,"(1-x^2)^", s.α, "[")
483+
elseif s.β==0
484+
print(io,"(1-x)^", s.α, "[")
485+
elseif s.α==0
486+
print(io,"(1+x)^", s.β, "[")
487+
else
488+
print(io,"(1+x)^", s.β, "(1-x)^", s.α, "[")
489+
end
490+
491+
show(io,s.space)
492+
print(io,"]")
493+
end

src/LogWeight.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,16 @@ function Multiplication(f::Fun{<:LogWeight},S::Space)
9595
rsp=LogWeight(space(f).β,space(f).α,rangespace(M))
9696
MultiplicationWrapper(f,SpaceOperator(M,S,rsp))
9797
end
98+
99+
function show(io::IO,s::LogWeight)
100+
d=domain(s)
101+
#TODO: Get shift and weights right
102+
if s.α==s.β
103+
print(io,"log((1-x^2)^", s.α, ")[")
104+
else
105+
print(io,"log((1+x)^", s.β, "(1-x)^", s.α, ")[")
106+
end
107+
108+
show(io,s.space)
109+
print(io,"]")
110+
end

test/runtests.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,3 +777,42 @@ end
777777
@time \(QR1,f; tolerance=1E-10)
778778
println("Laplace Dirichlet: should be ~0.015, 0.015, 0.001")
779779
end
780+
781+
@testset "show" begin
782+
@testset "logweight" begin
783+
w = LogWeight(1.0, 0.0, Chebyshev())
784+
s = repr(w)
785+
@test startswith(s, "log")
786+
@test contains(s, "Chebyshev")
787+
@test contains(s, "(1+x)^1")
788+
@test contains(s, "(1-x)^0")
789+
790+
w = LogWeight(1.0, 1.0, Chebyshev())
791+
s = repr(w)
792+
@test startswith(s, "log")
793+
@test contains(s, "Chebyshev")
794+
@test contains(s, "(1-x^2)^1")
795+
end
796+
@testset "JacobiWeight" begin
797+
w = JacobiWeight(1.0, 0.0, Chebyshev())
798+
s = repr(w)
799+
@test contains(s, "Chebyshev")
800+
@test contains(s, "(1+x)^1")
801+
802+
w = JacobiWeight(0.0, 1.0, Chebyshev())
803+
s = repr(w)
804+
@test contains(s, "Chebyshev")
805+
@test contains(s, "(1-x)^1")
806+
807+
w = JacobiWeight(1.0, 1.0, Chebyshev())
808+
s = repr(w)
809+
@test contains(s, "Chebyshev")
810+
@test contains(s, "(1-x^2)^1")
811+
812+
w = JacobiWeight(1.0, 2.0, Chebyshev())
813+
s = repr(w)
814+
@test contains(s, "Chebyshev")
815+
@test contains(s, "(1+x)^1")
816+
@test contains(s, "(1-x)^2")
817+
end
818+
end

0 commit comments

Comments
 (0)