adding modular arithmetic
adding modular arithmetic to lu-decompose