using cholesky factorization instead of LU
add mask