From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- math/curfit/cvfit.gx | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 math/curfit/cvfit.gx (limited to 'math/curfit/cvfit.gx') diff --git a/math/curfit/cvfit.gx b/math/curfit/cvfit.gx new file mode 100644 index 00000000..65c3bfb5 --- /dev/null +++ b/math/curfit/cvfit.gx @@ -0,0 +1,66 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include + +$if (datatype == r) +include "curfitdef.h" +$else +include "dcurfitdef.h" +$endif + +# CVFIT -- Procedure to add a set of points to the normal equations. +# The inner products of the basis functions are calculated and +# accumulated into the CV_ORDER(cv) by CV_NCOEFF(cv) matrix MATRIX. +# The main diagonal of the matrix is stored in the first row of +# MATRIX followed by the remaining non-zero diagonals. This method +# of storage is particularly efficient for the large symmetric +# banded matrices produced during spline fits. The inner product +# of the basis functions and the data ordinates are stored in the +# CV_NCOEFF(cv)-vector VECTOR. The array LEFT is +# used for the indices describing which elements of MATRIX and VECTOR are +# to receive the inner products. After accumulation is complete +# the Cholesky factorization of MATRIX is calculated and stored +# in the CV_ORDER(cv) by CV_NCOEFF(cv) matrix CHOFAC. Finally +# the coefficients are calculated by forward and back substitution +# and placed in COEFF. + +$if (datatype == r) +procedure cvfit (cv, x, y, w, npts, wtflag, ier) +$else +procedure dcvfit (cv, x, y, w, npts, wtflag, ier) +$endif + +pointer cv # curve descriptor +PIXEL x[npts] # array of abcissa +PIXEL y[npts] # array of ordinates +PIXEL w[npts] # array of weights +int npts # number of data points +int wtflag # type of weighting +int ier # error code + + +begin + $if (datatype == r) + + # zero the appropriate arrays + call cvzero (cv) + + # enter data points + call cvacpts (cv, x, y, w, npts, wtflag) + + # solve the system + call cvsolve (cv, ier) + + $else + + # zero the appropriate arrays + call dcvzero (cv) + + # enter data points + call dcvacpts (cv, x, y, w, npts, wtflag) + + # solve the system + call dcvsolve (cv, ier) + + $endif +end -- cgit