diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /math/nlfit/nlsolver.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/nlfit/nlsolver.x')
-rw-r--r-- | math/nlfit/nlsolver.x | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/math/nlfit/nlsolver.x b/math/nlfit/nlsolver.x new file mode 100644 index 00000000..85d238d6 --- /dev/null +++ b/math/nlfit/nlsolver.x @@ -0,0 +1,37 @@ +include <math/nlfit.h> +include "nlfitdefr.h" + +# NLSOLVE -- Procedure to solve nonlinear system + +procedure nlsolver (nl, ier) + +pointer nl # pointer to the nlfit structure +int ier # error code + +int nfree + +begin + # Make temporary arrays. + call amovr (ALPHA(NL_ALPHA(nl)), COVAR(NL_COVAR(nl)), + NL_NFPARAMS(nl) ** 2) + call amovr (BETA(NL_BETA(nl)), DPARAM(NL_DPARAM(nl)), NL_NFPARAMS(nl)) + + # Add the lambda damping factor. + call nl_dampr (COVAR(NL_COVAR(nl)), COVAR(NL_COVAR(nl)), + (1.0 + NL_LAMBDA(nl)), NL_NFPARAMS(nl), NL_NFPARAMS(nl)) + + ier = OK + nfree = NL_NPTS(nl) - NL_NFPARAMS(nl) + if (nfree < 0) { + ier = NO_DEG_FREEDOM + return + } + + # Compute the factorization of the matrix. + call nl_chfacr (COVAR(NL_COVAR(nl)), NL_NFPARAMS(nl), NL_NFPARAMS(nl), + CHOFAC(NL_CHOFAC(nl)), ier) + + # Solve the equations for the parameter increments. + call nl_chslvr (CHOFAC(NL_CHOFAC(nl)), NL_NFPARAMS(nl), NL_NFPARAMS(nl), + DPARAM(NL_DPARAM(nl)), DPARAM(NL_DPARAM(nl))) +end |