aboutsummaryrefslogtreecommitdiff
path: root/math/nlfit/nlzeror.x
blob: 1cceba3108307b95a9647bceb86b24124b8810ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
include "nlfitdefr.h"


# NLZERO --  Zero the accumulators and reset the fitting parameter values to
# their original values set by nlinit().

procedure nlzeror (nl)

pointer	nl		# pointer to nl fitting structure

int	nparams		# number of parameters
int	nfparams	# number of fitted parameters

begin
	# Get number of parameters and fitting parameters.
	nparams  = NL_NPARAMS(nl)
	nfparams = NL_NFPARAMS(nl)

	# Clear temporary array space.
	call aclrr (ALPHA(NL_ALPHA(nl)), nfparams * nfparams)
	call aclrr (COVAR(NL_COVAR(nl)), nfparams * nfparams)
	call aclrr (CHOFAC(NL_CHOFAC(nl)), nfparams * nfparams)
	call aclrr (BETA(NL_BETA(nl)), nfparams)

	# Clear space for derivatives and trial parameter vectors.
	call aclrr (DERIV(NL_DERIV(nl)), nparams)
	call aclrr (TRY(NL_TRY(nl)), nparams)

	# Reset parameters.
	call amovr (OPARAM(NL_OPARAM(nl)), PARAM(NL_PARAM(nl)), nparams)
	call aclrr (DPARAM(NL_DPARAM(nl)), nparams)

	NL_SCATTER(nl) = real(0.0)
end