Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
def rosenbrock_function_hessian_prod(samples, vec):
    assert samples.shape[1] == 1
    return rosen_hess_prod(samples[:, 0], vec[:, 0])[:, np.newaxis]
Exemplo n.º 6
0
 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))
Exemplo n.º 7
0
 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