mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
fix : fixing warnings
This commit is contained in:
parent
4eefaf44ca
commit
9b2efd2f37
@ -51,9 +51,9 @@ std::complex<double>* FastFourierTransform(std::complex<double>*p,uint8_t n)
|
|||||||
|
|
||||||
std::complex<double> om=std::complex<double>(cos(2*pi/n),sin(2*pi/n)); ///Calculating value of omega
|
std::complex<double> om=std::complex<double>(cos(2*pi/n),sin(2*pi/n)); ///Calculating value of omega
|
||||||
|
|
||||||
auto *pe= new std::complex<double>[n/2]; /// Coefficients of even power
|
std::complex<double> *pe= new std::complex<double>[n/2]; /// Coefficients of even power
|
||||||
|
|
||||||
auto *po= new std::complex<double>[n/2]; ///Coefficients of odd power
|
std::complex<double> *po= new std::complex<double>[n/2]; ///Coefficients of odd power
|
||||||
|
|
||||||
int k1=0,k2=0;
|
int k1=0,k2=0;
|
||||||
for(int j=0;j<n;j++)
|
for(int j=0;j<n;j++)
|
||||||
@ -67,11 +67,11 @@ std::complex<double>* FastFourierTransform(std::complex<double>*p,uint8_t n)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *ye=FastFourierTransform(pe,n/2); ///Recursive Call
|
std::complex<double> *ye=FastFourierTransform(pe,n/2); ///Recursive Call
|
||||||
|
|
||||||
auto *yo=FastFourierTransform(po,n/2); ///Recursive Call
|
std::complex<double> *yo=FastFourierTransform(po,n/2); ///Recursive Call
|
||||||
|
|
||||||
auto *y=new std::complex<double>[n]; /// Final value representation list
|
std::complex<double> *y=new std::complex<double>[n]; /// Final value representation list
|
||||||
|
|
||||||
k1=0,k2=0;
|
k1=0,k2=0;
|
||||||
|
|
||||||
@ -103,8 +103,8 @@ std::complex<double>* FastFourierTransform(std::complex<double>*p,uint8_t n)
|
|||||||
static void test() {
|
static void test() {
|
||||||
/* descriptions of the following test */
|
/* descriptions of the following test */
|
||||||
|
|
||||||
auto *t1= new std::complex<double>[2]; /// Test case 1
|
std::complex<double> *t1= new std::complex<double>[2]; /// Test case 1
|
||||||
auto *t2= new std::complex<double>[4];; /// Test case 2
|
std::complex<double> *t2= new std::complex<double>[4];; /// Test case 2
|
||||||
|
|
||||||
t1[0]={1,0};
|
t1[0]={1,0};
|
||||||
t1[1]={2,0};
|
t1[1]={2,0};
|
||||||
@ -121,8 +121,8 @@ std::complex<double>* FastFourierTransform(std::complex<double>*p,uint8_t n)
|
|||||||
std::vector<std::complex<double>> r2 = {
|
std::vector<std::complex<double>> r2 = {
|
||||||
{10, 0}, {-2, -2}, {-2, 0}, {-2, 2}}; /// True Answer for test case 2
|
{10, 0}, {-2, -2}, {-2, 0}, {-2, 2}}; /// True Answer for test case 2
|
||||||
|
|
||||||
auto *o1 = numerical_methods::FastFourierTransform(t1, n1);
|
std::complex<double> *o1 = numerical_methods::FastFourierTransform(t1, n1);
|
||||||
auto *o2 = numerical_methods::FastFourierTransform(t2, n2);
|
std::complex<double> *o2 = numerical_methods::FastFourierTransform(t2, n2);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < n1; i++) {
|
for (uint8_t i = 0; i < n1; i++) {
|
||||||
assert((r1[i].real() - o1->real() < 0.000000000001) &&
|
assert((r1[i].real() - o1->real() < 0.000000000001) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user