/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:20 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_swcomp s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_swcomp.h" /* program DRSWCOMP *>> 1994-10-19 DRSWCOMP Krogh Changes to use M77CON *>> 1987-12-09 DRSWCOMP Lawson Initial Code. *--S replaces "?": DR?WCOMP, ?WSET, ?VECP, ?WSQRT, ?WLOG, ?WPRO1, ?WEXP, *--& ?WDIF, ?WCOMP * Demo driver for the SWCOMP package. Derivative arithmetic. * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define NDIM (NMAX + 1) #define NMAX 3 #define ONE 1.0e0 #define TWO 2.0e0 /* end of PARAMETER translations */ int main( ) { long int n; float diff[NDIM], t[NDIM], x1[NDIM], x2[NDIM], z1[NDIM], z2[NDIM]; /* OFFSET Vectors w/subscript range: 1 to dimension */ float *const Diff = &diff[0] - 1; float *const T = &t[0] - 1; float *const X1 = &x1[0] - 1; float *const X2 = &x2[0] - 1; float *const Z1 = &z1[0] - 1; float *const Z2 = &z2[0] - 1; /* end of OFFSET VECTORS */ /* ------------------------------------------------------------------ */ printf("DRSWCOMP.. Demo driver for the SWCOMP package.\n"); n = NMAX; /* Set T = 2.0 */ swset( n, TWO, ONE, t ); svecp( t, n + 1, "0 T =" ); /* Compute Z1 = log(sqrt(T)) */ swsqrt( n, t, x1 ); swlog( n, x1, z1 ); svecp( z1, n + 1, "0 Z1 = logf(sqrtf(T)) =" ); /* Compute Z2 = exp(2.0 * Z1) */ swpro1( n, TWO, z1, x2 ); swexp( n, x2, z2 ); svecp( z2, n + 1, "0 Z2 = expf(2.0 * Z1) =" ); /* Diff = Z2 - T */ swdif( n, z2, t, diff ); svecp( diff, n + 1, "0 DIFF = Z2 - T =" ); exit(0); } /* end of function */