Skip to content

Instantly share code, notes, and snippets.

@kulicuu
Created February 1, 2022 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kulicuu/e9a3063c443ca12894eabff2801a0314 to your computer and use it in GitHub Desktop.
Save kulicuu/e9a3063c443ca12894eabff2801a0314 to your computer and use it in GitHub Desktop.
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