#solve for solving linear equations for dense matrices.
#factorize_lu now optionally returns the permutation matrix too.