aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-05-13 13:41:58 +0200
committerThomas White <taw@physics.org>2015-05-13 13:45:15 +0200
commitda6573ac029cae2c67cc77da2eb64c825c7ba244 (patch)
treed39736bf9a006c2b90d704f42856a5af5dcb0a13 /libcrystfel
parent613ce29a9d285e056085e3a76745733933b22cc0 (diff)
solve_svd(): Filter the eigenvalues even if the result is not used
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c
index 4a1d6c60..42108270 100644
--- a/libcrystfel/src/utils.c
+++ b/libcrystfel/src/utils.c
@@ -164,7 +164,7 @@ static int check_eigen(gsl_vector *e_val, int verbose)
* Solves the matrix equation M.x = v, returning x.
* Performs rescaling and eigenvalue filtering.
**/
-gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *n_filt, int verbose)
+gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *pn_filt, int verbose)
{
gsl_matrix *s_vec;
gsl_vector *s_val;
@@ -176,6 +176,7 @@ gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *n_filt, int verbose)
gsl_matrix *AS;
gsl_matrix *SAS;
int i;
+ int n_filt;
gsl_matrix *SAS_copy;
n = v->size;
@@ -223,7 +224,8 @@ gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *n_filt, int verbose)
/* "SAS" is now "U" */
/* Filter the eigenvalues */
- if ( n_filt != NULL ) *n_filt = check_eigen(s_val, verbose);
+ n_filt = check_eigen(s_val, verbose);
+ if ( pn_filt != NULL ) *pn_filt = n_filt;
gsl_matrix_free(SAS_copy);