# Non-Diagonal SDE with matrix variables

I was trying to apply the method described at

https://diffeq.sciml.ai/stable/tutorials/sde_example/#Example-4:-Systems-of-SDEs-with-Non-Diagonal-Noise

for a matrix valued variable, e.g.

``````f(du,u,p,t) = du .= 1.01u
function g(du,u,p,t)
du[1,1,1] = 1.0
du[1,2,1] = 1.0

du[2,1,2] = 1.0
du[2,2,2] = 1.0

du[3,1,3] = 1.0
du[3,2,3] = 1.0
end
prob = SDEProblem(f,g,ones(3,2),(0.0,1.0),noise_rate_prototype=zeros(3,2,3))
``````

with the intention that the last dimension of the noise_rate_prototype would define the number of independent Wiener processes, and would be matrix multiplied over to get the right dimensions for my matrix variable.

Unfortunately, this doesn’t work, and I was wondering if this is just not supported, or what the correct syntax for such a system would be.

Open an issue. Its definition is `g(u,p,t)*dW`, so `dW` is always a vector. So then `noise_rate_prototype` always needs to be a matrix. That means `f` has to be vector defined in any case of non-diagonal noise. I think we can generalize it, but that’s how the linear algebra works out today.