MCPcopy Create free account
hub / github.com/davisking/dlib / test_random_stftrs

Function test_random_stftrs

dlib/test/fft.cpp:672–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670
671 template<typename R>
672 void test_random_stftrs()
673 {
674 constexpr R tol = std::is_same<R,float>::value ? 1e-5 : 1e-12;
675
676 std::size_t fftsize = 256;
677 std::size_t wlen = 128;
678
679 int test = 0;
680
681 for (long nsamples = 512 ; nsamples < 1024 ; ++nsamples)
682 {
683 matrix<R> samples1 = matrix_cast<R>(randm(1, nsamples));
684 matrix<R> samples2 = istftr(stftr(samples1, make_hann(), fftsize, wlen, wlen/2), make_hann(), wlen, wlen/2);
685
686 const long minsamples = std::min(samples1.nc(), samples2.nc());
687 DLIB_TEST(max(abs(subm(samples1, 0, 0, 1, minsamples) - subm(samples2, 0, 0, 1, minsamples))) < tol);
688
689 if (test++ % 10 == 0)
690 print_spinner();
691 }
692
693 print_spinner();
694 }
695
696 class test_fft : public tester
697 {

Callers

nothing calls this directly

Calls 10

istftrFunction · 0.85
stftrFunction · 0.85
make_hannFunction · 0.85
absFunction · 0.85
submFunction · 0.85
print_spinnerFunction · 0.85
randmFunction · 0.70
minFunction · 0.50
maxFunction · 0.50
ncMethod · 0.45

Tested by

no test coverage detected