def test_hess(self): """Compare rosen_hess(x) times p with rosen_hess_prod(x,p) (ticket #1248)""" x = np.array([3, 4, 5]) p = np.array([2, 2, 2]) hp = optimize.rosen_hess_prod(x, p) dothp = np.dot(optimize.rosen_hess(x), p) assert_equal(hp, dothp)
def test_hess(self): # Compare rosen_hess(x) times p with rosen_hess_prod(x,p). See gh-1775 x = np.array([3, 4, 5]) p = np.array([2, 2, 2]) hp = optimize.rosen_hess_prod(x, p) dothp = np.dot(optimize.rosen_hess(x), p) assert_equal(hp, dothp)
def test_hess(self): """Compare rosen_hess(x) times p with rosen_hess_prod(x,p) (ticket #1248)""" x = array([3, 4, 5]) p = array([2, 2, 2]) hp = optimize.rosen_hess_prod(x, p) dothp = np.dot(optimize.rosen_hess(x), p) assert_equal(hp, dothp)
def rosenbrock_function_hessian_prod(samples, vec): assert samples.shape[1] == 1 return rosen_hess_prod(samples[:, 0], vec[:, 0])[:, np.newaxis]
def apply_metric(self, x): inp = x.to_global_data_rw() pos = self._position.to_global_data_rw() return ift.Field.from_global_data(space, rosen_hess_prod(pos, inp))
def apply(self, x, mode): self._check_input(x, mode) inp = x.to_global_data_rw() out = ift.Field.from_global_data( space, rosen_hess_prod(self._loc.copy(), inp)) return out