mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-11-03 22:34:47 +08:00
bugfix: move file writing outside of the parallel loop
othersie, there is no gurantee of the order of roots written to file
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
* \f$x^4-1=0\f$:\n
|
||||
* 
|
||||
*
|
||||
* 
|
||||
*/
|
||||
@@ -168,18 +169,16 @@ std::pair<uint32_t, double> durand_kerner_algo(
|
||||
#pragma omp critical
|
||||
#endif
|
||||
tol_condition = std::max(tol_condition, std::abs(std::abs(delta)));
|
||||
|
||||
if (log_file.is_open())
|
||||
#ifdef _OPENMP
|
||||
#pragma omp critical
|
||||
#endif
|
||||
log_file << complex_str((*roots)[n]) << ",";
|
||||
}
|
||||
// tol_condition /= (degree - 1);
|
||||
|
||||
if (break_loop)
|
||||
break;
|
||||
|
||||
if (log_file.is_open())
|
||||
for (n = 0; n < roots->size(); n++)
|
||||
log_file << complex_str((*roots)[n]) << ",";
|
||||
|
||||
#if defined(DEBUG) || !defined(NDEBUG)
|
||||
if (iter % 500 == 0) {
|
||||
std::cout << "Iter: " << iter << "\t";
|
||||
|
||||
Reference in New Issue
Block a user