From f795f0f8721ec28e692c78f9850597e7f44fe504 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 21 Mar 2022 16:56:22 -0600 Subject: [PATCH] tests don't need to test the unchecked kernel separately --- nalgebra-sparse/src/ops/mod.rs | 4 ++-- nalgebra-sparse/tests/unit_tests/ops.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/nalgebra-sparse/src/ops/mod.rs b/nalgebra-sparse/src/ops/mod.rs index 9a73148c..6fedfb6c 100644 --- a/nalgebra-sparse/src/ops/mod.rs +++ b/nalgebra-sparse/src/ops/mod.rs @@ -113,10 +113,10 @@ //! # use nalgebra_sparse::csr::CsrMatrix; //! # let a = CsrMatrix::identity(10); let b = CsrMatrix::identity(10); //! # let mut c = CsrMatrix::identity(10); -//! use nalgebra_sparse::ops::{Op, serial::spmm_csr_prealloc}; +//! use nalgebra_sparse::ops::{Op, serial::spmm_csr_prealloc_checked}; //! //! // Evaluate the expression `c <- 3.0 * c + 2.0 * a^T * b -//! spmm_csr_prealloc(3.0, &mut c, 2.0, Op::Transpose(&a), Op::NoOp(&b)) +//! spmm_csr_prealloc_checked(3.0, &mut c, 2.0, Op::Transpose(&a), Op::NoOp(&b)) //! .expect("We assume that the pattern of C is able to accommodate the result."); //! ``` //! Compared to the simpler example, this snippet is harder to read, but it calls a single diff --git a/nalgebra-sparse/tests/unit_tests/ops.rs b/nalgebra-sparse/tests/unit_tests/ops.rs index f2a02fd8..20274d97 100644 --- a/nalgebra-sparse/tests/unit_tests/ops.rs +++ b/nalgebra-sparse/tests/unit_tests/ops.rs @@ -5,8 +5,9 @@ use crate::common::{ use nalgebra_sparse::csc::CscMatrix; use nalgebra_sparse::csr::CsrMatrix; use nalgebra_sparse::ops::serial::{ - spadd_csc_prealloc, spadd_csr_prealloc, spadd_pattern, spmm_csc_dense, spmm_csc_prealloc, - spmm_csr_dense, spmm_csr_pattern, spmm_csr_prealloc, spsolve_csc_lower_triangular, + spadd_csc_prealloc, spadd_csr_prealloc, spadd_pattern, spmm_csc_dense, + spmm_csc_prealloc_checked, spmm_csr_dense, spmm_csr_pattern, spmm_csr_prealloc_checked, + spsolve_csc_lower_triangular, }; use nalgebra_sparse::ops::Op; use nalgebra_sparse::pattern::SparsityPattern; @@ -550,7 +551,7 @@ proptest! { // Test that we get the expected result by comparing to an equivalent dense operation // (here we give in the C matrix, so the sparsity pattern is essentially fixed) let mut c_sparse = c.clone(); - spmm_csr_prealloc(beta, &mut c_sparse, alpha, a.as_ref(), b.as_ref()).unwrap(); + spmm_csr_prealloc_checked(beta, &mut c_sparse, alpha, a.as_ref(), b.as_ref()).unwrap(); let mut c_dense = DMatrix::from(&c); let op_a_dense = match a { @@ -605,7 +606,7 @@ proptest! { let result = catch_unwind(|| { let mut spmm_result = c.clone(); - spmm_csr_prealloc(beta, &mut spmm_result, alpha, a.as_ref(), b.as_ref()).unwrap(); + spmm_csr_prealloc_checked(beta, &mut spmm_result, alpha, a.as_ref(), b.as_ref()).unwrap(); }); prop_assert!(result.is_err(), @@ -689,7 +690,7 @@ proptest! { // Test that we get the expected result by comparing to an equivalent dense operation // (here we give in the C matrix, so the sparsity pattern is essentially fixed) let mut c_sparse = c.clone(); - spmm_csc_prealloc(beta, &mut c_sparse, alpha, a.as_ref(), b.as_ref()).unwrap(); + spmm_csc_prealloc_checked(beta, &mut c_sparse, alpha, a.as_ref(), b.as_ref()).unwrap(); let mut c_dense = DMatrix::from(&c); let op_a_dense = match a { @@ -744,7 +745,7 @@ proptest! { let result = catch_unwind(|| { let mut spmm_result = c.clone(); - spmm_csc_prealloc(beta, &mut spmm_result, alpha, a.as_ref(), b.as_ref()).unwrap(); + spmm_csc_prealloc_checked(beta, &mut spmm_result, alpha, a.as_ref(), b.as_ref()).unwrap(); }); prop_assert!(result.is_err(),