macro 'conjgrad' wrong input arguments check and error message
Reported by Klaus Crusius
conjgrad.sci (14.76 KB, application/x-scilab-sci)
Modified source code
BUG DESCRIPTION:
----------------
When calling conjgrad with more than 8 input arguments, an inappropriate error message appears and execution is stopped.
The arguments setting correspond to the help-documentation.
The source code of the macro would perform correctly with up to 9 arguments as documented.
ERROR LOG:
----------
-->[x,flag,err,iter,res] = conjgrad(speye(1,1), zeros(1,1), 'pcg', 1e-10, 100, [], [], ones(1,1), 1);
!--error 10000
conjgrad: Wrong number of input arguments: 2 to 7 expected.
at line 9 of function conjgrad called by :
[x,flag,err,iter,res] = conjgrad(speye(1,1), zeros(1,1), 'pcg', 1e-10, 100, [], [], ones(1,1), 1);
HOW TO REPRODUCE THE BUG:
-------------------------
Invoke macro as documented in error log.
OTHER INFORMATION:
------------------
Propose to change source code of <SCI>/modules/sparse/macros/conjgrad.sci
from
if rhs < 2 then
error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"conjgrad",2,7));
end
if rhs > 8 then
error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"conjgrad",2,7));
end
to
if rhs < 2 | rhs > 9 then
error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"conjgrad",2,9));
end
.