Skip to content

Commit

Permalink
test: test Eigen::CompleteOrthogonalDecomposition
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Jun 11, 2024
1 parent 4553a01 commit 499cd83
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions unittest/python/test_QR.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit 499cd83

Please sign in to comment.