Skip to content

Commit 0008000

Browse files
committed
fix pre-commit error
1 parent 12e70de commit 0008000

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

qdp/qdp-kernels/tests/amplitude_encode.rs

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use cudarc::driver::{CudaDevice, DevicePtr, DevicePtrMut};
2626
#[cfg(target_os = "linux")]
2727
use qdp_kernels::{
2828
CuComplex, CuDoubleComplex, launch_amplitude_encode, launch_amplitude_encode_batch,
29-
launch_amplitude_encode_batch_f32, launch_amplitude_encode_f32, launch_l2_norm,
30-
launch_l2_norm_batch, launch_l2_norm_batch_f32, launch_l2_norm_f32,
29+
launch_amplitude_encode_f32, launch_l2_norm, launch_l2_norm_batch, launch_l2_norm_batch_f32,
30+
launch_l2_norm_f32,
3131
};
3232

3333
const EPSILON: f64 = 1e-10;
@@ -69,42 +69,6 @@ fn assert_batch_state_matches_f64(
6969
}
7070
}
7171

72-
#[cfg(target_os = "linux")]
73-
fn assert_batch_state_matches_f32(
74-
state_h: &[CuComplex],
75-
input: &[f32],
76-
num_samples: usize,
77-
sample_len: usize,
78-
state_len: usize,
79-
) {
80-
for sample_idx in 0..num_samples {
81-
let sample = &input[sample_idx * sample_len..(sample_idx + 1) * sample_len];
82-
let norm = sample.iter().map(|v| v * v).sum::<f32>().sqrt();
83-
for elem_idx in 0..state_len {
84-
let expected = if elem_idx < sample_len {
85-
sample[elem_idx] / norm
86-
} else {
87-
0.0
88-
};
89-
let actual = state_h[sample_idx * state_len + elem_idx];
90-
assert!(
91-
(actual.x - expected).abs() < EPSILON_F32,
92-
"sample {} element {} expected {}, got {}",
93-
sample_idx,
94-
elem_idx,
95-
expected,
96-
actual.x
97-
);
98-
assert!(
99-
actual.y.abs() < EPSILON_F32,
100-
"sample {} element {} imaginary should be 0",
101-
sample_idx,
102-
elem_idx
103-
);
104-
}
105-
}
106-
}
107-
10872
#[test]
10973
#[cfg(target_os = "linux")]
11074
fn test_amplitude_encode_basic() {
@@ -693,8 +657,6 @@ fn test_amplitude_encode_batch_odd_sample_length_handles_misaligned_samples() {
693657
assert_batch_state_matches_f64(&state_h, &input, num_samples, sample_len, state_len);
694658
}
695659

696-
697-
698660
#[test]
699661
#[cfg(target_os = "linux")]
700662
fn test_l2_norm_single_kernel() {

0 commit comments

Comments
 (0)