From 30d95fcca76e0c350b85fd5ee0f5a6f33b435bc3 Mon Sep 17 00:00:00 2001 From: Christian J Krueger Date: Wed, 3 Jun 2020 12:25:32 +0200 Subject: [PATCH 1/2] fix pathological case in householdercomplex.c The pathological case of 1 dimension in gsl_linalg_complex_householder_hv() is treated individually. --- linalg/householdercomplex.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/linalg/householdercomplex.c b/linalg/householdercomplex.c index 3953c481..0cb832ba 100644 --- a/linalg/householdercomplex.c +++ b/linalg/householdercomplex.c @@ -123,6 +123,19 @@ gsl_linalg_complex_householder_hv (gsl_complex tau, const gsl_vector_complex * v if (GSL_REAL(tau) == 0.0 && GSL_IMAG(tau) == 0.0) return GSL_SUCCESS; + /* treat the N=1 case separately */ + if (N == 1) + { + gsl_complex w0 = gsl_vector_complex_get(w, 0); + gsl_complex tz = gsl_complex_mul(tau, w0); + gsl_complex ntz = gsl_complex_negative(tz); + gsl_complex w0ntz = gsl_complex_add(w0, ntz); + + gsl_vector_complex_set(w, 0, w0ntz); + + return GSL_SUCCESS; + } + { /* compute z = v'w */ -- 2.11.0