Beispiel #1
0
def test_alr_inv():
    x = np.array([1, 2, 3, 4]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert x.shape == y.shape
    assert np.allclose(x, y)

    x = np.array([[1, 2, 3, 4], [2, 2, 2, 4]]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert x.shape == y.shape
    assert np.allclose(x, y)
Beispiel #2
0
def test_alr_inv():
    x = np.array([1, 2, 3, 4]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert_equal_shape(x, y)
    assert_almost_equal_array(x, y)

    x = np.array([[1, 2, 3, 4], [2, 2, 2, 4]]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert_equal_shape(x, y)
    assert_almost_equal_array(x, y)
Beispiel #3
0
def test_alr_inv():
    x = np.array([1, 2, 3, 4]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert_equal_shape(x, y)
    assert_almost_equal_array(x, y)

    x = np.array([[1, 2, 3, 4], [2, 2, 2, 4]]) / 10
    x_alr = alr(x)
    y = alr_inv(x_alr)
    assert_equal_shape(x, y)
    assert_almost_equal_array(x, y)
Beispiel #4
0
def test_alr():
    x = np.array([1 / 3.0, 2 / 3.0])
    y = np.array([1 / 4.0, 3 / 4.0])

    x_alr = [-1]
    y_alr = [-1.5849625007211563]

    # 1D
    x1d_alr = alr(x)
    x1d_alr_ = np.array(x_alr)
    assert x1d_alr.shape == x1d_alr_.shape
    assert np.allclose(x1d_alr, x1d_alr_)

    # 2D
    xy = np.array([x, y])
    xy_alr = alr(xy)
    xy_alr_ = np.array([x_alr, y_alr])
    assert xy_alr.shape == xy_alr_.shape
    assert np.allclose(xy_alr, xy_alr_)
Beispiel #5
0
def test_alr():
    x = np.array([1/3.0, 2/3.0])
    y = np.array([1/4.0, 3/4.0])

    x_alr = [-1]
    y_alr = [-1.5849625007211563]

    # 1D
    x1d_alr = alr(x)
    x1d_alr_ = np.array(x_alr)
    assert_equal(x1d_alr.shape, x1d_alr_.shape)
    assert_true(allclose(x1d_alr, x1d_alr_))

    # 2D
    xy = np.array([x, y])
    xy_alr = alr(xy)
    xy_alr_ = np.array([x_alr, y_alr])
    assert_equal(xy_alr.shape, xy_alr_.shape)
    assert_true(allclose(xy_alr, xy_alr_))