示例#1
0
def test_pascal_1():
    """Simple test of pascal matrix: k = 1."""
    # Notice we recover the unit matrix with n = 18, better than previous test
    n = 18
    a = rogues.pascal(n, 1)
    b = np.matrix(a) * np.matrix(a)
    assert(np.allclose(b, np.eye(n)))
示例#2
0
def test_pascal_1():
    """Simple test of pascal matrix: k = 1."""
    # Notice we recover the unit matrix with n = 18, better than previous test
    n = 18
    a = rogues.pascal(n, 1)
    b = np.matrix(a) * np.matrix(a)
    assert (np.allclose(b, np.eye(n)))
示例#3
0
def test_pascal_0():
    """Simple test of pascal matrix: k = 0."""
    # Note that this test will fail if n > 12
    n = 12
    a = rogues.pascal(n)
    w, v = nl.eig(a)
    b = w * w[::-1]
    npt.assert_array_almost_equal(b, np.ones(n))
示例#4
0
def test_pascal_0():
    """Simple test of pascal matrix: k = 0."""
    # Note that this test will fail if n > 12
    n = 12
    a = rogues.pascal(n)
    w, v = nl.eig(a)
    b = w * w[::-1]
    npt.assert_array_almost_equal(b, np.ones(n))