Nl2sol is a popular routine for unconstrained non-linear least-squares. This routine was ported from A. Miller to Fortran 90 with the following warning:
** WARNING **
Use this code with care.
Some compilers use `copy in, copy out' where the INTENT of an array
is IN OUT. A call such as:
CALL l7vml(p, v(g1:), v(rmat1:), v(qtr1:))
which occurs in routine RN2G, can result in routine l7vml copying the
whole of the array v from location g1 to one place, the whole of the
same array from location rmat1 to another place, and the whole of the
array from location qtr1 to another place. On exit from l7vml, the
contents of these temporary workplaces are then written back to array
v with partial overwriting.
This can be overcome either by replacing the call with something like:
CALL l7vml(p, v(g1:g2), v(rmat1:rmat2), v(qtr1:qtr2))
Try the test programs T_SHORT and T_LONG with your compiler.
If it crashes, then you cannot use this code. Most compilers do not
use `copy in, copy out', so this code works. At least one major compiler
does give trouble. The problem is not with the compiler but with this
I tried the test program t_long with Visual Fortran (default options). It crashed when calculating one of the last examples.
Finally my question:
Does Visual Fortran use copy in/copy out or does anyone uses nl2sol?
Can I use certain compiler options to avoid copy in/copy out?`