From 9c79da7fb84cf7e0b1c7b0b68b060b52d2815bb8 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 23 Jan 2024 11:59:17 +0000 Subject: [PATCH] simplify --- bem/src/assembly/batched.rs | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/bem/src/assembly/batched.rs b/bem/src/assembly/batched.rs index 26304eb2..d4c60e21 100644 --- a/bem/src/assembly/batched.rs +++ b/bem/src/assembly/batched.rs @@ -552,33 +552,13 @@ pub fn assemble_singular_into_csr<'a, const QDEGREE: usize, const BLOCKSIZE: usi test_colouring, ); - let mut rows = vec![]; - let mut cols = vec![]; - let mut data = vec![]; - - for ((i, j), value) in sparse_matrix - .rows - .iter() - .zip(&sparse_matrix.cols) - .zip(&sparse_matrix.data) - { - let mut found = false; - for ((i2, j2), value2) in rows.iter().zip(&cols).zip(data.iter_mut()) { - if *i == *i2 && *j == *j2 { - *value2 += *value; - found = true; - break; - } - } - - if !found { - rows.push(*i); - cols.push(*j); - data.push(*value); - } - } - - CsrMatrix::::from_aij(shape, &rows, &cols, &data).unwrap() + CsrMatrix::::from_aij( + sparse_matrix.shape, + &sparse_matrix.rows, + &sparse_matrix.cols, + &sparse_matrix.data, + ) + .unwrap() } #[allow(clippy::too_many_arguments)]