Created
February 1, 2022 17:12
-
-
Save kulicuu/e9a3063c443ca12894eabff2801a0314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use num_complex::Complex64; | |
use std::f64::consts::*; | |
pub fn ft_slow ( | |
a: &Vec<Complex64>, | |
n: usize, | |
is: i8, | |
) -> Vec<Complex64> | |
{ | |
let mut c: Vec<Complex64> = vec!(); | |
for k in 0..(n-1) { | |
let mut s = Complex64::new(0.0, 0.0); | |
for x in 0..(n-1) { | |
s = s + ( | |
a[x] | |
* ( | |
Complex64::new(0.0, is as f64) | |
* 2.0 | |
* Complex64::new(0.0, 1.0) | |
* PI | |
* x as f64 | |
* k as f64 | |
/ n as f64 | |
).exp() | |
); | |
c.insert(k, s); | |
} | |
} | |
c | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment