From 55e47933af72c42f5642645590cf6c6528790ea3 Mon Sep 17 00:00:00 2001 From: Hazen Babcock Date: Mon, 17 Sep 2018 15:10:37 -0400 Subject: [PATCH] Check for NaNs when info is zero. --- storm_analysis/sa_library/multi_fit.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/storm_analysis/sa_library/multi_fit.c b/storm_analysis/sa_library/multi_fit.c index 5abfb7de..815228cc 100644 --- a/storm_analysis/sa_library/multi_fit.c +++ b/storm_analysis/sa_library/multi_fit.c @@ -1594,16 +1594,28 @@ int mFitSolve(double *hessian, double *jacobian, int p_size) { int i,j; - // Lapack + /* Lapack */ int n, nrhs = 1, lda, ldb, info; n = p_size; lda = p_size; ldb = p_size; - // Use Lapack to solve AX=B to calculate update vector + /* Use Lapack to solve AX=B to calculate update vector. */ dposv_("Lower", &n, &nrhs, hessian, &lda, jacobian, &ldb, &info); + /* + * This can return NaNs with info = 0.. Need to catch this + * and return as failure to solve. + */ + if(info==0){ + for(i=0;i