aboutsummaryrefslogtreecommitdiff
path: root/math/curfit/cvzeror.x
blob: bd84029f5964dbee2a94533a61c906cac9466626 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include "curfitdef.h"

# CVZERO -- Procedure to zero the accumulators before doing
# a new fit in accumulate mode. The inner products of the basis functions
# are accumulated in the CV_ORDER(cv) by CV_NCOEFF(cv) array MATRIX, while
# the inner products of the basis functions and the data ordinates are
# accumulated in the CV_NCOEFF(cv)-vector VECTOR.

procedure cvzero (cv)

pointer	cv	# pointer to curve descriptor

errchk	mfree

begin
	# zero the accumulators
	CV_NPTS(cv) = 0
	call aclrr (MATRIX(CV_MATRIX(cv)), CV_ORDER(cv)*CV_NCOEFF(cv))
	call aclrr (VECTOR(CV_VECTOR(cv)), CV_NCOEFF(cv))

	# free the basis functions defined from previous calls to cvrefit
	if (CV_BASIS(cv) != NULL) {
	    call mfree (CV_BASIS(cv), TY_REAL)
	    call mfree (CV_WY(cv), TY_REAL)
	    CV_BASIS(cv) = NULL
	    CV_WY(cv) = NULL
	    if (CV_LEFT(cv) != NULL) {
		call mfree (CV_LEFT(cv), TY_INT)
		CV_LEFT(cv) = NULL
	    }
	}
end