Skip to content

Commit 653c061

Browse files
committed
changed: loosen argument types for vector in API
1 parent 2ffc5f8 commit 653c061

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/controller/execute.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ julia> u = moveinput!(mpc, ry); round.(u, digits=3)
5858
"""
5959
function moveinput!(
6060
mpc::PredictiveController,
61-
ry::Vector = mpc.estim.model.yop,
62-
d ::Vector = mpc.buffer.empty;
63-
lastu::Vector = (mpc.buffer.u .= mpc.lastu0 .+ mpc.estim.model.uop),
64-
Dhat ::Vector = repeat!(mpc.buffer.D̂, d, mpc.Hp),
65-
Rhaty::Vector = repeat!(mpc.buffer.Ŷ, ry, mpc.Hp),
66-
Rhatu::Vector = mpc.Uop,
61+
ry::AbstractVector = mpc.estim.model.yop,
62+
d ::AbstractVector = mpc.buffer.empty;
63+
lastu::AbstractVector = (mpc.buffer.u .= mpc.lastu0 .+ mpc.estim.model.uop),
64+
Dhat ::AbstractVector = repeat!(mpc.buffer.D̂, d, mpc.Hp),
65+
Rhaty::AbstractVector = repeat!(mpc.buffer.Ŷ, ry, mpc.Hp),
66+
Rhatu::AbstractVector = mpc.Uop,
6767
= Dhat,
6868
R̂y = Rhaty,
6969
R̂u = Rhatu

src/general.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function repeatdiag(A::Hermitian{NT, Diagonal{NT, Vector{NT}}}, n::Int) where {N
174174
end
175175

176176
"In-place version of `repeat` but for vectors only."
177-
function repeat!(Y::Vector, a::Vector, n::Int)
177+
function repeat!(Y::AbstractVector, a::AbstractVector, n::Int)
178178
na = length(a)
179179
for i=0:n-1
180180
# stop if Y is too short, another clearer error is thrown later in the code:

src/predictive_control.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ print_backends(::IO, ::PredictiveController) = nothing
5151

5252
"Functor allowing callable `PredictiveController` object as an alias for `moveinput!`."
5353
function (mpc::PredictiveController)(
54-
ry::Vector = mpc.estim.model.yop,
55-
d ::Vector = mpc.estim.buffer.empty;
54+
ry::AbstractVector = mpc.estim.model.yop,
55+
d ::AbstractVector = mpc.estim.buffer.empty;
5656
kwargs...
5757
)
5858
return moveinput!(mpc, ry, d; kwargs...)

0 commit comments

Comments
 (0)