Пример #1
0
    def test_run_hamiltonian(self):
        # Important to restrict the step in order to avoid the
        # discontinutiy at x=[0,0] of the hamiltonian

        for method in ['central', 'complex']:
            step = nd.MaxStepGenerator(base_step=1e-4)
            hessian = nd.Hessian(None, step=step, method=method)
            h, _error_estimate, true_h = run_hamiltonian(hessian,
                                                         verbose=False)
            self.assertTrue((np.abs((h - true_h) / true_h) < 1e-4).all())
Пример #2
0
    def test_run_hamiltonian(self):
        # Important to restrict the step in order to avoid the
        # discontinutiy at x=[0,0] of the hamiltonian

        for method in ['central', 'complex']:
            step = nd.MaxStepGenerator(base_step=1e-4)
            hessian = nd.Hessian(None, step=step, method=method)
            h, _error_estimate, true_h = run_hamiltonian(hessian,
                                                         verbose=False)
            assert (np.abs((h - true_h) / true_h) < 1e-4).all()
Пример #3
0
 def test_run_hamiltonian(self):
     h, _error_estimate, true_h = run_hamiltonian(nd.Hessian(None),
                                                  verbose=False)
     self.assertTrue((np.abs((h - true_h)/true_h) < 1e-4).all())
Пример #4
0
 def test_run_hamiltonian(self):
     h, _error_estimate, true_h = run_hamiltonian(nd.Hessian(None),
                                                  verbose=False)
     self.assertTrue((np.abs((h - true_h) / true_h) < 1e-4).all())