miniprojet/tests/examples/main.cpp

41 lines
866 B
C++

#include <iostream>
#include <complex>
#include <vector>
#include <math.hpp>
#include <cmath>
using namespace std;
using namespace math;
int main (int ac,char ** av) {
csignal coord = {0,1,0,0,0,0,0};
coord = {0,1,0,0,0};
csignal res;
res = dft(coord);
for(int n=0; n<coord.size(); n++) {
cout << coord[n] << endl;
}
cout << endl;
for(int n=0; n<res.size(); n++) {
cout << res[n] << endl;
}
cout << endl;
for(int n=0; n<res.size(); n++) {
cout << abs(res[n]) << endl;
}
cout << endl;
double my_sum = 0;
double sum = 0;
for(int n=0; n<res.size(); n++) {
my_sum += arg(res[n]);
sum += arg(exp(math::complex(0, 2*pi()*n/coord.size())));
cout << arg(res[n]) << ' ' << arg(exp(math::complex(0, 2*pi()*n/coord.size()))) << endl;
}
std::cout << my_sum << ' ' << sum << std::endl;
}