Пример #1
0
def test_determinant():
    from ezdxf.math import Matrix44
    A = [
        [2, 3, 2, 5],
        [5, 1, 4, 5],
        [1, 12, 3, 1],
        [7, 3, 2, 2],
    ]
    det = LUDecomposition(A).determinant()
    chk = Matrix44(*A)
    assert chk.determinant() == det
Пример #2
0
def test_LU_decomposition_inverse():
    m = Matrix(matrix=EXPECTED_INVERSE)
    assert LUDecomposition(A).inverse() == m
Пример #3
0
def test_LU_decomposition_solve_matrix():
    lu = LUDecomposition(A)
    result = lu.solve_matrix(zip(B1, B2, B3))
    are_close_vectors(result.col(0), gauss_vector_solver(A, B1))
    are_close_vectors(result.col(1), gauss_vector_solver(A, B2))
    are_close_vectors(result.col(2), gauss_vector_solver(A, B3))
Пример #4
0
def test_LU_decomposition_solve_vector():
    R = LUDecomposition(A).solve_vector(B1)
    are_close_vectors(R, SOLUTION_B1)