Skip to content

Commit c715b99

Browse files
committed
changed: using the new empty_similar elsewhere
1 parent 09073ca commit c715b99

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/controller/construct.jl‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,9 @@ function init_quadprog(
869869
end
870870
"Return empty matrix if `model` is not a [`LinModel`](@ref)."
871871
function init_quadprog(
872-
::SimModel{NT}, ::TranscriptionMethod, ::ControllerWeights, args...; kwargs...
873-
) where {NT<:Real}
874-
H̃ = Hermitian(zeros(NT, 0, 0), :L)
875-
return H̃
872+
::SimModel, ::TranscriptionMethod, weights::ControllerWeights, args...; kwargs...
873+
)
874+
return empty_similar(weights.M_Hp)
876875
end
877876

878877
"Check the condition number of `H̃` and display a `@warn` if `cond(H̃) > warn_cond`."

‎src/controller/transcription.jl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ function init_defectmat(
572572
model::SimModel, estim::InternalModel{NT}, transcription::OrthogonalCollocation,
573573
Hp, Hc, _ , Co, λo
574574
) where {NT<:Real}
575-
As, nxs = zeros(NT, 0, 0), 0 # the state vector is not augmented, no stochastic defects
575+
As, nxs = empty_similar(estim.As), 0 # state vector not augmented, no stochastic defects
576576
return init_defectmat_orthocolloc(model, estim, transcription, Hp, Hc, Co, λo, As, nxs)
577577
end
578578

‎src/estimator/construct.jl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ function init_estimstoch(
207207
nu, ny, nym = model.nu, model.ny, length(i_ym)
208208
As_u , Cs_u , nint_u = init_integrators(nint_u , nu , "u")
209209
As_ym, Cs_ym, nint_ym = init_integrators(nint_ym, nym, "ym")
210-
As_y, _ , Cs_y = stoch_ym2y(model, i_ym, As_ym, zeros(NT, 0, 0), Cs_ym, zeros(NT, 0, 0))
210+
Bs_ym = Ds_ym = empty_similar(As_ym)
211+
As_y, _ , Cs_y = stoch_ym2y(model, i_ym, As_ym, Bs_ym, Cs_ym, Ds_ym)
211212
nxs_u, nxs_y = size(As_u, 1), size(As_y, 1)
212213
# combines input and output stochastic models:
213214
As = [As_u zeros(NT, nxs_u, nxs_y); zeros(NT, nxs_y, nxs_u) As_y]

0 commit comments

Comments
 (0)