/*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_dchol s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dchol.h" /* program DRDCHOL *>> 1996-06-17 DRDCHOL Krogh Minor format change for C conversion. *>> 1996-05-28 DRDCHOL Krogh Added external statement. *>> 1994-10-19 DRDCHOL Krogh Changes to use M77CON *>> 1994-08-09 DRDCHOL WVS remove '0' from formats *>> 1992-03-04 DRDCHOL Krogh Initial version. * Demonstration driver for DCHOL * ------------------------------------------------------------------ *--D replaces "?": DR?CHOL, ?CHOL, ?DOT * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define LDP 2 #define M 3 #define N 2 /* end of PARAMETER translations */ int main( ) { long int i, ierr, j, _i, _r; double d[LDP], p[LDP][LDP], u; static double a[N][M], b[M]; static int _aini = 1; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const B = &b[0] - 1; double *const D = &d[0] - 1; /* end of OFFSET VECTORS */ if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ a[0][0] = 0.7e0; a[1][0] = 0.6e0; B[1] = 1.726e0; a[0][1] = -0.8e0; a[1][1] = 0.5e0; B[2] = -5.415e0; a[0][2] = 0.6e0; a[1][2] = -0.7e0; B[3] = 5.183e0; _aini = 0; } /* ------------------------------------------------------------------ */ u = ddot( M, b, 1, b, 1 ); for (i = 1; i <= N; i++) { D[i] = ddot( M, &a[i - 1][0], 1, b, 1 ); for (j = 1; j <= N; j++) { p[j - 1][i - 1] = ddot( M, &a[i - 1][0], 1, &a[j - 1][0], 1 ); } } dchol( (double*)p, LDP, N, d, &u, 0.0e0, &ierr ); printf(" X() = %15.6f%15.6f\n", D[1], D[2]); printf(" RNORM = %15.6f\n", u); if (ierr != 0) { printf(" Matrix failed conditioning test in DCHOL, IERR = %3ld\n", ierr); } exit(0); } /* end of function */