示例#1
0
def test_detect_banded_matrix():
    m1, m2 = detect_banded_matrix(BANDED_MATRIX)
    assert (m1, m2) == (2, 1)

    m1, m2 = detect_banded_matrix(TRICKY, check_all=False)
    assert (m1, m2) == (2, 1)

    m1, m2 = detect_banded_matrix(TRICKY, check_all=True)
    assert (m1, m2) == (5, 6)

    assert detect_banded_matrix(Matrix(shape=(10, 10))) == (0, 0)

    identity = Matrix.identity(shape=(10, 10))
    assert detect_banded_matrix(identity) == (0, 0)
示例#2
0
def test_identity():
    m = Matrix.identity((3, 4))
    for i in range(3):
        assert m[i, i] == 1.0