Example #1
0
def test_ball_smoke():
    dit.math.prng.seed(0)
    x = module.ball(3)
    x_ = np.array([0.21324626, 0.4465436, -0.65226253])
    assert np.allclose(x, x_)

    dit.math.prng.seed(0)
    x = module.ball(3, prng=dit.math.prng)
    assert np.allclose(x, x_)
Example #2
0
def test_ball_smoke():
    dit.math.prng.seed(0)
    x = module.ball(3)
    x_ = np.array([ 0.21324626,  0.4465436 , -0.65226253])
    np.testing.assert_allclose(x, x_)

    dit.math.prng.seed(0)
    x = module.ball(3, prng=dit.math.prng)
    np.testing.assert_allclose(x, x_)
Example #3
0
def test_base_with_size():
    # size 3, 1
    dit.math.prng.seed(0)
    x = module.ball(3, 1)
    x_ = np.array([[0.21324626, 0.4465436, -0.65226253]])
    assert np.allclose(x, x_)

    # size 4, 4
    dit.math.prng.seed(0)
    x = module.ball(4, 4)
    x_ = np.array([[0.69375635, -0.36303705, 0.35293677, -0.05622584],
                   [-0.06238751, 0.24817385, 0.08706278, 0.87899164],
                   [0.70592518, 0.1128636, 0.41171971, 0.30951042],
                   [0.72885111, -0.1000816, 0.15272267, -0.41665039]])
    assert np.allclose(x, x_)
Example #4
0
def test_base_with_size():
    # size 3, 1
    dit.math.prng.seed(0)
    x = module.ball(3, 1)
    x_ = np.array([[ 0.21324626,  0.4465436 , -0.65226253]])
    np.testing.assert_allclose(x, x_)

    # size 4, 4
    dit.math.prng.seed(0)
    x = module.ball(4, 4)
    x_ = np.array([
        [ 0.69375635, -0.36303705,  0.35293677, -0.05622584],
        [-0.06238751,  0.24817385,  0.08706278,  0.87899164],
        [ 0.70592518,  0.1128636 ,  0.41171971,  0.30951042],
        [ 0.72885111, -0.1000816 ,  0.15272267, -0.41665039]
    ])
    np.testing.assert_allclose(x, x_)