Using ModelingToolkit.jl to model a matrix ODE

Hi,

I’m trying to create a matrix ODE using ModelingToolkit,jl (to simplify autodiff and code optimization), but I’m receiving an error which I did not find in any of the issues of the library. Any idea what I’m doing wrong?

MWE:

using ModelingToolkit
using DifferentialEquations: solve

@variables x y[1:2, 1:2](x)
@parameters f g

mat = [1.0 2.0; 0.0 0.5]

D = Differential(x)
@named sys = ODESystem([D(y) ~ g * y + f * mat * y])

prob = ODEProblem(sys, [y => [1.0 0.0; 0.0 0.0]], [g => 1.0, f => 2.0])

solve(prob)

Stacktrace:

Stacktrace:
  [1] copyto!(dest::Vector{Any}, src::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing})
    @ Base ./abstractarray.jl:890
  [2] _collect(cont::UnitRange{Int64}, itr::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing}, #unused#::Base.HasEltype, isz::Base.HasLength)
    @ Base ./array.jl:655
  [3] collect(itr::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing})
    @ Base ./array.jl:649
  [4] broadcastable(x::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing})
    @ Base.Broadcast ./broadcast.jl:704
  [5] broadcasted
    @ ./broadcast.jl:1300 [inlined]
  [6] broadcast(::typeof(*), ::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing}, ::Symbolics.ArrayOp{AbstractMatrix{Real}})
    @ Base.Broadcast ./broadcast.jl:798
  [7] materialize(bc::Base.Broadcast.Broadcasted{Symbolics.SymWrapBroadcast, Nothing, typeof(*), Tuple{Num, Symbolics.Arr{Num, 2}}})
    @ Symbolics ~/.julia/packages/Symbolics/H8dtg/src/array-lib.jl:150
  [8] broadcast_preserving_zero_d
    @ ./broadcast.jl:849 [inlined]
  [9] *(A::Num, B::Symbolics.Arr{Num, 2})
    @ Base ./arraymath.jl:52
 [10] *(::Num, ::Num, ::Symbolics.Arr{Num, 2})
    @ Base ./operators.jl:655
 [11] top-level scope
    @ ~/Code/julia/control/src/mwe.jl:10
 [12] include(fname::String)
    @ Base.MainInclude ./client.jl:451
 [13] top-level scope
    @ REPL[3]:1
in expression starting at ./mwe.jl:10