Commits

Aldo Culquicondor committed 28e1f75

Mejorando especificación de paralelismo

Comments (0)

Files changed (1)

         auto Wm = exp(complex<long double>(0, (inv?1:-1)*2.0*PI/m));
         size_t k, j;
         complex<long double> w, t, u;
-#pragma omp parallel for default(none) shared(X,n,m,Wm) private(k,j,w,t,u)
-        for(k=0; k<n; k+=m) {
-            //Este bucle puede ser paralelizado
-            #ifdef DEBUG
-            printf(" Executed by %d\n", omp_get_thread_num());
-            #endif
-            w = complex<long double> (1, 0);
-            for(j=0; j<m/2; j++) {
-                t = w*X[k+j+m/2];
-                u = X[k+j];
-                X[k+j] = u+t;
-                X[k+j+m/2] = u-t;
-                w *= Wm;
+        #pragma omp parallel shared(X,n,m,Wm) private(k,j,w,t,u)
+        {
+            #pragma omp for
+            for(k=0; k<n; k+=m) {
+                //Este bucle puede ser paralelizado
+                #ifdef DEBUG
+                printf(" Executed by %d\n", omp_get_thread_num());
+                #endif
+                w = complex<long double> (1, 0);
+                for(j=0; j<m/2; j++) {
+                    t = w*X[k+j+m/2];
+                    u = X[k+j];
+                    X[k+j] = u+t;
+                    X[k+j+m/2] = u-t;
+                    w *= Wm;
+                }
             }
         }
     }