Skip to content

move show methods from ApproxFun #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFunFourier"
uuid = "59844689-9c9d-51bf-9583-5b794ec66d30"
version = "0.2.15"
version = "0.3.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
14 changes: 14 additions & 0 deletions src/ApproxFunFourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -613,5 +613,19 @@ function Fun(T::ToeplitzOperator)
end
end

Base.show(io::IO,d::Circle) =
print(io,(d.radius==1 ? "" : string(d.radius))*
(d.orientation ? "🕒" : "🕞")*
(d.center==0 ? "" : "+$(d.center)"))

Base.show(io::IO, d::PeriodicSegment) = print(io,"【$(leftendpoint(d)),$(rightendpoint(d))❫")
for typ in (:Fourier, :Laurent, :Taylor, :SinSpace, :CosSpace)
typstr = string(typ)
@eval function Base.show(io::IO, S::$typ)
print(io, $typstr, "(")
show(io, domain(S))
print(io, ")")
end
end

end #module
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,17 @@ end
f=Fun(z->2exp(z^2),PeriodicLine(0.,π/2))
@test f(1.1im) ≈ 2exp(-1.1^2)
end

@testset "show" begin
for (spT, spstr) in Any[(Fourier, "Fourier"), (CosSpace, "CosSpace"),
(SinSpace, "SinSpace"), (Laurent, "Laurent"), (Taylor, "Taylor")]
sp = spT()
str = repr(sp)
@test occursin(spstr, str)
d = domain(sp)
if d isa ApproxFunFourier.PeriodicSegment
@test occursin(repr(leftendpoint(d)), str)
@test occursin(repr(rightendpoint(d)), str)
end
end
end