I have this system of ODEs: $$ \frac{dS}{dt}=\pi S-\beta S Z\\ \frac{dZ}{dt}=\alpha S Z - \delta Z $$
I am trying to rewrite them in the form :
$$ \pmatrix{\dot{S}\\\dot{Z}}=\mbox{diag}(S,Z) \left(b+A\pmatrix{S\\Z}\right) $$
What is the best approach for this? I've solved it such that : $$ A=\pmatrix{0 ~~~~-\beta\\\alpha~~~~~~~~0} $$ $$ b=(\pi, -\delta)^T $$ But this was pretty slow, I was wondering what the most effecient approach would be for this and similar more difficult problems.