----- file created by makedoc on: Tue Feb 11 14:15:24 2003
----- Documentation for /scisoft/IDL/scisoft/xaid/src//polspl.pro -----

 NAME:
	POLSPL

 PURPOSE:

	polynomial spline least squares fit to data points Y(I).
	only the function and it's first derivative are matched at the knots,
	in order to give more degrees of freedom in the fit.

 CATEGORY:
	XAID xafs data analysis package. 

 CALLING SEQUENCE:

	POLSPL,x,y,w,npts,xl,xh,nr,c,nc,

 INPUTS:
	X(i),i=1,npts           abscissas
	Y(i),i=1,npts           ordinates
	W(i),i=1,npts           weighting factor in least squares fit
	fit minimizes the sum of w(i)*(y(i)-poly(x(i)))**2
	if uniform weighting is desired, w(i) must be 1.
	NPTS points in X,Y arrays.  XL,XH arrays contain NR adjacent ranges
	over which to fit individual polynomials.  Array NC specifies
	how many poly coeffs to use in each range.

 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:

 OUTPUTS:
	array C returns
	all coeffs, the first NC(1) of which belong to the first range,
	the second NC(2) of which belong to the second range, and so forth.

 OPTIONAL OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:
	Quite inefficient, because it uses a lot of loops inherited from
	the Fortran code. However, for small set of data it is useful.

 RESTRICTIONS:
	None

 PROCEDURE:
	(Translated from a Fortran Code)
	The method here is to fit ordinary polynomials in X, not B-splines,
	order to save space on a mini-computer.  This means that the
	is rather poorly conditioned, and hence the limits on the
	of the polynomial.  The method of solution is Lagrange's
	multipliers for the knot constraints and gaussian
	to solve the linear system.

 EXAMPLE:

	POLSPL,X,Y,W,NPTS,XL,XH,NR,C,NC

 MODIFICATION HISTORY:
 	Written by:	Manuel Sanchez del Rio. ESRF
	February, 1993	

