/* nag_kalman_sqrt_filt_info_var (g13ecc) Example Program. * * Copyright 1993 Numerical Algorithms Group * * Mark 3, 1993 * Mark 8 revised, 2004. */ #include #include #include #include #define AINV(I,J) ainv[(I)*tdainv + J] #define QINV(I,J) qinv[(I)*tdqinv + J] #define RINV(I,J) rinv[(I)*tdrinv + J] #define T(I,J) t[(I)*tdt + J] #define B(I,J) b[(I)*tdb + J] #define C(I,J) c[(I)*tdc + J] int main(void) { Integer exit_status=0, i, istep, j, m, n, p, tdainv, tdb, tdc, tdqinv, tdrinv; Integer tdt; NagError fail; Nag_ab_input inp_ab; double *ainv=0, *b=0, *c=0, *qinv=0, *rinv=0, *rinvy=0, *t=0, tol, *x=0; double *z=0; INIT_FAIL(fail); Vprintf("nag_kalman_sqrt_filt_info_var (g13ecc) Example Program Results\n"); /* Skip the heading in the data file */ Vscanf("%*[^\n]"); Vscanf("%ld%ld%ld%lf",&n,&m,&p,&tol); if (n>=1 && m>=1 && p>=1) { if ( !( ainv = NAG_ALLOC(n*n, double)) || !( qinv = NAG_ALLOC(m*m, double)) || !( rinv = NAG_ALLOC(p*p, double)) || !( t = NAG_ALLOC(n*n, double)) || !( b = NAG_ALLOC(n*m, double)) || !( c = NAG_ALLOC(p*n, double)) || !( x = NAG_ALLOC(n, double)) || !( z = NAG_ALLOC(m, double)) || !( rinvy = NAG_ALLOC(p, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } tdainv = n; tdqinv = m; tdrinv = p; tdt = n; tdb = m; tdc = n; } else { Vprintf("Invalid n or m or p.\n"); exit_status = 1; return exit_status; } inp_ab = Nag_ab_prod; /* Read data */ for (i=0; i