Skip to content

Commit 5a2b0c3

Browse files
committed
Rename c2r_ifft_* to c2r_fft_*
c2r already implies inverse FFT
1 parent 7f59ccf commit 5a2b0c3

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ For purely real-valued input signals, the R2C transform is approximately
7878
2x faster than running a full complex FFT with zeroed imaginary components:
7979

8080
```rust
81-
use phastft::{r2c_fft_f64, c2r_ifft_f64};
81+
use phastft::{r2c_fft_f64, c2r_fft_f64};
8282

8383
let n = 1 << 16;
8484
let signal: Vec<f64> = (0..n).map(|i| (i as f64).sin()).collect();
@@ -89,7 +89,7 @@ r2c_fft_f64(&signal, &mut spec_re, &mut spec_im);
8989

9090
// Recover original signal
9191
let mut recovered = vec![0.0; n];
92-
c2r_ifft_f64(&spec_re, &spec_im, &mut recovered);
92+
c2r_fft_f64(&spec_re, &spec_im, &mut recovered);
9393
```
9494

9595
For repeated FFTs of the same size, use a planner to avoid

‎src/algorithms/r2c.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,18 @@ pub fn r2c_fft_f32_with_planner(
202202
/// # Panics
203203
///
204204
/// Panics if lengths don't match or N is not a power of 2 ≥ 4.
205-
pub fn c2r_ifft_f64(input_re: &[f64], input_im: &[f64], output: &mut [f64]) {
205+
pub fn c2r_fft_f64(input_re: &[f64], input_im: &[f64], output: &mut [f64]) {
206206
let n = input_re.len();
207207
let planner = PlannerR2c64::new(n);
208-
c2r_ifft_f64_with_planner(input_re, input_im, output, &planner);
208+
c2r_fft_f64_with_planner(input_re, input_im, output, &planner);
209209
}
210210

211211
/// Performs the inverse real-valued FFT of f64 data using a pre-computed planner.
212212
///
213213
/// # Panics
214214
///
215215
/// Panics if input length doesn't match the planner size.
216-
pub fn c2r_ifft_f64_with_planner(
216+
pub fn c2r_fft_f64_with_planner(
217217
input_re: &[f64],
218218
input_im: &[f64],
219219
output: &mut [f64],
@@ -335,7 +335,7 @@ mod tests {
335335
r2c_fft_f64(&original, &mut spec_re, &mut spec_im);
336336

337337
let mut recovered = vec![0.0; n];
338-
c2r_ifft_f64(&spec_re, &spec_im, &mut recovered);
338+
c2r_fft_f64(&spec_re, &spec_im, &mut recovered);
339339

340340
for k in 0..n {
341341
assert_float_closeness(recovered[k], original[k], 1e-6);
@@ -373,11 +373,11 @@ mod tests {
373373
r2c_fft_f64(&input, &mut spec_re, &mut spec_im);
374374

375375
let mut recovered_1 = vec![0.0; n];
376-
c2r_ifft_f64(&spec_re, &spec_im, &mut recovered_1);
376+
c2r_fft_f64(&spec_re, &spec_im, &mut recovered_1);
377377

378378
let planner = PlannerR2c64::new(n);
379379
let mut recovered_2 = vec![0.0; n];
380-
c2r_ifft_f64_with_planner(&spec_re, &spec_im, &mut recovered_2, &planner);
380+
c2r_fft_f64_with_planner(&spec_re, &spec_im, &mut recovered_2, &planner);
381381

382382
for k in 0..n {
383383
assert_float_closeness(recovered_1[k], recovered_2[k], 1e-12);
@@ -398,7 +398,7 @@ mod tests {
398398
r2c_fft_f64(&original_re, &mut spec_re, &mut spec_im);
399399

400400
let mut recovered = vec![0.0; n];
401-
c2r_ifft_f64(&spec_re, &spec_im, &mut recovered);
401+
c2r_fft_f64(&spec_re, &spec_im, &mut recovered);
402402

403403
for k in 0..n {
404404
assert_float_closeness(recovered[k], original_re[k], 1e-6);

‎src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub mod planner;
3232

3333
pub use algorithms::dit::{fft_32_dit_with_planner_and_opts, fft_64_dit_with_planner_and_opts};
3434
pub use algorithms::r2c::{
35-
c2r_ifft_f64, c2r_ifft_f64_with_planner, r2c_fft_f32, r2c_fft_f32_with_planner, r2c_fft_f64,
35+
c2r_fft_f64, c2r_fft_f64_with_planner, r2c_fft_f32, r2c_fft_f32_with_planner, r2c_fft_f64,
3636
r2c_fft_f64_with_planner,
3737
};
3838

0 commit comments

Comments
 (0)