aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-05-02 16:48:39 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:25 +0100
commit8ae238359607dababf9ffc98613aa57d28f3ee04 (patch)
tree92f52442da1f16ad1b37e09980a9c5af793afd5b /src/post-refinement.c
parentd541875f60a47acedca42163f04c7ed88c17234b (diff)
partialator: Fail a bit more gracefully if equations can't be solved
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index db8d4990..0945affd 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -320,13 +320,17 @@ static double pr_iterate(struct image *image, const RefList *full,
//show_matrix_eqn(M, v, NUM_PARAMS);
shifts = gsl_vector_alloc(NUM_PARAMS);
- gsl_linalg_HH_solve(M, v, shifts);
-
max_shift = 0.0;
- for ( param=0; param<NUM_PARAMS; param++ ) {
- double shift = gsl_vector_get(shifts, param);
- apply_shift(image, param, shift);
- if ( fabs(shift) > max_shift ) max_shift = fabs(shift);
+ if ( gsl_linalg_HH_solve(M, v, shifts) ) {
+ ERROR("Couldn't solve normal equations!\n");
+ } else {
+
+ for ( param=0; param<NUM_PARAMS; param++ ) {
+ double shift = gsl_vector_get(shifts, param);
+ apply_shift(image, param, shift);
+ if ( fabs(shift) > max_shift ) max_shift = fabs(shift);
+ }
+
}
gsl_matrix_free(M);