/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:18 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_spfit s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_spfit.h" /* program DRSPFIT *>> 1996-06-21 DRSPFIT Krogh Special code for C conversion. *>> 1996-05-28 DRSPFIT Krogh Added external statement. *>> 1995-09-15 DRSPFIT Krogh Declare all variables. *>> 1995-09-15 DRSPFIT Krogh Remove '0' in format (again?) *>> 1994-10-19 DRSPFIT Krogh Changes to use M77CON *>> 1994-08-09 DRSPFIT WVS Remove '0' in format *>> 1991-11-20 DRSPFIT CLL Edited for Fortran 90 *>> 1987-12-09 DRSPFIT Lawson Initial Code. *--S replaces "?": DR?PFIT, ?PFIT, ?CPVAL * Demonstration driver for SPFIT. *++ Code for .C. is active */ long int j; int main( ) { long int i, ndeg, np3, _i, _r; float p[11], r, sigfac, w[121], yfit; static float sig[1]; static float x[12]={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[12]={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 long m = 12; static int _aini = 1; /* OFFSET Vectors w/subscript range: 1 to dimension */ float *const P = &p[0] - 1; float *const Sig = &sig[0] - 1; float *const W = &w[0] - 1; float *const X = &x[0] - 1; float *const Y = &y[0] - 1; /* end of OFFSET VECTORS */ if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ Sig[1] = -1.e0; _aini = 0; } /*++ End */ spfit( m, x, y, sig, 8, TRUE, TRUE, TRUE, p, &ndeg, &sigfac, w ); np3 = ndeg + 3; /*++ Code for ~.C. is inactive * print * *'(/'' NDEG ='',I2,10X,''SIGFAC ='',F8.4// * *'' P(1),P(2) ='',9X,2F15.8//'' P(3),...,P(NDEG+3) ='',3F15.8/ * *(21X,3F15.8))', NDEG,SIGFAC,(P(I),I=1,NP3) *++ Code for .C. is active */ printf( "\n NDEG =%2ld SIGFAC =%8.4f",ndeg,sigfac ); printf( "\n\n P(1),P(2) = %15.8f%15.5f\n\n P(3),...,P(NDEG+3) =", p[0], p[1]); for (i = 2; i < (np3); i+=3){ for (j = i; j < (i < np3-2 ? i+3 : np3); j++) printf("%15.8f", p[j]); if (i < np3-2) printf("\n ");} printf("\n"); printf(" \n I X Y YFIT R=Y-YFIT\n \n"); /*++ End */ for (i = 1; i <= m; i++) { yfit = scpval( p, ndeg, X[i] ); 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 */