Skip to content

Commit ed4ebca

Browse files
committed
Add a public function that accepts caller-provided Options
1 parent 34f1968 commit ed4ebca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ mod twiddles;
2121
///
2222
/// [1] https://inst.eecs.berkeley.edu/~ee123/sp15/Notes/Lecture08_FFT_and_SpectAnalysis.key.pdf
2323
pub fn fft_dif(reals: &mut [Float], imags: &mut [Float]) {
24+
let opts = Options::guess_options(reals.len());
25+
fft_dif_with_opts(reals, imags, &opts)
26+
}
27+
28+
/// Same as [fft_dif], but also accepts [`Options`] that control optimization strategies.
29+
///
30+
/// `fft_dif` automatically guesses the best strategy for a given input,
31+
/// so you only need to call this if you are tuning performance for a specific hardware platform.
32+
pub fn fft_dif_with_opts(reals: &mut [Float], imags: &mut [Float], opts: &Options) {
2433
assert_eq!(reals.len(), imags.len());
2534
let n: usize = reals.len().ilog2() as usize;
26-
let opts = Options::guess_options(reals.len());
2735

2836
let dist = 1 << (n - 1);
2937
let chunk_size = dist << 1;

0 commit comments

Comments
 (0)