Tests/testDFT.cpp
/**
 * Create some visual output for DFT matrices
 */
Create some visual output for DFT matrices
Create some visual output for DFT matrices
void output_dft(Complex::Array2D &input, Complex::Array2D &result, char const *file_prefix) {
  assert(file_prefix != nullptr);
  int const Dim = input.columns();
  {
    float real_input[Dim];
    for (int c = 0; c < Dim; ++c) {
      real_input[c] = input[0][c].re();
    }
    std::string filename = "obj/test/";
    filename << file_prefix << "_input.pgm";
    PGM pgm(Dim, 100);
    pgm.plot(real_input, Dim)
       .save(filename.c_str());
  }
  {
    float real_result[Dim];
    for (int c = 0; c < Dim; ++c) {
      real_result[c] = result[0][c].magnitude();
    }
    std::string filename = "obj/test/";
    filename << file_prefix << "_result.pgm";
    PGM pgm(Dim, 100);
    pgm.plot(real_result, Dim)
       .save(filename.c_str());
  }
}
void output_dft ( Complex :: Array2D & input , Complex :: Array2D & result , char const * file_prefix ) { assert ( file_prefix != nullptr ) ; int const Dim = input . columns ( ) ; { float real_input [ Dim ] ; for ( int c = 0 ; c < Dim ; ++ c ) { real_input [ c ] = input [ 0 ] [ c ] . re ( ) ; } std :: string filename = " " ; filename << file_prefix << " " ; PGM pgm ( Dim , 100 ) ; pgm . plot ( real_input , Dim ) . save ( filename . c_str ( ) ) ; } { float real_result [ Dim ] ; for ( int c = 0 ; c < Dim ; ++ c ) { real_result [ c ] = result [ 0 ] [ c ] . magnitude ( ) ; } std :: string filename = " " ; filename << file_prefix << " " ; PGM pgm ( Dim , 100 ) ; pgm . plot ( real_result , Dim ) . save ( filename . c_str ( ) ) ; } }
Create some visual output for DFT matrices
Create some visual output for DFT matrices