Added functionality to dump matrices and residual in if statements
Also, functionality to read in a matrix