aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-06-30 05:54:53 -0700
committerThomas White <taw@physics.org>2013-06-30 05:54:53 -0700
commit5143ea6b985eb83e55ad950c675f86a98d281277 (patch)
treead4d653a28b466568f8cd282af5fad3ffad2d95e
parent058aa436c9aa104deb73d2e55532ae9175ef7db8 (diff)
compare_hkl: Tidy up and fix CRDano
-rw-r--r--src/compare_hkl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index d3185def..5371f956 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -339,8 +339,8 @@ static double fom_shell(struct fom_context *fctx, int i)
int j;
double variance_signal;
double variance_error;
- double along_diagonal[fctx->n[i]];
- double perpend_diagonal[fctx->n[i]];
+ double *along_diagonal;
+ double *perpend_diagonal;
switch ( fctx->fom ) {
@@ -366,16 +366,20 @@ static double fom_shell(struct fom_context *fctx, int i)
case FOM_CRDANO :
+ along_diagonal = malloc(fctx->n[i] * sizeof(double));
+ perpend_diagonal = malloc(fctx->n[i] * sizeof(double));
for ( j=0; j<fctx->n[i]; j++ ) {
- along_diagonal[j] =( fctx->vec1[i][j] +
+ along_diagonal[j] = ( fctx->vec1[i][j] +
fctx->vec2[i][j] ) / sqrt(2.0);
- perpend_diagonal[j] =( fctx->vec1[i][j] -
+ perpend_diagonal[j] = ( fctx->vec1[i][j] -
fctx->vec2[i][j] ) / sqrt(2.0);
- }
+ }
variance_signal = gsl_stats_variance_m(along_diagonal, 1,
fctx->n[i], 0.0);
variance_error = gsl_stats_variance_m(perpend_diagonal, 1,
fctx->n[i], 0.0);
+ free(along_diagonal);
+ free(perpend_diagonal);
return sqrt(variance_signal / variance_error);
}