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

include <math/gsurfit.h>
include "gsurfitdef.h"

# GSFIT -- Procedure to solve the normal equations for a surface.
# The inner products of the basis functions are calculated and
# accumulated into the GS_NCOEFF(sf) ** 2 matrix MATRIX.
# The main diagonal of the matrix is stored in the first row of
# MATRIX followed by the remaining non-zero diagonals.
# The inner product
# of the basis functions and the data ordinates are stored in the
# GS_NCOEFF(sf)-vector VECTOR. The Cholesky factorization of MATRIX
# is calculated and stored in CHOFAC. Forward and back substitution
# is used to solve for the GS_NCOEFF(sf)-vector COEFF.

procedure gsfit (sf, x, y, z, w, npts, wtflag, ier)

pointer	sf		# surface descriptor
real	x[npts]		# array of x values
real	y[npts]		# array of y values
real	z[npts]		# data array
real	w[npts]		# array of weights
int	npts		# number of data points
int	wtflag		# type of weighting
int	ier		# ier = OK, everything OK
			# ier = SINGULAR, matrix is singular, 1 or more
			# coefficients are 0.
			# ier = NO_DEG_FREEDOM, too few points to solve matrix

begin
	    call gszero (sf)
	    call gsacpts (sf, x, y, z, w, npts, wtflag)
	    call gssolve (sf, ier)
end