implement lu algorithm