From f7d224e4e579130fa0c05fd89fd4bd4127fee862 Mon Sep 17 00:00:00 2001
From: "patrick.godwin" <patrick.godwin@ligo.org>
Date: Fri, 1 Oct 2021 11:32:54 -0400
Subject: [PATCH] gstlal_autocorrelation_chi2.c: modify use of
 GSL_REAL/GSL_IMAG for GSL 2.7 compatibility

---
 gstlal/lib/gstlal/gstlal_autocorrelation_chi2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gstlal/lib/gstlal/gstlal_autocorrelation_chi2.c b/gstlal/lib/gstlal/gstlal_autocorrelation_chi2.c
index 66810ca122..60d4446dd5 100644
--- a/gstlal/lib/gstlal/gstlal_autocorrelation_chi2.c
+++ b/gstlal/lib/gstlal/gstlal_autocorrelation_chi2.c
@@ -490,7 +490,9 @@ gsl_vector *gstlal_bankcorrelation_chi2_compute_norms(const gsl_matrix_complex *
 	for(channel = 0; channel < channels; channel++) {
 		norms = 2*channels;
 		for(i = 0; i < channels; i++) {
-			cij = ((float) GSL_REAL(gsl_matrix_complex_get(bankcorrelation_matrix, i, channel)) + (float) GSL_IMAG(gsl_matrix_complex_get(bankcorrelation_matrix, i, channel)) * I);
+			gsl_complex coeff;
+			coeff = gsl_matrix_complex_get(bankcorrelation_matrix, i, channel);
+			cij = ((float) GSL_REAL(coeff) + (float) GSL_IMAG(coeff) * I);
 			norms -= 0.5*conjf(cij)*cij;
 		}
 		gsl_vector_set(norm, channel, norms);
@@ -524,10 +526,12 @@ unsigned gstlal_bankcorrelation_chi2_from_peak_float(float *out, struct gstlal_p
 		if (snr[i] == 0) continue;
 		for (j = 0; j < state->channels; j++)
 		{
+			gsl_complex coeff;
 			index = (state->samples[i]) * state->channels + j;
 			snrj = *(data + index);
 			// Normalization of cij is in svd_bank.py. Phase must be (+).
-			cij = ((float) GSL_REAL(gsl_matrix_complex_get(bcmat, i, j)) + (float) GSL_IMAG(gsl_matrix_complex_get(bcmat, i, j)) * I);
+			coeff = gsl_matrix_complex_get(bcmat, i, j);
+			cij = ((float) GSL_REAL(coeff) + (float) GSL_IMAG(coeff) * I);
 			// 0.5 is necessary due to the template normalization gstlal uses.
 			xij = 0.5 * snr[i] * cij - snrj;
 			out[i] += conjf(xij) * xij;
-- 
GitLab