The changes are a couple of bug fixes. In the function "mat_equation"
has been added as the result vector x has to be initialized to zero if the input is a vector. Similarly, in function "mat_ode"
has been added to initialize value of dx/dt if input is a vector.
A major change has been to be able to solve the ODE when matrix E is singular. In the case, for an nXn matrix E, the rank will be k<n. This means that after the row operations, the lowest (n-k) rows will be zero rows. But if the diagonal elements of matrix A of these rows are not zero, the variable could still be calculated as that what this code does:
The concept here is that through the matrix A, these variables are still linked to the dynamic variables and so even if they are not directly affected by an input signal, they should be non-zero.