JuliaControl / JuliaControl/ControlSystems.jl

New vcat not working

Open
#160 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug promotion-conversion
Dominant language
Julia
Stars
582
Forks
92
Avg merge
1h 12m
Merged PRs (30d)
2

Description

a = 1
s = zpk("s")
base = ss((a-s)/(a+s))
Qq = [ss(1.);base;[balreal(base^k)[1] for k = 2:10-1]] # Does not work
Qq = [ss(1.);base;[balreal(base^k)[1] for k = 2:10-1]...] # Works

Still a problem 2019-01-30
Still a problem 2020-10-10

ERROR: MethodError: Cannot `convert` an object of type Array{StateSpace{Float64,Array{Float64,2}},1} to an object of type StateSpace{Float64,Array{Float64,2}}
Closest candidates are:
  convert(::Type{StateSpace{T,MT}}, ::AbstractArray{#s28,2} where #s28<:Number) where {T, MT} at /local/home/fredrikb/.julia/dev/ControlSystems/src/types/conversion.jl:25
  convert(::Type{StateSpace{T,MT}}, ::Number) where {T, MT} at /local/home/fredrikb/.julia/dev/ControlSystems/src/types/conversion.jl:36
  convert(::Type{StateSpace{T,MT}}, ::StateSpace) where {T, MT} at /local/home/fredrikb/.julia/dev/ControlSystems/src/types/conversion.jl:58
  ...
Stacktrace:
 [1] _broadcast_getindex_evalf at ./broadcast.jl:582 [inlined]
 [2] _broadcast_getindex at ./broadcast.jl:565 [inlined]
 [3] (::getfield(Base.Broadcast, Symbol("##17#18")){Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(convert),Tuple{Base.RefValue{Type{StateSpace{Float64,Array{Float64,2}}}},Tuple{StateSpace{Float64,Array{Float64,2}},StateSpace{Float64,Array{Float64,2}},Array{StateSpace{Float64,Array{Float64,2}},1}}}}})(::Int64) at ./broadcast.jl:954
 [4] ntuple at ./tuple.jl:158 [inlined]
 [5] tuplebroadcast at ./broadcast.jl:954 [inlined]
 [6] copy at ./broadcast.jl:952 [inlined]
 [7] materialize at ./broadcast.jl:756 [inlined]
 [8] _cat_t at /local/home/fredrikb/.julia/dev/ControlSystems/src/connections.jl:115 [inlined]
 [9] #cat_t#99 at ./abstractarray.jl:1353 [inlined]
 [10] #cat_t at ./none:0 [inlined]
 [11] _cat at ./abstractarray.jl:1351 [inlined]
 [12] #cat#100 at ./abstractarray.jl:1480 [inlined]
 [13] #cat at ./none:0 [inlined]
 [14] vcat(::StateSpace{Float64,Array{Float64,2}}, ::StateSpace{Float64,Array{Float64,2}}, ::Array{StateSpace{Float64,Array{Float64,2}},1}) at ./abstractarray.jl:1418
 [15] top-level scope at none:0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the vcat reproduction in the issue and inspect src/connections.jl around line 115, where the stack trace enters _cat_t. Compare the failing array argument with the working splatted form, then add a regression test showing both forms behave consistently. Done means the unsplatted vcat example no longer raises the reported conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.