diff --git a/unittest/python/test_QR.py b/unittest/python/test_QR.py index 37b4a696..aaf13cf0 100644 --- a/unittest/python/test_QR.py +++ b/unittest/python/test_QR.py @@ -56,3 +56,21 @@ colpiv_householder_qr.setThreshold(1e-8) assert colpiv_householder_qr.threshold() == 1e-8 assert eigenpy.is_approx(np.eye(rows, rows), colpiv_householder_qr.inverse()) + +# Test CompleteOrthogonalDecomposition +cod = eigenpy.CompleteOrthogonalDecomposition() +cod = eigenpy.CompleteOrthogonalDecomposition(rows, cols) +cod = eigenpy.CompleteOrthogonalDecomposition(A) + +cod = eigenpy.CompleteOrthogonalDecomposition(np.eye(rows, rows)) +X = rng.random((rows, 20)) +assert cod.absDeterminant() == 1.0 +assert cod.logAbsDeterminant() == 0.0 + +Y = cod.solve(X) +assert (X == Y).all() +assert cod.rank() == rows + +cod.setThreshold(1e-8) +assert cod.threshold() == 1e-8 +assert eigenpy.is_approx(np.eye(rows, rows), cod.pseudoInverse())