Skip to content

Commit c39b57d

Browse files
authored
Specialize feedback index keywords for strict compilation (#1097)
* Improve constant propagation for compiled control analyses * Replace forced inlining with index specialization and constant propagation * Limit the proposal to feedback index specialization
1 parent 973f8d1 commit c39b57d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎lib/ControlSystemsBase/src/connections.jl‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ The manual section [From block diagrams to code](https://juliacontrol.github.io/
351351
See Zhou, Doyle, Glover (1996) for similar (somewhat less symmetric) formulas.
352352
"""
353353
function feedback(sys1::AbstractStateSpace, sys2::AbstractStateSpace;
354-
U1=:, Y1=:, U2=:, Y2=:, W1=:, Z1=:, W2=Int[], Z2=Int[],
355-
Wperm=:, Zperm=:, pos_feedback::Bool=false)
354+
U1::TU1=:, Y1::TY1=:, U2::TU2=:, Y2::TY2=:, W1::TW1=:, Z1::TZ1=:,
355+
W2::TW2=Int[], Z2::TZ2=Int[], Wperm::TWperm=:, Zperm::TZperm=:,
356+
pos_feedback::Bool=false) where {TU1, TY1, TU2, TY2, TW1, TZ1, TW2, TZ2, TWperm, TZperm}
356357

357358
timeevol = common_timeevol(sys1,sys2)
358359
T = Base.promote_type(numeric_type(sys1), numeric_type(sys2))
@@ -371,10 +372,10 @@ function feedback(sys1::AbstractStateSpace, sys2::AbstractStateSpace;
371372
Z2 isa Number && (Z2 = [Z2])
372373

373374
if (U1 isa Colon ? size(sys1, 2) : length(U1)) != (Y2 isa Colon ? size(sys2, 1) : length(Y2))
374-
error("Lengths of U1 ($U1) and Y2 ($Y2) must be equal")
375+
error("Lengths of U1 and Y2 must be equal")
375376
end
376377
if (U2 isa Colon ? size(sys2, 2) : length(U2)) != (Y1 isa Colon ? size(sys1, 1) : length(Y1))
377-
error("Lengths of U2 ($U2) and Y1 ($Y1) must be equal")
378+
error("Lengths of U2 and Y1 must be equal")
378379
end
379380

380381
α = pos_feedback ? 1 : -1 # The sign of feedback

0 commit comments

Comments
 (0)