def _subtract_from_diagonal(lap, vals):
    if isspmatrix(lap):
        lap.data[lap.row == lap.col] -= vals
    else:
        lap.flat[::lap.shape[0] + 1] -= vals
dataset/ETHPy150Open mmp2/megaman/megaman/geometry/laplacian.py/_subtract_from_diagonal/original