# DifferentialEquations.jl: complex-value matrix equations without in-place update

To solve a stiff complex-value matrix equation, I’m using the Rosenbrock23() solver. As a minimum working example, (may not be stiff, just to illustrate the error I got)

With in-place du, (function taking 4 arguments: du,u,p,t)

``````using DifferentialEquations
using LinearAlgebra

sz=[1 0;0 -1];

function rhs(du,u,p,t)
du.=-(.3+.5im)*u+sz
end

hdim=2
tf=30.0
ft0=zeros(Complex{Float64}, hdim, hdim);
tspan=(0.0,tf)

prob = ODEProblem(rhs,ft0,tspan)

sol = solve(prob,Rosenbrock23(autodiff=false))
sol.retcode
``````

works fine; however, the function that just returns du (taking 3 arguments: u,p,t)

``````using DifferentialEquations
using LinearAlgebra

sz=[1 0;0 -1];

function rhs(u,p,t)
du=-(.3+.5im)*u+sz
end

hdim=2
tf=30.0
ft0=zeros(Complex{Float64}, hdim, hdim);
tspan=(0.0,tf)

prob = ODEProblem(rhs,ft0,tspan)

sol = solve(prob,Rosenbrock23(autodiff=false))
sol.retcode
``````

fails with

DimensionMismatch(“diagonal matrix is 4 by 4 but right hand side has 2 rows”)

note that for this case, `sol = solve(prob)` works fine, but for my complicated stiff equation I need `Rosenbrock23(autodiff=false)`. Is it a bug to be reported or did I do something wrong here? Thanks!

update: it’s a bug fixed in here