5 releases
0.1.4 | Sep 22, 2022 |
---|---|
0.1.3 | Jul 13, 2022 |
0.1.2 | Aug 9, 2021 |
0.1.1 | Jul 26, 2021 |
0.1.0 | Jul 5, 2021 |
#1471 in Math
54 downloads per month
Used in concrete-core-experimenta…
10MB
285K
SLoC
Concrete FFTW
This library contains a safe wrapper of the FFTW library.
To compile with fftw, you need to have libclang installed on your computer.
Fork
This crate is a fork of the rust-math/fftw wrapper of the FFTW library.
lib.rs
:
Rust binding of FFTW
Examples
Complex-to-Complex
use concrete_fftw::array::AlignedVec;
use concrete_fftw::plan::*;
use concrete_fftw::types::*;
use std::f64::consts::PI;
let n = 128;
let mut plan: C2CPlan64 = C2CPlan::aligned(&[n], Sign::Forward, Flag::MEASURE).unwrap();
let mut a = AlignedVec::new(n);
let mut b = AlignedVec::new(n);
let k0 = 2.0 * PI / n as f64;
for i in 0..n {
a[i] = c64::new((k0 * i as f64).cos(), 0.0);
}
plan.c2c(&mut a, &mut b).unwrap();
Complex-to-Real
use concrete_fftw::array::AlignedVec;
use concrete_fftw::plan::*;
use concrete_fftw::types::*;
use std::f64::consts::PI;
let n = 128;
let mut c2r: C2RPlan64 = C2RPlan::aligned(&[n], Flag::MEASURE).unwrap();
let mut a = AlignedVec::new(n / 2 + 1);
let mut b = AlignedVec::new(n);
for i in 0..(n / 2 + 1) {
a[i] = c64::new(1.0, 0.0);
}
c2r.c2r(&mut a, &mut b).unwrap();