/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:14 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_sc2fit s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_sc2fit.h" /* program DRSC2FIT *>> 1996-07-03 DRSC2FIT Krogh Changed formats for C conversion. *>> 1994-10-19 DRSC2FIT Krogh Changes to use M77CON *>> 1992-04-27 DRSC2FIT CLL Declared all variables. *>> 1987-12-09 DRSC2FIT Lawson Initial Code. * Demonstration driver for SC2FIT. * C. L. Lawson, JPL, Apr 13 1987, 7/23/87 * ------------------------------------------------------------------ *--S 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; float r, sigfac, w[5][NW], yfit, yknot[NB], ypknot[NB]; static float sd[1]; static float 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 float 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 float 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 */ float *const B = &b[0] - 1; float *const Sd = &sd[0] - 1; float *const X = &x[0] - 1; float *const Y = &y[0] - 1; float *const Yknot = &yknot[0] - 1; float *const Ypknot = &ypknot[0] - 1; /* end of OFFSET VECTORS */ if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ Sd[1] = -1.e0; _aini = 0; } /* ------------------------------------------------------------------ */ sc2fit( x, y, sd, NXY, b, NB, (float*)w, NW, yknot, ypknot, &sigfac, &ierr ); printf(" DRSC2FIT.. Demo driver for SC2FIT. Also uses SHINT.\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 = shint( 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 */