perf_dot.cpp 747 B

12345678910111213141516171819202122232425262728293031
  1. #include "perf_precomp.hpp"
  2. namespace opencv_test
  3. {
  4. using namespace perf;
  5. typedef tuple<MatType, int> MatType_Length_t;
  6. typedef TestBaseWithParam<MatType_Length_t> MatType_Length;
  7. PERF_TEST_P( MatType_Length, dot,
  8. testing::Combine(
  9. testing::Values( CV_8UC1, CV_8SC1, CV_16SC1, CV_16UC1, CV_32SC1, CV_32FC1 ),
  10. testing::Values( 32, 64, 128, 256, 512, 1024 )
  11. ))
  12. {
  13. int type = get<0>(GetParam());
  14. int size = get<1>(GetParam());
  15. Mat a(size, size, type);
  16. Mat b(size, size, type);
  17. declare.in(a, b, WARMUP_RNG);
  18. declare.time(100);
  19. double product;
  20. TEST_CYCLE_N(1000) product = a.dot(b);
  21. SANITY_CHECK(product, 1e-6, ERROR_RELATIVE);
  22. }
  23. } // namespace