update function to current hmatrix