def mechanism(x, d): g = np.linspace(min(x) - np.std(x), max(x) + np.std(x), d) return sp(g, np.random.randn(d))(x.flatten())[:, np.newaxis]
def mechanism(x,d): g = np.linspace(min(x)-np.std(x),max(x)+np.std(x),d); return sp(g,np.random.randn(d))(x.flatten())[:,np.newaxis]