| 522 | |
| 523 | template<typename R> |
| 524 | void test_vector_overload_inplace() |
| 525 | { |
| 526 | static constexpr double tol = std::is_same<R,double>::value ? 1e-15 : 5e-2; |
| 527 | static constexpr const char* typelabel = std::is_same<R,double>::value ? "double" : "float"; |
| 528 | |
| 529 | int test = 0; |
| 530 | |
| 531 | auto func = [&](long size) |
| 532 | { |
| 533 | if (++test % 100 == 0) |
| 534 | print_spinner(); |
| 535 | |
| 536 | matrix<complex<R>,0,1> m1 = rand_complex<R>(size,1); |
| 537 | std::vector<complex<R>> m1_v(m1.begin(), m1.end()); |
| 538 | |
| 539 | fft_inplace(m1); |
| 540 | fft_inplace(m1_v); |
| 541 | |
| 542 | R diff = max(norm(m1 - mat(m1_v))); |
| 543 | DLIB_TEST_MSG(diff < tol, "diff " << diff << " not within tol " << tol << " where (size) = (" << size << ")" << " type " << typelabel); |
| 544 | }; |
| 545 | |
| 546 | for (long size = 1; size <= 64; size++) |
| 547 | func(size); |
| 548 | |
| 549 | //some odd balls... |
| 550 | func(103); print_spinner(); |
| 551 | func(123); print_spinner(); |
| 552 | func(131); print_spinner(); |
| 553 | } |
| 554 | |
| 555 | template<typename R1, typename R2> |
| 556 | std::complex<R1> complex_cast(const std::complex<R2> &c) { |
nothing calls this directly
no test coverage detected