I have this code, but I need help to use OpenMP [code]#pragma[/code]s to increase its speed. I want to parallelize the [code]for[/code] loops over variables [code]i[/code] and [code]j[/code]. The values of [code]n[/code] and [code]m[/code] can be much larger, too. For example, [code]n = 1000[/code], [code]m = 500[/code]. My code: [code]for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { matrix[i][j] = {static_cast(distribution(gen)), static_cast(distribution(gen))}; } }
#pragma omp parallel { n = 50; m = 50; ReS = 0; ImS = 0;
for (int nu = 0; nu < 1; nu++) { #pragma omp for num_threads(4) for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { double* matrixPtr = &matrix[i][j].first; double* matrixPtrSecond = &matrix[i][j].second;