From 4e75c6d1eac51fe2731a59eb11e099b9a8e9eb99 Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Thu, 4 Jun 2020 12:35:13 -0400 Subject: [PATCH] move openmp to main loop --- numerical_methods/durand_kerner_roots.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/numerical_methods/durand_kerner_roots.cpp b/numerical_methods/durand_kerner_roots.cpp index 424319329..a714e8f1b 100644 --- a/numerical_methods/durand_kerner_roots.cpp +++ b/numerical_methods/durand_kerner_roots.cpp @@ -46,9 +46,9 @@ std::complex poly_function(const std::valarray &coeffs, double real = 0.f, imag = 0.f; int n; -#ifdef _OPENMP -#pragma omp parallel for reduction(+ : real, imag) -#endif + // #ifdef _OPENMP + // #pragma omp parallel for reduction(+ : real, imag) + // #endif for (n = 0; n < coeffs.size(); n++) { std::complex tmp = coeffs[n] * std::pow(x, coeffs.size() - n - 1); @@ -132,6 +132,9 @@ std::pair durand_kerner_algo( if (log_file.is_open()) log_file << "\n" << iter << ","; +#ifdef _OPENMP +#pragma omp for +#endif for (n = 0; n < degree - 1; n++) { std::complex numerator, denominator; numerator = poly_function(coeffs, (*roots)[n]);