implemented computeH.m