improved BE2D implementation by adding LU decomposition