Gaussian elimination (not thoroughly tested)