From d4cc700c8bc04009f2ad8b8992f09d5c483dbf0e Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Sun, 11 Nov 2018 12:15:16 +0100 Subject: [PATCH] Improve verbosity of panic messages in CsMat --- src/sparse/csmat.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/sparse/csmat.rs b/src/sparse/csmat.rs index f40d531f..c6424177 100644 --- a/src/sparse/csmat.rs +++ b/src/sparse/csmat.rs @@ -1077,14 +1077,26 @@ where let outer = self.outer_dims(); if self.indptr.len() != outer + 1 { - panic!("Indptr length does not match dimension"); + panic!( + "Indptr length does not match dimension: {} != {}", + self.indptr.len(), + outer + 1 + ); } if self.indices.len() != self.data.len() { - panic!("Indices and data lengths do not match"); + panic!( + "Indices and data lengths do not match: {} != {}", + self.indices.len(), + self.data.len() + ); } let nnz = self.indices.len(); if nnz != self.nnz() { - panic!("Indices length and inpdtr's nnz do not match"); + panic!( + "Indices length and inpdtr's nnz do not match: {} != {}", + nnz, + self.nnz() + ); } if let Some(&max_indptr) = self.indptr.iter().max() { if max_indptr.index() > nnz {