示例#1
2
def test_frank():
    """Simple exercise of the function frank(n)"""
    a = rogues.frank(5)
    npt.assert_almost_equal(1., np.linalg.det(a), 5)
示例#2
0
文件: test_utils.py 项目: macd/rogues
def test_bandred():
    """Simple Test of bandred, checks againts np.linalg.cond
    NEEDS MORE TESTING!  This test is pretty lame...
    """
    a = rogues.frank(9)
    # Use bandred to get a tri-diagonal form
    b = rogues.bandred(a, 1, 1)
    # Chop into a tri-diagonal form
    c = np.triu(np.tril(b, 1), -11)
    # They must be equal
    npt.assert_array_almost_equal(b, c)
示例#3
0
文件: test_utils.py 项目: macd/rogues
def test_augment():
    """One specific simple test for augment"""
    a = np.array([[1., 0., 0., 0., 4., 3., 2., 1.],
                  [0., 1., 0., 0., 3., 3., 2., 1.],
                  [0., 0., 1., 0., 0., 2., 2., 1.],
                  [0., 0., 0., 1., 0., 0., 1., 1.],
                  [4., 3., 0., 0., 0., 0., 0., 0.],
                  [3., 3., 2., 0., 0., 0., 0., 0.],
                  [2., 2., 2., 1., 0., 0., 0., 0.],
                  [1., 1., 1., 1., 0., 0., 0., 0.]])
    b = rogues.frank(4)
    c = rogues.augment(b)
    npt.assert_array_almost_equal(a, c, 12)
示例#4
0
文件: test_utils.py 项目: macd/rogues
def test_condeig():
    """
    Simple Test of condeig, checks (partly) results in Higham & Higham
    Note that the last two condtion numbers do _not_ match the results
    of H&H and seem exceptionally large
    """
    a = rogues.frank(6)
    gold_c = [1.30589002, 1.35605093, 2.04115713, 15.32552609, \
              43.52124194, 56.69535399]
    lr, vr, c = rogues.condeig(a)

    for i in range(6):
        npt.assert_almost_equal(c[i], gold_c[i], 6)
示例#5
0
def test_frank():
    """Simple exercise of the function frank(n)"""
    a = rogues.frank(5)
    npt.assert_almost_equal(1., np.linalg.det(a), 5)