Skip to content

Instantly share code, notes, and snippets.

@dantswain
Created December 3, 2011 21:50
Show Gist options
  • Save dantswain/1428255 to your computer and use it in GitHub Desktop.
Save dantswain/1428255 to your computer and use it in GitHub Desktop.
Quadratic form in c
for(i = 0; i < n_rows; i++)
{
tmp = 0;
for(j = i + 1; j < n_rows; j++)
{
tmp += prA[i*n_rows + j]*prX[j];
}
y += prX[i]*2.0*tmp;
y += prX[i]*prX[i]*prA[i*n_rows + i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment