|
| 1 | +use arrayfire::*; |
| 2 | +use num::Complex; |
| 3 | + |
| 4 | +type Complex32 = Complex<f32>; |
| 5 | + |
| 6 | +#[allow(unused_must_use)] |
| 7 | +#[allow(unused_variables)] |
| 8 | +fn main() { |
| 9 | + set_device(0); |
| 10 | + info(); |
| 11 | + let samples = 10; |
| 12 | + let dims = Dim4::new(&[samples, 1, 1, 1]); |
| 13 | + |
| 14 | + let values = vec![ |
| 15 | + Complex::new(0.0, 2.0), |
| 16 | + Complex::new(0.0, 2.0), |
| 17 | + Complex::new(0.0, 2.0), |
| 18 | + Complex::new(0.0, 2.0), |
| 19 | + Complex::new(0.0, 2.0), |
| 20 | + Complex::new(0.0, 2.0), |
| 21 | + Complex::new(0.0, 2.0), |
| 22 | + Complex::new(0.0, 2.0), |
| 23 | + Complex::new(0.0, 2.0), |
| 24 | + Complex::new(0.0, 2.0) |
| 25 | + ]; |
| 26 | + |
| 27 | + let signal = Array::new(&values, dims); |
| 28 | + |
| 29 | + af_print!("signal", signal); |
| 30 | + |
| 31 | + // Used length of input signal as norm_factor |
| 32 | + let output = fft(&signal, 0.1, samples as i64); |
| 33 | + |
| 34 | + af_print!("Output", output); |
| 35 | +} |
0 commit comments