Improvements to crout and doolittle LU decomposition functions