#fft #fftw #homomorphic #fhe #fully

concrete-fftw

Safe wrapper around FFTW

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

Download history 3/week @ 2024-07-20 13/week @ 2024-07-27 9/week @ 2024-08-03 12/week @ 2024-08-10 1/week @ 2024-08-17 16/week @ 2024-08-24 10/week @ 2024-08-31 8/week @ 2024-09-07 11/week @ 2024-09-14 19/week @ 2024-09-21 10/week @ 2024-09-28 10/week @ 2024-10-05 35/week @ 2024-10-12 1/week @ 2024-10-19 17/week @ 2024-11-02

54 downloads per month
Used in concrete-core-experimenta…

Custom license and GPL-2.0-or-later

10MB
285K SLoC

C 257K SLoC // 0.1% comments Shell 8K SLoC // 0.2% comments M4 8K SLoC // 0.2% comments OCaml 5.5K SLoC // 0.2% comments Rust 2K SLoC // 0.0% comments Perl 2K SLoC // 0.1% comments FORTRAN Modern 1K SLoC Automake 1K SLoC // 0.1% comments FORTRAN Legacy 109 SLoC // 0.2% comments

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();

Dependencies