From: Brian A. <vx...@br...> - 2006-09-13 12:50:15
|
Hello, I was lead into searching for a bug in my program for quite a while by an inconsistency in vnl_lsqr.cxx. The minimize function returns an int, and there is a function translate_return_code that is documented as "translating the return code into a string". Now vnl_lsqr returns always 0 with the comment, that the return code is not needed. There is an additional function diagnose_outcome, that accesses the saved return code and uses this with translate_return_code. I propose that either the documentation is changed, or the following patch included: Index: vnl_lsqr.cxx =================================================================== RCS file: /cvsroot/vxl/vxl/core/vnl/algo/vnl_lsqr.cxx,v retrieving revision 1.20 diff -r1.20 vnl_lsqr.cxx 96c96,99 < return 0; // return value not used --- > // We should return the return code, as translate_return_code is public and > // it is very misleading that the return code from this function can't be fed > // into translate_return_code. (Brian Amberg) > return return_code_; Index: vnl_lsqr.h =================================================================== RCS file: /cvsroot/vxl/vxl/core/vnl/algo/vnl_lsqr.h,v retrieving revision 1.20 diff -r1.20 vnl_lsqr.h 47c47,48 < // Return code may be translated with translate_return_code(). --- > // Return code may be translated with translate_return_code(), or the result of the > // minimization may be printed in more detail with diagnose_outcome() 56a58,62 > //: Get the return code for the last minimization > inline int return_code() const { return return_code_; } > > > best regards, Brian Amberg -- Brian Amberg http://ruby.brian-amberg.de/ |