Skip to content

Commit b468db1

Browse files
Update split-operator method to use correct library versions and apply fixes from algorithm-archivists#688
1 parent d4e3652 commit b468db1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

contents/split-operator_method/code/rust/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ edition = "2018"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
num = "0.4.0"
10-
rustfft = "5.1.1"
9+
rustfft = "4.1.0"
1110

1211
[[bin]]
1312
path = "./split_op.rs"

contents/split-operator_method/code/rust/split_op.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
extern crate num;
21
extern crate rustfft;
32

4-
use num::complex::Complex;
3+
use rustfft::num_complex::Complex;
54
use rustfft::FFTplanner;
65
use std::f64::consts::PI;
76
use std::fs::File;
@@ -95,7 +94,7 @@ fn fft(x: &mut Vec<Complex<f64>>, inverse: bool) {
9594
let mut y = vec![Complex::new(0.0_f64, 0.0_f64); x.len()];
9695
let mut p = FFTplanner::new(inverse);
9796
let fft = p.plan_fft(x.len());
98-
fft.process(x, &mut y);
97+
fft.process(x.as_mut_slice(), y.as_mut_slice());
9998

10099
for i in 0..x.len() {
101100
x[i] = y[i] / (x.len() as f64).sqrt();

0 commit comments

Comments
 (0)