@@ -370,6 +370,7 @@ function init_predmat(
370370 end
371371 # Apow_csum 3D array : Apow_csum[:,:,1] = A^0, Apow_csum[:,:,2] = A^1 + A^0, ...
372372 Âpow_csum = cumsum (Âpow, dims= 3 )
373+ jℓ = cumsum (nb) # introduced in move_blocking docstring
373374 # three helper functions to improve code clarity and be similar to eqs. in docstring:
374375 getpower (array3D, power) = @views array3D[:,:, power+ 1 ]
375376 W (m) = @views Âpow_csum[:,:, m+ 1 ]
@@ -380,7 +381,6 @@ function init_predmat(
380381 end
381382 return Q
382383 end
383- jℓ = cumsum (nb)
384384 # --- current state estimates x̂0 ---
385385 kx̂ = getpower (Âpow, Hp)
386386 K = Matrix {NT} (undef, Hp* ny, nx̂)
@@ -399,22 +399,16 @@ function init_predmat(
399399 for j= 1 : Hc
400400 iCol = (1 : nu) .+ nu* (j- 1 )
401401 for i= j: Hc
402- @show i, j
403402 i_Q = (i == 1 && j == 1 ) ? 0 : jℓ[i- 1 ]
404403 k_Q = jℓ[i]
405404 b_Q = (j == 1 ) ? 0 : jℓ[j- 1 ]
406405 iRow = (1 : ny* nb[i]) .+ ny* i_Q
407- @show iRow
408406 Q = @views E[iRow, iCol]
409407 Q! (Q, i_Q, k_Q, b_Q)
410408 end
411409 j_ex̂ = (j == 1 ) ? 0 : jℓ[j- 1 ]
412- ex̂[: , iCol] = W (Hp - j_ex̂ - 1 )* B̂u
413- end
414-
415- display (E)
416-
417-
410+ ex̂[:, iCol] = W (Hp - j_ex̂ - 1 )* B̂u
411+ end
418412 # --- current measured disturbances d0 and predictions D̂0 ---
419413 gx̂ = getpower (Âpow, Hp- 1 )* B̂d
420414 G = Matrix {NT} (undef, Hp* ny, nd)
0 commit comments