tests don't need to test the unchecked kernel separately
This commit is contained in:
parent
c6f832d1d8
commit
f795f0f872
|
@ -113,10 +113,10 @@
|
||||||
//! # use nalgebra_sparse::csr::CsrMatrix;
|
//! # use nalgebra_sparse::csr::CsrMatrix;
|
||||||
//! # let a = CsrMatrix::identity(10); let b = CsrMatrix::identity(10);
|
//! # let a = CsrMatrix::identity(10); let b = CsrMatrix::identity(10);
|
||||||
//! # let mut c = 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
|
//! // 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.");
|
//! .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
|
//! Compared to the simpler example, this snippet is harder to read, but it calls a single
|
||||||
|
|
|
@ -5,8 +5,9 @@ use crate::common::{
|
||||||
use nalgebra_sparse::csc::CscMatrix;
|
use nalgebra_sparse::csc::CscMatrix;
|
||||||
use nalgebra_sparse::csr::CsrMatrix;
|
use nalgebra_sparse::csr::CsrMatrix;
|
||||||
use nalgebra_sparse::ops::serial::{
|
use nalgebra_sparse::ops::serial::{
|
||||||
spadd_csc_prealloc, spadd_csr_prealloc, spadd_pattern, spmm_csc_dense, spmm_csc_prealloc,
|
spadd_csc_prealloc, spadd_csr_prealloc, spadd_pattern, spmm_csc_dense,
|
||||||
spmm_csr_dense, spmm_csr_pattern, spmm_csr_prealloc, spsolve_csc_lower_triangular,
|
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::ops::Op;
|
||||||
use nalgebra_sparse::pattern::SparsityPattern;
|
use nalgebra_sparse::pattern::SparsityPattern;
|
||||||
|
@ -550,7 +551,7 @@ proptest! {
|
||||||
// Test that we get the expected result by comparing to an equivalent dense operation
|
// 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)
|
// (here we give in the C matrix, so the sparsity pattern is essentially fixed)
|
||||||
let mut c_sparse = c.clone();
|
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 mut c_dense = DMatrix::from(&c);
|
||||||
let op_a_dense = match a {
|
let op_a_dense = match a {
|
||||||
|
@ -605,7 +606,7 @@ proptest! {
|
||||||
|
|
||||||
let result = catch_unwind(|| {
|
let result = catch_unwind(|| {
|
||||||
let mut spmm_result = c.clone();
|
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(),
|
prop_assert!(result.is_err(),
|
||||||
|
@ -689,7 +690,7 @@ proptest! {
|
||||||
// Test that we get the expected result by comparing to an equivalent dense operation
|
// 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)
|
// (here we give in the C matrix, so the sparsity pattern is essentially fixed)
|
||||||
let mut c_sparse = c.clone();
|
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 mut c_dense = DMatrix::from(&c);
|
||||||
let op_a_dense = match a {
|
let op_a_dense = match a {
|
||||||
|
@ -744,7 +745,7 @@ proptest! {
|
||||||
|
|
||||||
let result = catch_unwind(|| {
|
let result = catch_unwind(|| {
|
||||||
let mut spmm_result = c.clone();
|
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(),
|
prop_assert!(result.is_err(),
|
||||||
|
|
Loading…
Reference in New Issue