Merge pull request #11049 from take1014:#10948

* Fix #10948

* Add test code

* Fixed build error

* Add value zero

* eigen: test cleanup
pull/11072/head
yuki takehara 7 years ago committed by Alexander Alekhin
parent 5bf7f09ac1
commit 0792ef8789
  1. 5
      modules/core/src/lda.cpp
  2. 11
      modules/core/test/test_eigen.cpp

@ -350,6 +350,9 @@ private:
// Look for single small sub-diagonal element
int l = n1;
while (l > low) {
if (norm < FLT_EPSILON) {
break;
}
s = std::abs(H[l - 1][l - 1]) + std::abs(H[l][l]);
if (s == 0.0) {
s = norm;
@ -594,7 +597,7 @@ private:
// Backsubstitute to find vectors of upper triangular form
if (norm == 0.0) {
if (norm < FLT_EPSILON) {
return;
}

@ -516,4 +516,15 @@ static void testEigen3x3()
TEST(Core_EigenNonSymmetric, float3x3) { testEigen3x3<float>(); }
TEST(Core_EigenNonSymmetric, double3x3) { testEigen3x3<double>(); }
typedef testing::TestWithParam<int> Core_EigenZero;
TEST_P(Core_EigenZero, double)
{
int N = GetParam();
Mat_<double> srcZero = Mat_<double>::zeros(N, N);
Mat_<double> expected_eigenvalueZero = Mat_<double>::zeros(N, 1); // 1D Mat
testEigen(srcZero, expected_eigenvalueZero);
testEigen(srcZero, expected_eigenvalueZero, true);
}
INSTANTIATE_TEST_CASE_P(/**/, Core_EigenZero, testing::Values(2, 3, 5));
}} // namespace

Loading…
Cancel
Save