aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-05-13 13:42:24 +0200
committerThomas White <taw@physics.org>2015-05-13 13:45:30 +0200
commit62c19009fe70b94153f57044e7717e2e59980009 (patch)
tree95c5a85e0303108df57a12b281f7944e4e5245b9 /libcrystfel/src/utils.c
parentda6573ac029cae2c67cc77da2eb64c825c7ba244 (diff)
solve_svd(): Squash NaNs after rescaling
Diffstat (limited to 'libcrystfel/src/utils.c')
-rw-r--r--libcrystfel/src/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c
index 42108270..af0abedc 100644
--- a/libcrystfel/src/utils.c
+++ b/libcrystfel/src/utils.c
@@ -209,6 +209,16 @@ gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *pn_filt, int verbose)
SAS_copy = gsl_matrix_alloc(SAS->size1, SAS->size2);
gsl_matrix_memcpy(SAS_copy, SAS);
+ for ( i=0; i<n; i++ ) {
+ int j;
+ if ( isnan(gsl_vector_get(SB, i)) ) gsl_vector_set(SB, i, 0.0);
+ for ( j=0; j<n; j++ ) {
+ if ( isnan(gsl_matrix_get(SAS, i, j)) ) {
+ gsl_matrix_set(SAS, i, j, 0.0);
+ }
+ }
+ }
+
/* Do the SVD */
s_val = gsl_vector_calloc(n);
s_vec = gsl_matrix_calloc(n, n);