an implementation of cholesky factorization for class