From e6dacb4d18e374989e2acd812921f59835824273 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Sun, 21 Apr 2024 14:02:28 +0900 Subject: [PATCH] Minor refactoring --- c/reciprocal_to_normal.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/c/reciprocal_to_normal.c b/c/reciprocal_to_normal.c index f3a275ce..d061999c 100644 --- a/c/reciprocal_to_normal.c +++ b/c/reciprocal_to_normal.c @@ -34,11 +34,13 @@ #include "reciprocal_to_normal.h" +#ifdef MULTITHREADED_BLAS #if defined(MKL_LAPACKE) || defined(SCIPY_MKL_H) #include #else #include #endif +#endif #include #include #include @@ -55,11 +57,13 @@ static double get_fc3_sum(const lapack_complex_double *e0, const lapack_complex_double *e2, const lapack_complex_double *fc3_reciprocal, const long num_band); +#ifdef MULTITHREADED_BLAS static double get_fc3_sum_blas(const lapack_complex_double *e0, const lapack_complex_double *e1, const lapack_complex_double *e2, const lapack_complex_double *fc3_reciprocal, const long num_band); +#endif static double get_fc3_sum_blas_like(const lapack_complex_double *e0, const lapack_complex_double *e1, const lapack_complex_double *e2, @@ -153,6 +157,7 @@ void reciprocal_to_normal_squared( if (freqs0[band_indices[g_pos[i][0]]] > cutoff_frequency && freqs1[g_pos[i][1]] > cutoff_frequency && freqs2[g_pos[i][2]] > cutoff_frequency) { +#ifdef MULTITHREADED_BLAS if (use_multithreaded_blas) { fc3_normal_squared[g_pos[i][3]] = get_fc3_sum_blas(e0 + band_indices[g_pos[i][0]] * num_band, @@ -162,6 +167,7 @@ void reciprocal_to_normal_squared( (freqs0[band_indices[g_pos[i][0]]] * freqs1[g_pos[i][1]] * freqs2[g_pos[i][2]]); } else { +#endif fc3_normal_squared[g_pos[i][3]] = get_fc3_sum_blas_like( e0 + band_indices[g_pos[i][0]] * num_band, @@ -169,7 +175,9 @@ void reciprocal_to_normal_squared( e2 + g_pos[i][2] * num_band, fc3_reciprocal, num_band) / (freqs0[band_indices[g_pos[i][0]]] * freqs1[g_pos[i][1]] * freqs2[g_pos[i][2]]); +#ifdef MULTITHREADED_BLAS } +#endif } else { fc3_normal_squared[g_pos[i][3]] = 0; } @@ -224,6 +232,7 @@ static double get_fc3_sum(const lapack_complex_double *e0, return (sum_real * sum_real + sum_imag * sum_imag); } +#ifdef MULTITHREADED_BLAS static double get_fc3_sum_blas(const lapack_complex_double *e0, const lapack_complex_double *e1, const lapack_complex_double *e2, @@ -259,6 +268,7 @@ static double get_fc3_sum_blas(const lapack_complex_double *e0, lapack_complex_double_imag(retval) * lapack_complex_double_imag(retval); } +#endif static double get_fc3_sum_blas_like(const lapack_complex_double *e0, const lapack_complex_double *e1,