JuliaApproximation / SemiclassicalOrthogonalPolynomials.jl

A Julia repository for semiclassical orthogonal polynomials
MIT License
7 stars 3 forks source link

Missing show method for SemiclassicalJacobi #103

Closed DanielVandH closed 2 months ago

DanielVandH commented 2 months ago

There is no show method defined for SemiclassicalJacobi which causes issues when string interpolation is required, e.g. the print method for Weighted requires it:

julia> using SemiclassicalOrthogonalPolynomials, ClassicalOrthogonalPolynomials

julia> P = SemiclassicalJacobi(2.0, 1.0, 1.0, 1.0);

julia> W = Weighted(P);

julia> W
Error showing value of type Weighted{Float64, SemiclassicalJacobi{Float64}}:
ERROR: InterruptException:
Stacktrace:
  [1] !=(T::Type, S::Type)
    @ Base .\operators.jl:251
  [2] show(io::IOContext{IOBuffer}, x::Float64, forceuntyped::Bool, fromprint::Bool)
    @ Base.Ryu .\ryu\Ryu.jl:115
  [3] show(io::IOContext{IOBuffer}, x::Float64)
    @ Base.Ryu .\ryu\Ryu.jl:113
  [4] _show_nonempty(io::IOContext{…}, X::AbstractMatrix, prefix::String, drop_brackets::Bool, axs::Tuple{…})
    @ Base .\arrayshow.jl:445
  [5] _show_nonempty(io::IOContext{…}, X::LazyBandedMatrices.SymTridiagonal{…}, prefix::String)
    @ Base .\arrayshow.jl:413
  [6] show(io::IOContext{IOBuffer}, X::LazyBandedMatrices.SymTridiagonal{Float64, SubArray{…}, SubArray{…}})
    @ Base .\arrayshow.jl:491
  [7] _show_default(io::IOBuffer, x::Any)
    @ Base .\show.jl:479
  [8] show_default
    @ .\show.jl:462 [inlined]
  [9] show
    @ .\show.jl:457 [inlined]
 [10] print(io::IOBuffer, x::SemiclassicalJacobi{Float64})
    @ Base .\strings\io.jl:35
 [11] print_to_string(::String, ::Vararg{Any})
    @ Base .\strings\io.jl:148
 [12] string
    @ .\strings\io.jl:189 [inlined]
 [13] show
    @ C:\Users\User\.julia\packages\ClassicalOrthogonalPolynomials\JEEfo\src\normalized.jl:289 [inlined]
 [14] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, x::Weighted{Float64, SemiclassicalJacobi{Float64}})
    @ Base.Multimedia .\multimedia.jl:47
 [15] (::REPL.var"#55#56"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:273
 [16] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:569
 [17] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:259
 [18] display
    @ C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:278 [inlined]
 [19] display(x::Any)
    @ Base.Multimedia .\multimedia.jl:340
 [20] #invokelatest#2
    @ .\essentials.jl:892 [inlined]
 [21] invokelatest
    @ .\essentials.jl:889 [inlined]
 [22] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:315
 [23] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:284
 [24] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:569
 [25] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:282
 [26] (::REPL.var"#do_respond#80"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:911
 [27] #invokelatest#2
    @ .\essentials.jl:892 [inlined]
 [28] invokelatest
    @ .\essentials.jl:889 [inlined]
 [29] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\LineEdit.jl:2656
 [30] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:1312
 [31] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.

since

julia> string(P) # never completes since it tries to print a huge matrix
ERROR: InterruptException:
Stacktrace:
  [1] show(io::IOContext{IOBuffer}, x::Float64)
    @ Base.Ryu .\ryu\Ryu.jl:112
  [2] _show_nonempty(io::IOContext{…}, X::AbstractMatrix, prefix::String, drop_brackets::Bool, axs::Tuple{…})
    @ Base .\arrayshow.jl:445
  [3] _show_nonempty(io::IOContext{…}, X::LazyBandedMatrices.SymTridiagonal{…}, prefix::String)
    @ Base .\arrayshow.jl:413
  [4] show(io::IOContext{IOBuffer}, X::LazyBandedMatrices.SymTridiagonal{Float64, SubArray{…}, SubArray{…}})
    @ Base .\arrayshow.jl:491
  [5] _show_default(io::IOBuffer, x::Any)
    @ Base .\show.jl:479
  [6] show_default
    @ .\show.jl:462 [inlined]
  [7] show
    @ .\show.jl:457 [inlined]
  [8] print(io::IOBuffer, x::SemiclassicalJacobi{Float64})
    @ Base .\strings\io.jl:35
  [9] print_to_string(xs::SemiclassicalJacobi{Float64})
    @ Base .\strings\io.jl:148
 [10] string(xs::SemiclassicalJacobi{Float64})
    @ Base .\strings\io.jl:189
 [11] top-level scope
    @ REPL[11]:1
Some type information was truncated. Use `show(err)` to see complete types.

Will make a PR to fix

TSGut commented 2 months ago

Fixed by https://github.com/JuliaApproximation/SemiclassicalOrthogonalPolynomials.jl/pull/104, thanks @DanielVandH