From 8a22b6a096c30cc4a6d37158db24c61ff499ecaf Mon Sep 17 00:00:00 2001 From: Francesco Lannutti Date: Sun, 3 Jul 2016 01:36:26 +0200 Subject: [PATCH] Handling the general case for an empty CSC matrix during the conversion to CSR format --- src/maths/KLU/klu_utils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/maths/KLU/klu_utils.c b/src/maths/KLU/klu_utils.c index 395bfa522..be82f57c8 100644 --- a/src/maths/KLU/klu_utils.c +++ b/src/maths/KLU/klu_utils.c @@ -88,8 +88,11 @@ KLU_convert_matrix_in_CSR /* return TRUE if successful, FALSE otherwise { if (Ai_CSC == NULL || Ax_CSC == NULL) { - Ap_CSR [0] = 0 ; - Ap_CSR [1] = 0 ; + /* CSC Matrix is empty, so the CSR one */ + for (i = 0 ; i <= n ; i++) + { + Ap_CSR [i] = 0 ; + } Common->status = KLU_OK ; return (TRUE) ; }