source: CIVL/examples/compare/CholeskyDecomposition/choldc.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 373 bytes
Line 
1#include <math.h>
2
3void choldc(float **a, int n, float p[])
4{
5 void nrerror(char error_text[]);
6 int i, j, k;
7 float sum;
8
9 for (i=0; i<=n; i++) {
10 for (j=i; j<=n; j++ ) {
11 for (sum=a[i][j], k=i-1; k>=1; k--) sum -= a[i][k]*a[j][k];
12 if (i == j) {
13 if (sum <= 0.0)
14 nrerror("choldc failed");
15 p[i] = sqrt(sum);
16 } else a[j][i]=sum/p[i];
17 }
18 }
19}
Note: See TracBrowser for help on using the repository browser.