Esempio n. 1
0
def test_norm_smoketest():
    d = np.array([.2, .3, .5])

    # prng is None
    dit.math.prng.seed(0)
    x = module.norm(d)
    x_ = np.array([0.49606291, 0.13201838, 0.37191871])
    assert np.allclose(x, x_)

    # prng is not None
    dit.math.prng.seed(0)
    x = module.norm(d, prng=dit.math.prng)
    assert np.allclose(x, x_)

    # size is not None
    dit.math.prng.seed(0)
    x = module.norm(d, size=1)
    assert np.allclose(x, np.asarray([x_]))
Esempio n. 2
0
def test_norm_smoketest():
    d = np.array([.2, .3, .5])

    # prng is None
    dit.math.prng.seed(0)
    x = module.norm(d)
    x_ = np.array([ 0.49606291,  0.13201838,  0.37191871])
    np.testing.assert_allclose(x, x_)

    # prng is not None
    dit.math.prng.seed(0)
    x = module.norm(d, prng=dit.math.prng)
    np.testing.assert_allclose(x, x_)

    # size is not None
    dit.math.prng.seed(0)
    x = module.norm(d, size=1)
    np.testing.assert_allclose(x, np.asarray([x_]))
Esempio n. 3
0
def test_norm_spherical_cov():
    d = np.array([.2, .3, .5])
    dit.math.prng.seed(0)
    x = module.norm(d, .3)
    x_ = np.array([0.34790127, 0.20240029, 0.44969844])
    assert np.allclose(x, x_)
Esempio n. 4
0
def test_norm_spherical_cov():
    d = np.array([.2, .3, .5])
    dit.math.prng.seed(0)
    x = module.norm(d, .3)
    x_ = np.array([ 0.34790127,  0.20240029,  0.44969844])
    np.testing.assert_allclose(x, x_)