/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:12 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_dpfit s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dpfit.h" /* program DRDPFIT *>> 1996-06-21 DRDPFIT Krogh Special code for C conversion. *>> 1996-05-28 DRDPFIT Krogh Added external statement. *>> 1995-09-15 DRDPFIT Krogh Declare all variables. *>> 1995-09-15 DRDPFIT Krogh Remove '0' in format (again?) *>> 1994-10-19 DRDPFIT Krogh Changes to use M77CON *>> 1994-08-09 DRDPFIT WVS Remove '0' in format *>> 1991-11-20 DRDPFIT CLL Edited for Fortran 90 *>> 1987-12-09 DRDPFIT Lawson Initial Code. *--D replaces "?": DR?PFIT, ?PFIT, ?CPVAL * Demonstration driver for DPFIT. *++ Code for .C. is active */ long int j; int main( ) { long int i, ndeg, np3, _i, _r; double p[11], r, sigfac, w[121], yfit; static double sig[1]; static double 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 double 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 */ double *const P = &p[0] - 1; double *const Sig = &sig[0] - 1; double *const W = &w[0] - 1; double *const X = &x[0] - 1; double *const Y = &y[0] - 1; /* end of OFFSET VECTORS */ if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ Sig[1] = -1.e0; _aini = 0; } /*++ End */ dpfit( 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 = dcpval( 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 */