コード例 #1
0
ファイル: test_rogues.py プロジェクト: fabianp/rogues
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
ファイル: test_rogues.py プロジェクト: serenidpity/rogues
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
ファイル: test_rogues.py プロジェクト: fabianp/rogues
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
ファイル: test_rogues.py プロジェクト: serenidpity/rogues
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))