#include <iostream>
#include <vector>
#include <cmath>
#include <complex>
#include <algorithm>
#include "viennacl/linalg/host_based/fft_operations.hpp"
#include "viennacl/linalg/fft_operations.hpp"
#include "viennacl/fft.hpp"
Go to the source code of this file.
Classes | |
struct | testData |
Typedefs | |
typedef float | ScalarType |
typedef ScalarType(* | test_function_ptr) (std::vector< ScalarType > &, std::vector< ScalarType > &, unsigned int, unsigned int, unsigned int) |
typedef void(* | input_function_ptr) (std::vector< ScalarType > &, std::vector< ScalarType > &, unsigned int &, unsigned int &, unsigned int &, const std::string &) |
Functions | |
void | set_values_struct (std::vector< ScalarType > &input, std::vector< ScalarType > &output, unsigned int &rows, unsigned int &cols, unsigned int &batch_size, testData &data) |
void | set_values_struct (std::vector< ScalarType > &input, std::vector< ScalarType > &input2, std::vector< ScalarType > &output, unsigned int &rows, unsigned int &cols, unsigned int &batch_size, testData &data) |
void | read_vectors_pair (std::vector< ScalarType > &input, std::vector< ScalarType > &output, unsigned int &rows, unsigned int &cols, unsigned int &batch_size, const std::string &log_tag) |
void | read_vectors_three (std::vector< ScalarType > &input, std::vector< ScalarType > &input2, std::vector< ScalarType > &output, unsigned int &rows, unsigned int &cols, unsigned int &batch_size, const std::string &log_tag) |
template<typename ScalarType > | |
ScalarType | diff (std::vector< ScalarType > &vec, std::vector< ScalarType > &ref) |
template<typename ScalarType > | |
ScalarType | diff_max (std::vector< ScalarType > &vec, std::vector< ScalarType > &ref) |
template<class SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy_to_vector (std::complex< SCALARTYPE > *input_complex, viennacl::vector< SCALARTYPE, ALIGNMENT > &in, unsigned int size) |
template<class SCALARTYPE > | |
void | copy_to_vector (std::complex< SCALARTYPE > *input_complex, SCALARTYPE *in, unsigned int size) |
template<class SCALARTYPE > | |
void | copy_to_complex_array (std::complex< SCALARTYPE > *input_complex, const SCALARTYPE *in, int size) |
void | convolve_ref (std::vector< ScalarType > &in1, std::vector< ScalarType > &in2, std::vector< ScalarType > &out) |
ScalarType | fft (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int batch_size) |
ScalarType | direct (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int batch_num) |
ScalarType | bluestein (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int batch_size) |
ScalarType | radix2 (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int batch_num) |
ScalarType | fft_ifft_radix2 (std::vector< ScalarType > &in, std::vector< ScalarType > &, unsigned int, unsigned int, unsigned int batch_num) |
ScalarType | ifft_fft_radix2 (std::vector< ScalarType > &in, std::vector< ScalarType > &, unsigned int, unsigned int, unsigned int batch_num) |
ScalarType | fft_reverse_direct (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int) |
ScalarType | real_to_complex (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int) |
ScalarType | complex_to_real (std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int) |
ScalarType | multiply_complex (std::vector< ScalarType > &in, std::vector< ScalarType > &in2, std::vector< ScalarType > &out) |
ScalarType | convolve (std::vector< ScalarType > &in1, std::vector< ScalarType > &in2, unsigned int, unsigned int, unsigned int) |
int | test_correctness (const std::string &log_tag, input_function_ptr input_function, test_function_ptr func) |
int | testcorrectnes_multiply (const std::string &log_tag) |
int | main () |
Variables | |
const ScalarType | EPS = ScalarType(0.06f) |
Tests the one-dimensional FFT routines.
Definition in file fft_1d.cpp.
typedef void(* input_function_ptr) (std::vector< ScalarType > &, std::vector< ScalarType > &, unsigned int &, unsigned int &, unsigned int &, const std::string &) |
Definition at line 48 of file fft_1d.cpp.
typedef float ScalarType |
Definition at line 42 of file fft_1d.cpp.
typedef ScalarType(* test_function_ptr) (std::vector< ScalarType > &, std::vector< ScalarType > &, unsigned int, unsigned int, unsigned int) |
Definition at line 46 of file fft_1d.cpp.
ScalarType bluestein | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_size | ||
) |
Definition at line 762 of file fft_1d.cpp.
ScalarType complex_to_real | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned | int | ||
) |
Definition at line 896 of file fft_1d.cpp.
ScalarType convolve | ( | std::vector< ScalarType > & | in1, |
std::vector< ScalarType > & | in2, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned | int | ||
) |
Definition at line 944 of file fft_1d.cpp.
void convolve_ref | ( | std::vector< ScalarType > & | in1, |
std::vector< ScalarType > & | in2, | ||
std::vector< ScalarType > & | out | ||
) |
Definition at line 693 of file fft_1d.cpp.
void copy_to_complex_array | ( | std::complex< SCALARTYPE > * | input_complex, |
const SCALARTYPE * | in, | ||
int | size | ||
) |
Definition at line 680 of file fft_1d.cpp.
void copy_to_vector | ( | std::complex< SCALARTYPE > * | input_complex, |
viennacl::vector< SCALARTYPE, ALIGNMENT > & | in, | ||
unsigned int | size | ||
) |
Definition at line 658 of file fft_1d.cpp.
void copy_to_vector | ( | std::complex< SCALARTYPE > * | input_complex, |
SCALARTYPE * | in, | ||
unsigned int | size | ||
) |
Definition at line 668 of file fft_1d.cpp.
ScalarType diff | ( | std::vector< ScalarType > & | vec, |
std::vector< ScalarType > & | ref | ||
) |
Definition at line 621 of file fft_1d.cpp.
ScalarType diff_max | ( | std::vector< ScalarType > & | vec, |
std::vector< ScalarType > & | ref | ||
) |
Definition at line 636 of file fft_1d.cpp.
ScalarType direct | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_num | ||
) |
Definition at line 740 of file fft_1d.cpp.
ScalarType fft | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_size | ||
) |
Definition at line 719 of file fft_1d.cpp.
ScalarType fft_ifft_radix2 | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | , | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_num | ||
) |
Definition at line 805 of file fft_1d.cpp.
ScalarType fft_reverse_direct | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned | int | ||
) |
Definition at line 851 of file fft_1d.cpp.
ScalarType ifft_fft_radix2 | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | , | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_num | ||
) |
Definition at line 828 of file fft_1d.cpp.
int main | ( | ) |
Definition at line 1018 of file fft_1d.cpp.
ScalarType multiply_complex | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | in2, | ||
std::vector< ScalarType > & | out | ||
) |
Definition at line 918 of file fft_1d.cpp.
ScalarType radix2 | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned int | batch_num | ||
) |
Definition at line 783 of file fft_1d.cpp.
void read_vectors_pair | ( | std::vector< ScalarType > & | input, |
std::vector< ScalarType > & | output, | ||
unsigned int & | rows, | ||
unsigned int & | cols, | ||
unsigned int & | batch_size, | ||
const std::string & | log_tag | ||
) |
Definition at line 584 of file fft_1d.cpp.
void read_vectors_three | ( | std::vector< ScalarType > & | input, |
std::vector< ScalarType > & | input2, | ||
std::vector< ScalarType > & | output, | ||
unsigned int & | rows, | ||
unsigned int & | cols, | ||
unsigned int & | batch_size, | ||
const std::string & | log_tag | ||
) |
Definition at line 611 of file fft_1d.cpp.
ScalarType real_to_complex | ( | std::vector< ScalarType > & | in, |
std::vector< ScalarType > & | out, | ||
unsigned | int, | ||
unsigned | int, | ||
unsigned | int | ||
) |
Definition at line 873 of file fft_1d.cpp.
void set_values_struct | ( | std::vector< ScalarType > & | input, |
std::vector< ScalarType > & | output, | ||
unsigned int & | rows, | ||
unsigned int & | cols, | ||
unsigned int & | batch_size, | ||
testData & | data | ||
) |
Definition at line 540 of file fft_1d.cpp.
void set_values_struct | ( | std::vector< ScalarType > & | input, |
std::vector< ScalarType > & | input2, | ||
std::vector< ScalarType > & | output, | ||
unsigned int & | rows, | ||
unsigned int & | cols, | ||
unsigned int & | batch_size, | ||
testData & | data | ||
) |
Definition at line 561 of file fft_1d.cpp.
int test_correctness | ( | const std::string & | log_tag, |
input_function_ptr | input_function, | ||
test_function_ptr | func | ||
) |
Definition at line 970 of file fft_1d.cpp.
int testcorrectnes_multiply | ( | const std::string & | log_tag | ) |
Definition at line 997 of file fft_1d.cpp.
const ScalarType EPS = ScalarType(0.06f) |
Definition at line 44 of file fft_1d.cpp.