Displaying 1 result from an estimated 1 matches for "quad_form".
2009 Jan 06
1
C dll compilation + S Poetry example
Dear all;
Working with the following code extracted from the document S Poetry
by Patrick Burns (from CRAN), I haven't been able to load the
resulting dll into R. The code is basically the calculation of the
quadratic form x'Qx:
static double quad_form(double *Q, double *x, long n)
{
long i, j, ij;
double ans = 0.0;
for(i=0; i < n; i++) {
for(j=0, ij = i * n; j < n; j++, ij++) {
ans = ans + x[i] * Q[ij] * x[j];
}
}
return(ans);
}
void quad_form_Sp(double *Q, double *x, long *xdim, double *ans)
{
long i, ii, n;
double quad_f...