Closed xecej4 closed 2 years ago
Yep, these tests have not been modernized. Probably there are lot of things to fix. thanks for reporting this (and the others)
The fixes are quite simple. For the driver test_lmder.f90, here are the fixes.
Add the following as the first executable statement in subroutine SSQJAC:
Fjac(1:m,1:n) = 0.0d0
Similarly, add as the first executable statement in INITPT:
X(1:n) = 0.0d0
and as the first executable statement in SSQFCN:
Fvec(1:m) = 0.d0
Similar changes apply to the other drivers. For test_lmstr.f90, add ",Save" to the declaration of TEMP in subroutine FCN.
I'm not quite seeing why the temp
needs a save
attribute.
oh wait...I just saw #7.
In the C test I solved this by introducing more cases and actually calculate the Jacobian row by row rather than once and rely on save
/ static
to retrieve the previously calculated values.
The driver programs do not assign zero initial values to the variable arrays x, Fvec and Fjac. Only the nonzero initial values are programmed. As a result, if the Fortran compiler in use does not provide a switch to do zero-initialization, or the user does not use the switch, the results will most probably be completely wrong.
Correcting this deficiency should also take care of issue #5.