Write linear system in matrix form (#683)