def time_compute_distance2outer(self): for _ in range(1000000): montecarlo.compute_distance2outer_wrapper(0.0, 0.5, 1.0) montecarlo.compute_distance2outer_wrapper(1.0, 0.5, 1.0) montecarlo.compute_distance2outer_wrapper(0.3, 1.0, 1.0) montecarlo.compute_distance2outer_wrapper(0.3, -1.0, 1.0) montecarlo.compute_distance2outer_wrapper(0.5, 0.0, 1.0)
def test_compute_distance2outer(): assert montecarlo.compute_distance2outer_wrapper(0.0, 0.5, 1.0) == 1.0 assert montecarlo.compute_distance2outer_wrapper(1.0, 0.5, 1.0) == 0.0 assert montecarlo.compute_distance2outer_wrapper(0.3, 1.0, 1.0) == 0.7 assert montecarlo.compute_distance2outer_wrapper(0.3, -1.0, 1.0) == 1.3 assert montecarlo.compute_distance2outer_wrapper(0.5, 0.0, 1.0) == np.sqrt(0.75)