Skip to content

Commit a81709c

Browse files
author
Alexey Stukalov
committed
prepare_start_params(): tighten type check
1 parent 4f6a426 commit a81709c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/optimizer/abstract.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,18 @@ function prepare_start_params(start_val::AbstractVector, model::AbstractSem; kwa
154154
"The length of `start_val` vector ($(length(start_val))) does not match the number of model parameters ($(nparams(model))).",
155155
),
156156
)
157+
(eltype(start_val) <: Number) || throw(
158+
TypeError(
159+
:prepare_start_params, "start_val elements must be numeric",
160+
Number, eltype(start_val),
161+
),
162+
)
157163
return start_val
158164
end
159165

160166
function prepare_start_params(start_val::AbstractDict, model::AbstractSem; kwargs...)
161-
return [start_val[param] for param in params(model)] # convert to a vector
167+
# convert to a vector
168+
return prepare_start_params([start_val[param] for param in params(model)], model; kwargs...)
162169
end
163170

164171
# get from the ParameterTable (potentially from a different model with match param names)

0 commit comments

Comments
 (0)