TaylorSeries.jl
TaylorSeries.jl copied to clipboard
Crash when printing `TaylorN` with mixed-length polynomials
I have a TaylorN object that crashes when printing. I can print the coefficients manually:
julia> for p in T
println(p.coeffs)
end
Interval{Float64}[[0.5, 0.5]_NG]
Interval{Float64}[[0.4, 0.4]_NG, [0.0, 0.0]_NG]
Interval{Float64}[[0.0, 0.0]_NG, [0.0, 0.0]_NG, [0.0, 0.0]_NG]
...
I narrowed it down to a HomogeneousPolynomial, but I am not sure whether the object was wrongly created (by a library) or whether the printing code is faulty. The crash happens in line 156 below:
https://github.com/JuliaDiff/TaylorSeries.jl/blob/a30f63630d664c1a0c6a7e425d51235e02a35c51/src/printing.jl#L141-L156
Does this ring a bell?
julia> p = T[1];
julia> typeof(p)
HomogeneousPolynomial{Interval{Float64}}
julia> p.coeffs
2-element Vector{Interval{Float64}}:
[0.4, 0.4]_NG
[0.0, 0.0]_NG
julia> p.order
1
julia> p
Error showing value of type HomogeneousPolynomial{Interval{Float64}}:
SYSTEM (REPL): showing an error caused an error
ERROR: 1-element ExceptionStack:
BoundsError: attempt to access 2-element Vector{Interval{Float64}} at index [3]
Stacktrace:
[1] throw_boundserror(A::Vector{Interval{Float64}}, I::Tuple{Int64})
@ Base ./essentials.jl:15
[2] getindex
@ ./essentials.jl:919 [inlined]
[3] getindex
@ ~/.julia/packages/TaylorSeries/o2vHt/src/auxiliary.jl:123 [inlined]
[4] homogPol2str(a::HomogeneousPolynomial{Interval{Float64}})
@ TaylorSeries ~/.julia/packages/TaylorSeries/o2vHt/src/printing.jl:156
[5] pretty_print
@ ~/.julia/packages/TaylorSeries/o2vHt/src/printing.jl:118 [inlined]
[6] show(io::IOContext{REPL.LimitIO{Base.TTY}}, a::HomogeneousPolynomial{Interval{Float64}})
@ TaylorSeries ~/.julia/packages/TaylorSeries/o2vHt/src/printing.jl:257
[7] show(io::IOContext{REPL.LimitIO{Base.TTY}}, ::MIME{Symbol("text/plain")}, x::HomogeneousPolynomial{Interval{Float64}})
@ Base.Multimedia ./multimedia.jl:47
[8] show_repl(io::IO, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:548
[9] show_limited(io::IO, mime::MIME, x::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:517
[10] (::REPL.var"#display##0#display##1"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:540
[11] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:833
[12] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:526
[13] display(d::REPL.REPLDisplay, x::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:546
[14] display(x::Any)
@ Base.Multimedia ./multimedia.jl:340
[15] (::REPL.var"#print_response##2#print_response##3")()
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:590
[16] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:445
[17] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:427
[18] start_repl_backend
@ ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:424 [inlined]
[19] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:653
[20] run_repl(repl::REPL.AbstractREPL, consumer::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:639
[21] run_std_repl(REPL::Module, quiet::Bool, banner::Symbol, history_file::Bool)
@ Base ./client.jl:478
[22] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool)
@ Base ./client.jl:499
[23] repl_main
@ ./client.jl:586 [inlined]
[24] _start()
@ Base ./client.jl:561
Stacktrace:
[1] print_response(errio::IO, response::Any, backend::Union{Nothing, REPL.REPLBackendRef}, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:599
[2] (::REPL.var"#print_response##0#print_response##1"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:558
[3] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:833
[4] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:556
[5] (::REPL.var"#do_respond#73"{Bool, Bool, REPL.var"#setup_interface##12#setup_interface##13"{…}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1192
[6] (::VSCodeServer.var"#install_vscode_shell_integration##4#install_vscode_shell_integration##5"{REPL.var"#do_respond#73"{…}})(mi::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
@ VSCodeServer ~/.vscode-oss/extensions/julialang.language-julia-1.158.2-universal/scripts/packages/VSCodeServer/src/repl.jl:122
[7] run_interface(terminal::Base.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
@ REPL.LineEdit ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2854
[8] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1663
[9] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
@ REPL ~/programs/julia-1.12.1/share/julia/stdlib/v1.12/REPL/src/REPL.jl:650
Some type information was truncated. Use `show(err)` to see complete types.