/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:08 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_dc2fit s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dc2fit.h" /* program DRDC2FIT *>> 1996-07-03 DRDC2FIT Krogh Changed formats for C conversion. *>> 1994-10-19 DRDC2FIT Krogh Changes to use M77CON *>> 1992-04-27 DRDC2FIT CLL Declared all variables. *>> 1987-12-09 DRDC2FIT Lawson Initial Code. * Demonstration driver for DC2FIT. * C. L. Lawson, JPL, Apr 13 1987, 7/23/87 * ------------------------------------------------------------------ *--D replaces "?": DR?C2FIT, ?C2FIT, ?HINT * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define NB 6 #define NW 10 #define NXY 12 /* end of PARAMETER translations */ int main( ) { long int i, ierr, _i, _r; double r, sigfac, w[5][NW], yfit, yknot[NB], ypknot[NB]; static double sd[1]; static double x[NXY]={2.e0,4.e0,6.e0,8.e0,10.e0,12.e0,14.e0,16.e0, 18.e0,20.e0,22.e0,24.e0}; static double y[NXY]={2.2e0,4.0e0,5.0e0,4.6e0,2.8e0,2.7e0,3.8e0, 5.1e0,6.1e0,6.3e0,5.0e0,2.0e0}; static double b[NB]={2.0e0,6.4e0,10.8e0,15.2e0,19.6e0,24.0e0}; static long nderiv = 0; static int _aini = 1; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const B = &b[0] - 1; double *const Sd = &sd[0] - 1; double *const X = &x[0] - 1; double *const Y = &y[0] - 1; double *const Yknot = &yknot[0] - 1; double *const Ypknot = &ypknot[0] - 1; /* end of OFFSET VECTORS */ if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ Sd[1] = -1.e0; _aini = 0; } /* ------------------------------------------------------------------ */ dc2fit( x, y, sd, NXY, b, NB, (double*)w, NW, yknot, ypknot, &sigfac, &ierr ); printf(" DRDC2FIT.. Demo driver for DC2FIT. Also uses DHINT.\n"); printf("\n IERR =%5ld, SIGFAC =%10.5f", ierr, sigfac); printf("\n\n YKNOT() = "); for (i = 1; i <= NB; i++) { printf("%10.5f", Yknot[i]); } printf("\n"); printf(" YPKNOT() = "); for (i = 1; i <= NB; i++) { printf("%10.5f", Ypknot[i]); } printf("\n"); printf("\n I X Y YFIT R=Y-YFIT\n\n"); for (i = 1; i <= NXY; i++) { yfit = dhint( X[i], nderiv, NB, b, yknot, ypknot ); r = Y[i] - yfit; printf(" %2ld%6.0f%9.3f%9.3f%10.3f\n", i, X[i], Y[i], yfit, r); } exit(0); } /* end of function */