Пример #1
0
def test_QR():
    A = DenseMatrix(3, 3, [12, -51, 4, 6, 167, -68, -4, 24, -41])
    Q, R = A.QR()

    assert Q == DenseMatrix(3, 3, [
        Rational(6, 7),
        Rational(-69, 175),
        Rational(-58, 175),
        Rational(3, 7),
        Rational(158, 175),
        Rational(6, 175),
        Rational(-2, 7),
        Rational(6, 35),
        Rational(-33, 35)
    ])
    assert R == DenseMatrix(3, 3, [14, 21, -14, 0, 175, -70, 0, 0, 35])