From 4c0971b30a4982c8b4a3be4b6599639ecb1b6695 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 1 Aug 2013 17:33:23 +0200 Subject: Count filtered eigenvalues --- src/post-refinement.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/post-refinement.c') diff --git a/src/post-refinement.c b/src/post-refinement.c index c444ae31..628e33d2 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -314,7 +314,7 @@ static void apply_shift(Crystal *cr, int k, double shift) } -static void check_eigen(gsl_vector *e_val) +static int check_eigen(gsl_vector *e_val) { int i; double vmax, vmin; @@ -352,12 +352,16 @@ static void check_eigen(gsl_vector *e_val) if ( verbose ) { STATUS("Condition number: %e / %e = %5.2f\n", vmax, vmin, vmax/vmin); + + STATUS("%i out of %i eigenvalues filtered.\n", n_filt, n); } + + return n_filt; } -static gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M) +static gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *n_filt) { gsl_matrix *s_vec; gsl_vector *s_val; @@ -403,7 +407,7 @@ static gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M) /* "SAS" is now "U" */ /* Filter the eigenvalues */ - check_eigen(s_val); + *n_filt = check_eigen(s_val); /* Calculate the vector SB, which is the RHS of the equation */ SB = gsl_vector_calloc(n); @@ -437,7 +441,7 @@ static gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M) /* Perform one cycle of post refinement on 'image' against 'full' */ static double pr_iterate(Crystal *cr, const RefList *full, - PartialityModel pmodel) + PartialityModel pmodel, struct prdata *prdata) { gsl_matrix *M; gsl_vector *v; @@ -540,7 +544,7 @@ static double pr_iterate(Crystal *cr, const RefList *full, } max_shift = 0.0; - shifts = solve_svd(v, M); + shifts = solve_svd(v, M, &prdata->n_filtered); if ( shifts != NULL ) { for ( param=0; param 50.0) && (i < MAX_CYCLES) ); free_backup_crystal(backup); + + return prdata; } -- cgit v1.2.3