#fftw #fft #fully #homomorphic #fhe

concrete-fftw

Safe wrapper around FFTW

5 releases

Uses new Rust 2021

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

#71 in Math

Download history 346/week @ 2022-06-13 453/week @ 2022-06-20 408/week @ 2022-06-27 769/week @ 2022-07-04 195/week @ 2022-07-11 521/week @ 2022-07-18 106/week @ 2022-07-25 271/week @ 2022-08-01 416/week @ 2022-08-08 372/week @ 2022-08-15 537/week @ 2022-08-22 529/week @ 2022-08-29 605/week @ 2022-09-05 645/week @ 2022-09-12 659/week @ 2022-09-19 215/week @ 2022-09-26

2,124 downloads per month
Used in 6 crates (2 directly)

Custom license and GPL-2.0-or-later

9.5MB
277K SLoC

C 257K SLoC // 0.1% comments Shell 8K SLoC // 0.2% comments OCaml 5.5K SLoC // 0.2% comments Rust 2K SLoC // 0.0% comments Perl 1.5K 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