\r
#define sign(a) a > 0 ? 1 : a == 0 ? 0 : -1\r
\r
+#define CORE_EIGEN_ERROR_COUNT 1\r
+#define CORE_EIGEN_ERROR_SIZE 2\r
+#define CORE_EIGEN_ERROR_DIFF 3\r
+#define CORE_EIGEN_ERROR_ORTHO 4\r
+#define CORE_EIGEN_ERROR_ORDER 5\r
+\r
+// #define CORE_EIGEN_ERROR_DIFF \r
+\r
class Core_EigenTest: public cvtest::BaseTest\r
{\r
public: \r
- Core_EigenTest();\r
+ \r
+ Core_EigenTest();\r
~Core_EigenTest();\r
-\r
+ \r
protected:\r
- void run (int);\r
+ \r
+ bool test_values(const cv::Mat& src); // complex test for eigen without vectors\r
+ bool check_full(int type); // compex test for symmetric matrix\r
+ virtual void run (int) = 0; // main testing method\r
\r
private:\r
\r
float eps_val_32, eps_vec_32;\r
- double eps_val_64, eps_vec_64;\r
- void check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index = -1, int high_index = -1);\r
- void check_pair_count(const cv::Mat& src, const cv::Mat& evalues, const cv::Mat& evectors, int low_index = -1, int high_index = -1);\r
- bool check_diff(const cv::Mat& original_values, const cv::Mat& original_vectors, \r
- const cv::Mat& found_values, const cv::Mat& found_vectors, \r
- const bool compute_eigen_vectors, const int values_type, const int norm_type);\r
+ float eps_val_64, eps_vec_64;\r
+ bool check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index = -1, int high_index = -1);\r
+ bool check_pair_count(const cv::Mat& src, const cv::Mat& evalues, const cv::Mat& evectors, int low_index = -1, int high_index = -1);\r
+ bool check_pairs_order(const cv::Mat& eigen_values); // checking order of eigen values & vectors (it should be none up)\r
+ bool check_orthogonality(const cv::Mat& U); // checking is matrix of eigen vectors orthogonal\r
+ bool test_pairs(const cv::Mat& src); // complex test for eigen with vectors\r
+};\r
+\r
+class Core_EigenTest_Scalar : public Core_EigenTest\r
+{\r
+ public:\r
+ Core_EigenTest_Scalar() : Core_EigenTest() {}\r
+ ~Core_EigenTest_Scalar();\r
+ virtual void run(int) = 0;\r
+};\r
+\r
+class Core_EigenTest_Scalar_32 : public Core_EigenTest_Scalar\r
+{\r
+ public:\r
+ Core_EigenTest_Scalar_32() : Core_EigenTest_Scalar() {}\r
+ ~Core_EigenTest_Scalar_32();\r
+\r
+ void run(int);\r
+};\r
+\r
+class Core_EigenTest_Scalar_64 : public Core_EigenTest_Scalar\r
+{\r
+ public:\r
+ Core_EigenTest_Scalar_64() : Core_EigenTest_Scalar() {}\r
+ ~Core_EigenTest_Scalar_64();\r
+ void run(int);\r
+};\r
+\r
+class Core_EigenTest_32 : public Core_EigenTest\r
+{\r
+ public:\r
+ Core_EigenTest_32(): Core_EigenTest() {}\r
+ ~Core_EigenTest_32() {}\r
+ void run(int);\r
};\r
\r
-Core_EigenTest::Core_EigenTest() : eps_val_32(1e-3), eps_vec_32(1e-2), eps_val_64(1e-5), eps_vec_64(1e-4) {}\r
+class Core_EigenTest_64 : public Core_EigenTest\r
+{\r
+ public:\r
+ Core_EigenTest_64(): Core_EigenTest() {}\r
+ ~Core_EigenTest_64() {}\r
+ void run(int);\r
+};\r
+\r
+Core_EigenTest_Scalar::~Core_EigenTest_Scalar() {}\r
+Core_EigenTest_Scalar_32::~Core_EigenTest_Scalar_32() {}\r
+Core_EigenTest_Scalar_64::~Core_EigenTest_Scalar_64() {}\r
+\r
+void Core_EigenTest_Scalar_32::run(int) \r
+{\r
+ float value = cv::randu<float>();\r
+ cv::Mat src(1, 1, CV_32FC1, Scalar::all((float)value));\r
+ test_values(src);\r
+ src.~Mat();\r
+}\r
+\r
+void Core_EigenTest_Scalar_64::run(int)\r
+{\r
+ float value = cv::randu<float>();\r
+ cv::Mat src(1, 1, CV_64FC1, Scalar::all((double)value));\r
+ test_values(src);\r
+ src.~Mat();\r
+}\r
+\r
+void Core_EigenTest_32::run(int) { check_full(CV_32FC1); }\r
+void Core_EigenTest_64::run(int) { check_full(CV_64FC1); }\r
+\r
+Core_EigenTest::Core_EigenTest() : eps_val_32(1e-3), eps_vec_32(1e-2), eps_val_64(1e-4), eps_vec_64(1e-3) {}\r
Core_EigenTest::~Core_EigenTest() {}\r
\r
-void Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index, int high_index)\r
+bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues, int low_index, int high_index)\r
{\r
int n = src.rows, s = sign(high_index);\r
- CV_Assert ( evalues.rows == n - max<int>(0, low_index) - ((int)((n/2.0)*(s*s-s)) + (1+s-s*s)*(n - (high_index+1))) && evalues.cols == 1);\r
+ if (!( (evalues.rows == n - max<int>(0, low_index) - ((int)((n/2.0)*(s*s-s)) + (1+s-s*s)*(n - (high_index+1)))) && (evalues.cols == 1)))\r
+ { \r
+ std::cout << "Checking sizes of eigen values matrix " << evalues << "..." << endl;\r
+ CV_Error(CORE_EIGEN_ERROR_COUNT, "Matrix of eigen values must have the same rows as source matrix and 1 column."); \r
+ return false; \r
+ }\r
+ return true;\r
}\r
\r
-void Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues, const cv::Mat& evectors, int low_index, int high_index)\r
+bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues, const cv::Mat& evectors, int low_index, int high_index)\r
{\r
int n = src.rows, s = sign(high_index);\r
int right_eigen_pair_count = n - max<int>(0, low_index) - ((int)((n/2.0)*(s*s-s)) + (1+s-s*s)*(n - (high_index+1)));\r
- CV_Assert ( evectors.rows == right_eigen_pair_count &&\r
- evectors.cols == right_eigen_pair_count &&\r
- evalues.rows == right_eigen_pair_count && \r
- evalues.cols == 1 ); \r
-}\r
\r
-bool Core_EigenTest::check_diff(const cv::Mat& original_values, const cv::Mat& original_vectors, \r
- const cv::Mat& found_values, const cv::Mat& found_vectors, \r
- const bool compute_eigen_vectors, const int values_type, const int norm_type)\r
-{\r
- double eps_val = values_type == CV_32FC1 ? eps_val_32 : eps_val_64;\r
- double eps_vec = values_type == CV_32FC1 ? eps_vec_32 : eps_vec_64;\r
+ if (!((evectors.rows == right_eigen_pair_count) && (evectors.cols == right_eigen_pair_count)))\r
+ { \r
+ std::cout << "Checking sizes of eigen vectors matrix " << evectors << "..." << endl;\r
+ CV_Error (CORE_EIGEN_ERROR_SIZE, "Source matrix and matrix of eigen vectors must have the same sizes."); \r
+ return false; \r
+ }\r
\r
- switch (compute_eigen_vectors)\r
+ if (!((evalues.rows == right_eigen_pair_count) && (evalues.cols == 1)))\r
{\r
- case true: \r
- {\r
- double diff_val = cv::norm(original_values, found_values, norm_type);\r
- double diff_vec = cv::norm(original_vectors, found_vectors, norm_type);\r
-\r
- if (diff_val > eps_val) { ts->printf(cvtest::TS::LOG, "Accuracy of eigen values computing less than requered."); return false; }\r
- if (diff_vec > eps_vec) { ts->printf(cvtest::TS::LOG, "Accuracy of eigen vectors computing less than requered."); return false; }\r
- \r
- break;\r
- }\r
-\r
- case false: \r
- {\r
- double diff_val = cv::norm(original_values, found_values, norm_type);\r
- \r
- if (diff_val > eps_val) { ts->printf(cvtest::TS::LOG, "Accuracy of eigen values computing less than requered."); return false; }\r
- \r
- break;\r
- }\r
-\r
- default:;\r
+ std::cout << "Checking sizes of eigen values matrix " << evalues << "..." << endl;\r
+ CV_Error (CORE_EIGEN_ERROR_COUNT, "Matrix of eigen values must have the same rows as source matrix and 1 column."); \r
+ return false; \r
}\r
\r
return true;\r
}\r
\r
-void Core_EigenTest::run(int)\r
+bool Core_EigenTest::check_orthogonality(const cv::Mat& U)\r
{\r
- const int DIM = 3;\r
- \r
- // tests data \r
+ int type = U.type();\r
+ double eps_vec = type == CV_32FC1 ? eps_vec_32 : eps_vec_64;\r
+ cv::Mat UUt; cv::mulTransposed(U, UUt, false); \r
\r
- float sym_matrix[DIM*DIM] = { 0.0f, 1.0f, 0.0f, \r
- 1.0f, 0.0f, 1.0f, \r
- 0.0f, 1.0f, 0.0f }; // source symmerical matrix\r
+ cv::Mat E = Mat::eye(U.rows, U.cols, type);\r
+ \r
+ double diff_L1 = cv::norm(UUt, E, NORM_L1);\r
+ double diff_L2 = cv::norm(UUt, E, NORM_L2);\r
+ double diff_INF = cv::norm(UUt, E, NORM_INF);\r
\r
- float _eval[DIM] = { sqrt(2.0f), 0.0f, -sqrt(2.0f) }; // eigen values of 3*3 matrix\r
+ if (diff_L1 > eps_vec) { std::cout << "Checking orthogonality of matrix " << U << "..." << endl; CV_Error(CORE_EIGEN_ERROR_ORTHO, "Matrix of eigen vectors is not orthogonal."); return false; }\r
+ if (diff_L2 > eps_vec) { std::cout << "Checking orthogonality of matrix " << U << "..." << endl; CV_Error(CORE_EIGEN_ERROR_ORTHO, "Matrix of eigen vectors is not orthogonal."); return false; }\r
+ if (diff_INF > eps_vec) { std::cout << "Checking orthogonality of matrix " << U << "..." << endl; CV_Error(CORE_EIGEN_ERROR_ORTHO, "Matrix of eigen vectors is not orthogonal."); return false; }\r
\r
- float _evec[DIM*DIM] = { 0.5f, 0.5f*sqrt(2.0f), 0.5f, \r
- -0.5f*sqrt(2.0f), 0.0f, 0.5f*sqrt(2.0f),\r
- 0.5f, -0.5f*sqrt(2.0f), 0.5f }; // eigen vectors of source matrix\r
+ return true;\r
+}\r
\r
- // initializing Mat-objects\r
- \r
- cv::Mat eigen_values, eigen_vectors;\r
+bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values)\r
+{\r
+ switch (eigen_values.type())\r
+ {\r
+ case CV_32FC1:\r
+ {\r
+ for (int i = 0; i < eigen_values.total() - 1; ++i)\r
+ if (!(eigen_values.at<float>(i, 0) > eigen_values.at<float>(i+1, 0)))\r
+ {\r
+ std::cout << "Checking order of eigen values vector " << eigen_values << "..." << endl;\r
+ CV_Error(CORE_EIGEN_ERROR_ORDER, "Eigen values are not sorted in ascending order.");\r
+ return false;\r
+ }\r
+\r
+ break;\r
+ }\r
\r
- cv::Mat src_32(DIM, DIM, CV_32FC1, sym_matrix);\r
- cv::Mat eval_32(DIM, 1, CV_32FC1, _eval);\r
- cv::Mat evec_32(DIM, DIM, CV_32FC1, _evec);\r
+ case CV_64FC1:\r
+ {\r
+ for (int i = 0; i < eigen_values.total() - 1; ++i)\r
+ if (!(eigen_values.at<double>(i, 0) > eigen_values.at<double>(i+1, 0)))\r
+ {\r
+ std::cout << "Checking order of eigen values vector " << eigen_values << "..." << endl;\r
+ CV_Error(CORE_EIGEN_ERROR_ORDER, "Eigen values are not sorted in ascending order.");\r
+ return false;\r
+ }\r
+\r
+ break;\r
+ }\r
\r
- cv::eigen(src_32, true, eigen_values, eigen_vectors);\r
+ default:;\r
+ }\r
\r
- check_pair_count(src_32, eigen_values, eigen_vectors);\r
+ return true;\r
+}\r
\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L1)) return; \r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_INF)) return;\r
+bool Core_EigenTest::test_pairs(const cv::Mat& src)\r
+{\r
+ int type = src.type();\r
+ double eps_vec = type == CV_32FC1 ? eps_vec_32 : eps_vec_64;\r
\r
- cv::eigen(src_32, false, eigen_values, eigen_vectors);\r
+ cv::Mat eigen_values, eigen_vectors;\r
+ \r
+ cv::eigen(src, true, eigen_values, eigen_vectors);\r
\r
- check_pair_count(src_32, eigen_values);\r
+ if (!check_pair_count(src, eigen_values, eigen_vectors)) return false;\r
\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L1)) return; \r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_INF)) return;\r
- \r
- cv::eigen(src_32, eigen_values, eigen_vectors);\r
+ if (!check_orthogonality (eigen_vectors)) return false;\r
\r
- check_pair_count(src_32, eigen_values, eigen_vectors);\r
+ if (!check_pairs_order(eigen_values)) return false;\r
\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L1)) return; \r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_INF)) return;\r
+ cv::Mat eigen_vectors_t; cv::transpose(eigen_vectors, eigen_vectors_t);\r
\r
- cv::eigen(src_32, eigen_values);\r
- \r
- check_pair_count(src_32, eigen_values);\r
+ cv::Mat src_evec(src.rows, src.cols, type);\r
+ src_evec = src*eigen_vectors_t; \r
\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L1)) return; \r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(eval_32, evec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_INF)) return;\r
+ cv::Mat eval_evec(src.rows, src.cols, type);\r
\r
- cv::Mat src_64(DIM, DIM, CV_64FC1, sym_matrix);\r
- cv::Mat eval_64(DIM, 1, CV_64FC1, _eval);\r
- cv::Mat evec_64(DIM, DIM, CV_64FC1, _evec);\r
+ switch (type)\r
+ { \r
+ case CV_32FC1:\r
+ {\r
+ for (size_t i = 0; i < src.cols; ++i)\r
+ {\r
+ cv::Mat tmp = eigen_values.at<float>(i, 0) * eigen_vectors_t.col(i); \r
+ for (size_t j = 0; j < src.rows; ++j) eval_evec.at<float>(j, i) = tmp.at<float>(j, 0); \r
+ }\r
\r
- cv::eigen(src_64, true, eigen_values, eigen_vectors);\r
+ break;\r
+ }\r
+ \r
+ case CV_64FC1:\r
+ {\r
+ for (size_t i = 0; i < src.cols; ++i)\r
+ {\r
+ cv::Mat tmp = eigen_values.at<double>(i, 0) * eigen_vectors_t.col(i); \r
+ for (size_t j = 0; j < src.rows; ++j) eval_evec.at<double>(j, i) = tmp.at<double>(j, 0); \r
+ }\r
\r
- check_pair_count(src_64, eigen_values, eigen_vectors);\r
+ break; \r
+ }\r
\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L1)) return; \r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_INF)) return;\r
+ default:;\r
+ }\r
\r
- cv::eigen(src_64, false, eigen_values, eigen_vectors);\r
+ cv::Mat disparity = src_evec - eval_evec;\r
\r
- check_pair_count(src_64, eigen_values);\r
+ double diff_L1 = cv::norm(disparity, NORM_L1);\r
+ double diff_L2 = cv::norm(disparity, NORM_L2);\r
+ double diff_INF = cv::norm(disparity, NORM_INF);\r
\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L1)) return; \r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_INF)) return;\r
- \r
- cv::eigen(src_64, eigen_values, eigen_vectors);\r
+ if (diff_L1 > eps_vec) { std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": L1-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen vectors computing less than required."); return false; }\r
+ if (diff_L2 > eps_vec) { std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": L2-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen vectors computing less than required."); return false; }\r
+ if (diff_INF > eps_vec) { std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": INF-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen vectors computing less than required."); return false; }\r
\r
- check_pair_count(src_64, eigen_values, eigen_vectors);\r
+ return true;\r
+}\r
\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L1)) return; \r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_INF)) return;\r
+bool Core_EigenTest::test_values(const cv::Mat& src)\r
+{\r
+ int type = src.type();\r
+ double eps_val = type == CV_32FC1 ? eps_val_32 : eps_val_64; \r
\r
- cv::eigen(src_64, eigen_values);\r
- \r
- check_pair_count(src_64, eigen_values);\r
+ cv::Mat eigen_values_1, eigen_values_2, eigen_vectors;\r
\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L1)) return; \r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(eval_64, evec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_INF)) return;\r
+ if (!test_pairs(src)) return false;\r
\r
- const int low_index = 1, high_index = 2; \r
- cv::Mat submat_val_32(eval_32.rowRange(low_index, high_index));\r
- cv::Mat submat_vec_32(evec_32.rowRange(low_index, high_index));\r
+ cv::eigen(src, true, eigen_values_1, eigen_vectors);\r
+ cv::eigen(src, false, eigen_values_2, eigen_vectors);\r
\r
- cv::eigen(src_32, eigen_values, low_index, high_index); \r
+ if (!check_pair_count(src, eigen_values_2)) return false;\r
+\r
+ double diff_L1 = cv::norm(eigen_values_1, eigen_values_2, NORM_L1);\r
+ double diff_L2 = cv::norm(eigen_values_1, eigen_values_2, NORM_L2); \r
+ double diff_INF = cv::norm(eigen_values_1, eigen_values_2, NORM_INF); \r
\r
- check_pair_count(src_32, eigen_values, eigen_vectors, low_index, high_index);\r
+ if (diff_L1 > eps_val) { std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": L1-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen values computing less than required."); return false; } \r
+ if (diff_L2 > eps_val) { std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": L2-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen vectors computing less than required."); return false; }\r
+ if (diff_INF > eps_val) { std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": INF-criteria..." << endl; CV_Error(CORE_EIGEN_ERROR_DIFF, "Accuracy of eigen vectors computing less than required."); return false; }\r
\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L1)) return;\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, false, CV_32FC1, NORM_INF)) return;\r
+ return true;\r
+}\r
\r
- cv::eigen(src_32, eigen_values, eigen_vectors, low_index, high_index);\r
+bool Core_EigenTest::check_full(int type)\r
+{\r
+ const int MATRIX_COUNT = 500;\r
+ const int MAX_DEGREE = 7;\r
\r
- check_pair_count(src_32, eigen_values, eigen_vectors, low_index, high_index);\r
+ srand(time(0));\r
\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L1)) return;\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_L2)) return;\r
- if (!check_diff(submat_val_32, submat_vec_32, eigen_values, eigen_vectors, true, CV_32FC1, NORM_INF)) return;\r
+ for (size_t i = 1; i <= MATRIX_COUNT; ++i)\r
+ {\r
+ size_t src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE+1)*1.0)); \r
\r
- cv::Mat submat_val_64(eval_64.rowRange(low_index, high_index));\r
- cv::Mat submat_vec_64(evec_64.rowRange(low_index, high_index)); \r
-\r
- cv::eigen(src_64, eigen_values, low_index, high_index);\r
-\r
- check_pair_count(src_64, eigen_values, low_index, high_index);\r
-\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L1)) return;\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, false, CV_64FC1, NORM_INF)) return;\r
+ cv::Mat src(src_size, src_size, type);\r
\r
- cv::eigen(src_64, eigen_values, eigen_vectors, low_index, high_index);\r
+ for (int j = 0; j < src.rows; ++j)\r
+ for (int k = j; k < src.cols; ++k) \r
+ if (type == CV_32FC1) src.at<float>(k, j) = src.at<float>(j, k) = cv::randu<float>();\r
+ else src.at<double>(k, j) = src.at<double>(j, k) = cv::randu<double>();\r
+ \r
+ if (!test_values(src)) return false;\r
\r
- check_pair_count(src_64, eigen_values, low_index, high_index);\r
+ src.~Mat();\r
+ }\r
\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L1)) return;\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_L2)) return;\r
- if (!check_diff(submat_val_64, submat_vec_64, eigen_values, eigen_vectors, true, CV_64FC1, NORM_INF)) return;\r
+ return true;\r
}\r
\r
-TEST(Core_Eigen, accuracy) { Core_EigenTest test; test.safe_run(); }\r
-\r
+TEST(Core_Eigen_Scalar_32, single_complex) {Core_EigenTest_Scalar_32 test; test.safe_run(); }\r
+TEST(Core_Eigen_Scalar_64, single_complex) {Core_EigenTest_Scalar_64 test; test.safe_run(); }\r
+TEST(Core_Eigen_32, complex) { Core_EigenTest_32 test; test.safe_run(); }\r
+TEST(Core_Eigen_64, complex) { Core_EigenTest_64 test; test.safe_run(); }
\ No newline at end of file