implemented an efficient method for computing the inverse of H.