diff --git a/nalgebra-sparse/src/ops/serial/csc.rs b/nalgebra-sparse/src/ops/serial/csc.rs index 5765e094..bcfb8108 100644 --- a/nalgebra-sparse/src/ops/serial/csc.rs +++ b/nalgebra-sparse/src/ops/serial/csc.rs @@ -8,6 +8,10 @@ use num_traits::{Zero, One}; use std::borrow::Cow; /// Sparse-dense matrix-matrix multiplication `C <- beta * C + alpha * op(A) * op(B)`. +/// +/// # Panics +/// +/// Panics if the dimensions of the matrices involved are not compatible with the expression. pub fn spmm_csc_dense<'a, T>(beta: T, c: impl Into>, alpha: T, @@ -38,6 +42,10 @@ fn spmm_csc_dense_(beta: T, /// /// If the pattern of `c` does not accommodate all the non-zero entries in `a`, an error is /// returned. +/// +/// # Panics +/// +/// Panics if the dimensions of the matrices involved are not compatible with the expression. pub fn spadd_csc_prealloc(beta: T, c: &mut CscMatrix, alpha: T, @@ -52,6 +60,15 @@ pub fn spadd_csc_prealloc(beta: T, /// Sparse-sparse matrix multiplication, `C <- beta * C + alpha * op(A) * op(B)`. +/// +/// # Errors +/// +/// If the sparsity pattern of `C` is not able to store the result of the operation, +/// an error is returned. +/// +/// # Panics +/// +/// Panics if the dimensions of the matrices involved are not compatible with the expression. pub fn spmm_csc_prealloc( beta: T, c: &mut CscMatrix, @@ -95,7 +112,11 @@ pub fn spmm_csc_prealloc( /// /// Only the lower triangular part of L is read, and the result is stored in B. /// -/// ## Panics +/// # Errors +/// +/// An error is returned if the system can not be solved due to the matrix being singular. +/// +/// # Panics /// /// Panics if `L` is not square, or if `L` and `B` are not dimensionally compatible. pub fn spsolve_csc_lower_triangular<'a, T: RealField>( diff --git a/nalgebra-sparse/src/ops/serial/csr.rs b/nalgebra-sparse/src/ops/serial/csr.rs index cec051d5..fc632a35 100644 --- a/nalgebra-sparse/src/ops/serial/csr.rs +++ b/nalgebra-sparse/src/ops/serial/csr.rs @@ -33,8 +33,14 @@ where /// Sparse matrix addition `C <- beta * C + alpha * op(A)`. /// +/// # Errors +/// /// If the pattern of `c` does not accommodate all the non-zero entries in `a`, an error is /// returned. +/// +/// # Panics +/// +/// Panics if the dimensions of the matrices involved are not compatible with the expression. pub fn spadd_csr_prealloc(beta: T, c: &mut CsrMatrix, alpha: T, @@ -48,6 +54,14 @@ where } /// Sparse-sparse matrix multiplication, `C <- beta * C + alpha * op(A) * op(B)`. +/// +/// # Errors +/// +/// If the pattern of `C` is not able to hold the result of the operation, an error is returned. +/// +/// # Panics +/// +/// Panics if the dimensions of the matrices involved are not compatible with the expression. pub fn spmm_csr_prealloc( beta: T, c: &mut CsrMatrix, diff --git a/nalgebra-sparse/src/ops/serial/pattern.rs b/nalgebra-sparse/src/ops/serial/pattern.rs index 168a4d61..2569bad3 100644 --- a/nalgebra-sparse/src/ops/serial/pattern.rs +++ b/nalgebra-sparse/src/ops/serial/pattern.rs @@ -11,7 +11,7 @@ use std::iter; /// /// # Panics /// -/// Panics if the patterns don't have the same major and minor dimensions. +/// Panics if the patterns do not have the same major and minor dimensions. pub fn spadd_pattern(a: &SparsityPattern, b: &SparsityPattern) -> SparsityPattern {