Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump num-complex to 0.3, transpose to 0.2 #3

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ categories = ["algorithms", "compression", "multimedia::encoding", "science"]
license = "MIT OR Apache-2.0"

[dependencies]
num-complex = "0.2"
num-complex = "0.3"
num-integer = "0.1.43"
num-traits = "0.2"
num-integer = "0.1"
strength_reduce = "^0.2.1"
transpose = "0.1"
transpose = "0.2"

[dev-dependencies]
rand = "0.5"
2 changes: 1 addition & 1 deletion src/algorithm/dft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod unit_tests {
let mut sum = Zero::zero();
for (i, &x) in signal.iter().enumerate() {
let angle = -1f32 * (i * k) as f32 * 2f32 * f32::consts::PI / signal.len() as f32;
let twiddle = Complex::from_polar(&1f32, &angle);
let twiddle = Complex::from_polar(1f32, angle);

sum = sum + twiddle * x;
}
Expand Down
4 changes: 2 additions & 2 deletions src/twiddles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn single_twiddle<T: FFTnum>(i: usize, fft_len: usize, inverse: bool) -> Com
-2f64 * f64::consts::PI
};

let c = Complex::from_polar(&One::one(), &(constant * i as f64 / fft_len as f64));
let c = Complex::from_polar(One::one(), constant * i as f64 / fft_len as f64);

Complex {
re: FromPrimitive::from_f64(c.re).unwrap(),
Expand Down Expand Up @@ -51,7 +51,7 @@ mod unit_tests {

for len in 1..10 {
let actual: Vec<Complex<f32>> = generate_twiddle_factors(len, false);
let expected: Vec<Complex<f32>> = (0..len).map(|i| Complex::from_polar(&1f32, &(constant * i as f32 / len as f32))).collect();
let expected: Vec<Complex<f32>> = (0..len).map(|i| Complex::from_polar(1f32, constant * i as f32 / len as f32)).collect();

assert!(compare_vectors(&actual, &expected), "len = {}", len)
}
Expand Down