Skip to content

Commit c086aec

Browse files
don't attempt to convert static Jacobians
1 parent 419e6c2 commit c086aec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/build_function.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,14 @@ function _build_function(target::JuliaTarget, rhss, args...;
336336
arr_sys_expr = (typeof(rhss) <: Vector || typeof(rhss) <: Matrix) && !(eltype(rhss) <: AbstractArray) ? quote
337337
if typeof($(fargs.args[1])) <: Union{ModelingToolkit.StaticArrays.SArray,ModelingToolkit.LabelledArrays.SLArray}
338338
$xname = ModelingToolkit.StaticArrays.@SArray $arr_sys_expr
339-
convert(typeof($(fargs.args[1])),$xname)
339+
if $(typeof(rhss) <: Vector) # Only try converting if it should match `u`
340+
convert(typeof($(fargs.args[1])),$xname)
341+
else
342+
$xname
343+
end
340344
else
341345
$xname = $arr_sys_expr
342-
if !(typeof($(fargs.args[1])) <: Array)
346+
if !(typeof($(fargs.args[1])) <: Array) && $(typeof(rhss) <: Vector)
343347
convert(typeof($(fargs.args[1])),$xname)
344348
else
345349
$xname

0 commit comments

Comments
 (0)