1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #11904 from terfendail/matx_solve_fix

Fixed Matx::solve function for non-square matrixes (#11904)
This commit is contained in:
Vitaly Tuzov
2018-07-11 22:00:57 +03:00
committed by Alexander Alekhin
parent 999aba3807
commit d0a3686812
2 changed files with 43 additions and 9 deletions
+15
View File
@@ -3129,6 +3129,21 @@ TEST(Core_QR_Solver, accuracy64f)
ASSERT_FALSE(solve(A, B, solutionQR, DECOMP_QR));
}
TEST(Core_Solve, regression_11888)
{
cv::Matx<float, 3, 2> A(
2, 1,
3, 1,
6, 1
);
cv::Vec<float, 3> b(4, 5, 7);
cv::Matx<float, 2, 1> xQR = A.solve(b, DECOMP_QR);
cv::Matx<float, 2, 1> xSVD = A.solve(b, DECOMP_SVD);
EXPECT_LE(cvtest::norm(xQR, xSVD, CV_RELATIVE_L2), FLT_EPSILON);
cv::Matx<float, 2, 3> iA = A.inv(DECOMP_SVD);
EXPECT_LE(cvtest::norm(A*iA, Matx<float, 3, 3>::eye(), CV_RELATIVE_L2), 0.6);
}
softdouble naiveExp(softdouble x)
{
int exponent = x.getExp();