From 8045598534d6e9811a67ab1d4b8eb6cd936e73ef Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Wed, 19 Mar 2014 13:58:36 +0100 Subject: [PATCH] Attempt to fix gelss call in fit_tail. uncommenting the resize fix the issue on linux. valgrind reports no error any more. What was the problem ? --- test/triqs/gfs/test_fit_tail.output | 6 +++--- triqs/arrays/blas_lapack/gelss.hpp | 2 ++ triqs/gfs/local/fit_tail.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/triqs/gfs/test_fit_tail.output b/test/triqs/gfs/test_fit_tail.output index 81f5231e..f1fef76d 100644 --- a/test/triqs/gfs/test_fit_tail.output +++ b/test/triqs/gfs/test_fit_tail.output @@ -66,7 +66,7 @@ ... Order 2 = [[(1,0)]] ... Order 3 = -[[(0.999247,0)]] +[[(0.999251,0)]] ... Order 4 = [[(0.998655,0)]] @@ -80,7 +80,7 @@ ... Order 2 = [[(1,0)]] ... Order 3 = -[[(0.999186,0)]] +[[(0.999236,0)]] ... Order 4 = [[(0.998631,0)]] @@ -94,7 +94,7 @@ ... Order 2 = [[(1,0)]] ... Order 3 = -[[(0.999214,0)]] +[[(0.999251,0)]] ... Order 4 = [[(0.998655,0)]] diff --git a/triqs/arrays/blas_lapack/gelss.hpp b/triqs/arrays/blas_lapack/gelss.hpp index 46453496..e0773c3e 100644 --- a/triqs/arrays/blas_lapack/gelss.hpp +++ b/triqs/arrays/blas_lapack/gelss.hpp @@ -82,6 +82,8 @@ namespace triqs { namespace arrays { namespace lapack { f77::gelss ( get_n_rows(Ca()), get_n_cols(Ca()), nrhs , Ca().data_start(), get_ld(Ca()), Cb().data_start(), get_ld(Cb()), Cs().data_start(), rcond, rank, work.data_start(), lwork, info); + + if (info) TRIQS_RUNTIME_ERROR << "Error in gelss : info = "<< info; return info; } diff --git a/triqs/gfs/local/fit_tail.cpp b/triqs/gfs/local/fit_tail.cpp index 45ef244e..f8ead5d8 100644 --- a/triqs/gfs/local/fit_tail.cpp +++ b/triqs/gfs/local/fit_tail.cpp @@ -35,8 +35,8 @@ namespace triqs { namespace gfs { namespace local { for (int j = 0; j < get_target_shape(gf)[1]; j++) { // fit the odd moments - // S.resize(size_odd); - // A.resize(size1,size_odd); //when resizing, gelss segfaults + S.resize(size_odd); + A.resize(size1,size_odd); //when resizing, gelss segfaults for (int k = 0; k < size1; k++) { auto n = n_min + k; auto iw = std::complex(gf.mesh().index_to_point(n)); @@ -58,8 +58,8 @@ namespace triqs { namespace gfs { namespace local { } // fit the even moments - // S.resize(size_even); - // A.resize(size1,size_even); //when resizing, gelss segfaults + S.resize(size_even); + A.resize(size1,size_even); //when resizing, gelss segfaults for (int k = 0; k < size1; k++) { auto n = n_min + k; auto iw = std::complex(gf.mesh().index_to_point(n));