From 061880fb9f5497fbd0c475c4232af0558e1d3a30 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Wed, 4 Mar 2026 10:55:59 +0100 Subject: [PATCH] improved diagnostics in clapack_dgesv replacement and bugfix in wrapper of dspsv --- noncblas.cc | 11 +++++++---- nonclass.cc | 23 ++++++++++++++++++----- t.cc | 8 ++++---- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/noncblas.cc b/noncblas.cc index fcda2be..5468978 100644 --- a/noncblas.cc +++ b/noncblas.cc @@ -657,8 +657,9 @@ int clapack_dgesv(const CBLAS_ORDER Order, const int N, const int NRHS, const FINT nrhstmp=NRHS; const FINT ldatmp=lda; const FINT ldbtmp=ldb; - FINT ipivtmp=*ipiv; - FORNAME(dgesv) (&ntmp,&nrhstmp,A,&ldatmp,&ipivtmp,B,&ldbtmp,&INFO); + FINT ipivtmp[N]; + FORNAME(dgesv) (&ntmp,&nrhstmp,A,&ldatmp,ipivtmp,B,&ldbtmp,&INFO); + for(int i=0; i &A, double *B, const int nrhs, const i if (n==A.nrows() && A.nrows() != A.ncols()) laerror("linear_solve() call for non-square matrix"); A.copyonwrite(); ipiv = new int[A.nrows()]; - r = clapack_dgesv(CblasRowMajor, n, nrhs, A[0], A.ncols(), ipiv, B , ldb); +#ifdef IPIV_DEBUG + for(int i=0; i &A, double *B, const int nrhs, const i for (int i=0; in) laerror("problem with ipiv in clapack_dgesv"); + if(ipiv[i]<0 || ipiv[i]>n) + { + std::cout <<"IPIV["<0) *det = 0; @@ -282,7 +291,11 @@ void linear_solve(NRMat< std::complex > &A, NRMat< std::complex for (int i=0; in) laerror("problem with ipiv in zgesv"); + if(ipiv[i]<0 || ipiv[i]>n) + { + std::cout <<"IPIV["<