implements lu decomposition