-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfourierTransformation.cpp
More file actions
69 lines (60 loc) · 1.64 KB
/
Copy pathfourierTransformation.cpp
File metadata and controls
69 lines (60 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "fourierTransformation.hpp"
fourierTransformation::fourierTransformation(long long int k,signal *x)
{
setK(k);
setSeq(x->getSequence(0, getK()));
}
std::vector<std::complex<double>> fourierTransformation::getFourierSampling(long long int N)
{
std::vector<std::complex<double>> out;
for(long long int n=0; n < N ; n++)
{ out.push_back(std::complex<double> (0,0));
for(long long int i=0; i< getK(); i++)
{
std::complex<double> wn(0,2*M_PI*((double)n/N)*i);
out[n]+=seq[i]*exp(wn);
}
}
return out;
}
fourierTransformation::fourierTransformation(const fourierTransformation &toCopy) noexcept : k{toCopy.getK()}, seq{toCopy.getSeq()}
{
}
fourierTransformation& fourierTransformation::operator=(const fourierTransformation &toCopy) noexcept
{
setK(toCopy.getK());
setSeq(toCopy.getSeq());
return *this;
}
fourierTransformation::fourierTransformation(fourierTransformation &&toMove) noexcept : k{std::move(toMove.getK())}, seq{std::move(toMove.getSeq())}
{
}
fourierTransformation& fourierTransformation::operator=(fourierTransformation &&toMove) noexcept
{
setK(std::move(toMove.getK()));
setSeq(std::move(toMove.getSeq()));
return *this;
}
fourierTransformation::~fourierTransformation()
{
}
std::complex<double> fourierTransformation::get(long long int n)
{
return n>=0 && n < getK()? seq.at(n): 0;
}
long long int fourierTransformation::getK() const
{
return k;
}
void fourierTransformation::setK(long long int k)
{
this->k = k;
}
const std::vector<std::complex<double> >& fourierTransformation::getSeq() const
{
return seq;
}
void fourierTransformation::setSeq(const std::vector<std::complex<double> > &seq)
{
this->seq = seq;
}