From 8496f86f84a78e1d8b2424ad5048c5fdab37f58f Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 13 Nov 2019 21:16:53 +0100 Subject: Enable CompleteOrthogonalDecomposition::pseudoInverse with non-square fixed-size matrices. --- test/qr_colpivoting.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/qr_colpivoting.cpp') diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index a563b5470..06f16438f 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp @@ -70,10 +70,11 @@ void cod_fixedsize() { Cols = MatrixType::ColsAtCompileTime }; typedef typename MatrixType::Scalar Scalar; + typedef CompleteOrthogonalDecomposition > COD; int rank = internal::random(1, (std::min)(int(Rows), int(Cols)) - 1); Matrix matrix; createRandomPIMatrixOfRank(rank, Rows, Cols, matrix); - CompleteOrthogonalDecomposition > cod(matrix); + COD cod(matrix); VERIFY(rank == cod.rank()); VERIFY(Cols - cod.rank() == cod.dimensionOfKernel()); VERIFY(cod.isInjective() == (rank == Rows)); @@ -90,6 +91,9 @@ void cod_fixedsize() { JacobiSVD svd(matrix, ComputeFullU | ComputeFullV); Matrix svd_solution = svd.solve(rhs); VERIFY_IS_APPROX(cod_solution, svd_solution); + + typename Inverse::PlainObject pinv = cod.pseudoInverse(); + VERIFY_IS_APPROX(cod_solution, pinv * rhs); } template void qr() -- cgit v1.2.3