diff --git a/nalgebra-sparse/src/convert/serial.rs b/nalgebra-sparse/src/convert/serial.rs index 9fc3d04e..ecbe1dab 100644 --- a/nalgebra-sparse/src/convert/serial.rs +++ b/nalgebra-sparse/src/convert/serial.rs @@ -64,7 +64,7 @@ where // TODO: Avoid "try_from" since it validates the data? (requires unsafe, should benchmark // to see if it can be justified for performance reasons) CsrMatrix::try_from_csr_data(coo.nrows(), coo.ncols(), offsets, indices, values) - .expect("internal error: invalid CSR data during COO->CSR conversion") + .expect("Internal error: Invalid CSR data during COO->CSR conversion") } /// Converts a [`CsrMatrix`] to a [`CooMatrix`]. @@ -120,7 +120,7 @@ where // TODO: Consider circumventing the data validity check here // (would require unsafe, should benchmark) CsrMatrix::try_from_csr_data(dense.nrows(), dense.ncols(), row_offsets, col_idx, values) - .expect("internal error: invalid CsrMatrix format during dense -> CSR conversion") + .expect("Internal error: Invalid CsrMatrix format during dense-> CSR conversion") } /// Converts a [`CooMatrix`] to a [`CscMatrix`]. @@ -138,7 +138,7 @@ where // TODO: Avoid "try_from" since it validates the data? (requires unsafe, should benchmark // to see if it can be justified for performance reasons) CscMatrix::try_from_csc_data(coo.nrows(), coo.ncols(), offsets, indices, values) - .expect("internal error: invalid CSC data during COO -> CSC conversion") + .expect("Internal error: Invalid CSC data during COO->CSC conversion") } /// Converts a [`CscMatrix`] to a [`CooMatrix`]. @@ -194,7 +194,7 @@ where // TODO: Consider circumventing the data validity check here // (would require unsafe, should benchmark) CscMatrix::try_from_csc_data(dense.nrows(), dense.ncols(), col_offsets, row_idx, values) - .expect("internal error: invalid CscMatrix format during dense -> CSC conversion") + .expect("Internal error: Invalid CscMatrix format during dense-> CSC conversion") } /// Converts a [`CsrMatrix`] to a [`CscMatrix`]. @@ -212,7 +212,7 @@ where // TODO: Avoid data validity check? CscMatrix::try_from_csc_data(csr.nrows(), csr.ncols(), offsets, indices, values) - .expect("internal error: invalid CSC data during CSR -> CSC conversion") + .expect("Internal error: Invalid CSC data during CSR->CSC conversion") } /// Converts a [`CscMatrix`] to a [`CsrMatrix`]. @@ -230,7 +230,7 @@ where // TODO: Avoid data validity check? CsrMatrix::try_from_csr_data(csc.nrows(), csc.ncols(), offsets, indices, values) - .expect("internal error: invalid CSR data during CSC -> CSR conversion") + .expect("Internal error: Invalid CSR data during CSC->CSR conversion") } fn convert_coo_cs( diff --git a/nalgebra-sparse/src/factorization/cholesky.rs b/nalgebra-sparse/src/factorization/cholesky.rs index b306f104..1f653278 100644 --- a/nalgebra-sparse/src/factorization/cholesky.rs +++ b/nalgebra-sparse/src/factorization/cholesky.rs @@ -31,7 +31,7 @@ impl CscSymbolicCholesky { assert_eq!( pattern.major_dim(), pattern.minor_dim(), - "major and minor dimensions must be the same (square matrix)" + "Major and minor dimensions must be the same (square matrix)." ); let (l_pattern, u_pattern) = nonzero_pattern(&pattern); Self { @@ -82,7 +82,7 @@ pub enum CholeskyError { impl Display for CholeskyError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "matrix is not positive definite") + write!(f, "Matrix is not positive definite") } } @@ -279,7 +279,7 @@ impl CscCholesky { /// /// Panics if `b` is not square. pub fn solve_mut<'a>(&'a self, b: impl Into>) { - let expect_msg = "if the Cholesky factorization succeeded,\ + let expect_msg = "If the Cholesky factorization succeeded,\ then the triangular solve should never fail"; // Solve LY = B let mut y = b.into(); diff --git a/nalgebra-sparse/src/ops/serial/cs.rs b/nalgebra-sparse/src/ops/serial/cs.rs index 9cd46152..86484053 100644 --- a/nalgebra-sparse/src/ops/serial/cs.rs +++ b/nalgebra-sparse/src/ops/serial/cs.rs @@ -8,7 +8,7 @@ use num_traits::{One, Zero}; fn spmm_cs_unexpected_entry() -> OperationError { OperationError::from_kind_and_message( OperationErrorKind::InvalidPattern, - String::from("found unexpected entry that is not present in `c`"), + String::from("Found unexpected entry that is not present in `c`."), ) } @@ -62,7 +62,7 @@ where fn spadd_cs_unexpected_entry() -> OperationError { OperationError::from_kind_and_message( OperationErrorKind::InvalidPattern, - String::from("found entry in `op(a)` that is not present in `c`"), + String::from("Found entry in `op(a)` that is not present in `c`."), ) } diff --git a/nalgebra-sparse/src/ops/serial/csc.rs b/nalgebra-sparse/src/ops/serial/csc.rs index db7b81ba..e5c9ae4e 100644 --- a/nalgebra-sparse/src/ops/serial/csc.rs +++ b/nalgebra-sparse/src/ops/serial/csc.rs @@ -132,12 +132,12 @@ pub fn spsolve_csc_lower_triangular<'a, T: RealField>( assert_eq!( l_matrix.nrows(), l_matrix.ncols(), - "matrix must be square for triangular solve" + "Matrix must be square for triangular solve." ); assert_eq!( l_matrix.nrows(), b.nrows(), - "dimension mismatch in sparse lower triangular solver" + "Dimension mismatch in sparse lower triangular solver." ); match l { Op::NoOp(a) => spsolve_csc_lower_triangular_no_transpose(a, b), @@ -196,7 +196,7 @@ fn spsolve_csc_lower_triangular_no_transpose( } fn spsolve_encountered_zero_diagonal() -> Result<(), OperationError> { - let message = "matrix contains at least one diagonal entry that is zero"; + let message = "Matrix contains at least one diagonal entry that is zero."; Err(OperationError::from_kind_and_message( OperationErrorKind::Singular, String::from(message), diff --git a/nalgebra-sparse/src/ops/serial/mod.rs b/nalgebra-sparse/src/ops/serial/mod.rs index 3ce47a66..d8f1a343 100644 --- a/nalgebra-sparse/src/ops/serial/mod.rs +++ b/nalgebra-sparse/src/ops/serial/mod.rs @@ -108,16 +108,16 @@ impl OperationError { impl fmt::Display for OperationError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "sparse matrix operation error: ")?; + write!(f, "Sparse matrix operation error: ")?; match self.kind() { OperationErrorKind::InvalidPattern => { - write!(f, "invalid pattern")?; + write!(f, "InvalidPattern")?; } OperationErrorKind::Singular => { - write!(f, "singular")?; + write!(f, "Singular")?; } } - write!(f, " message: {}", self.message) + write!(f, " Message: {}", self.message) } } diff --git a/nalgebra-sparse/src/ops/serial/pattern.rs b/nalgebra-sparse/src/ops/serial/pattern.rs index 97137e46..b73f3375 100644 --- a/nalgebra-sparse/src/ops/serial/pattern.rs +++ b/nalgebra-sparse/src/ops/serial/pattern.rs @@ -16,12 +16,12 @@ pub fn spadd_pattern(a: &SparsityPattern, b: &SparsityPattern) -> SparsityPatter assert_eq!( a.major_dim(), b.major_dim(), - "patterns must have identical major dimensions" + "Patterns must have identical major dimensions." ); assert_eq!( a.minor_dim(), b.minor_dim(), - "patterns must have identical minor dimensions" + "Patterns must have identical minor dimensions." ); let mut offsets = Vec::new(); @@ -40,7 +40,7 @@ pub fn spadd_pattern(a: &SparsityPattern, b: &SparsityPattern) -> SparsityPatter // TODO: Consider circumventing format checks? (requires unsafe, should benchmark first) SparsityPattern::try_from_offsets_and_indices(a.major_dim(), a.minor_dim(), offsets, indices) - .expect("internal error: pattern must be valid by definition") + .expect("Internal error: Pattern must be valid by definition") } /// Sparse matrix multiplication pattern construction, `C <- A * B`. @@ -114,7 +114,7 @@ pub fn spmm_csr_pattern(a: &SparsityPattern, b: &SparsityPattern) -> SparsityPat } SparsityPattern::try_from_offsets_and_indices(a.major_dim(), b.minor_dim(), offsets, indices) - .expect("internal error: invalid pattern during matrix multiplication pattern construction") + .expect("Internal error: Invalid pattern during matrix multiplication pattern construction") } /// Iterate over the union of the two sets represented by sorted slices diff --git a/nalgebra-sparse/src/pattern.rs b/nalgebra-sparse/src/pattern.rs index 1253982b..da16df7c 100644 --- a/nalgebra-sparse/src/pattern.rs +++ b/nalgebra-sparse/src/pattern.rs @@ -256,7 +256,7 @@ impl SparsityPattern { new_offsets, new_indices, ) - .expect("internal error: transpose should never fail") + .expect("internal error: Transpose should never fail") } }