如何在FFT函数上设置线程

我有一个代码必须使用Posix标准进行多线程快速傅里叶变换,但是我无法为正确的输出设置正确的条件         我使用posix标准和Linux操作系统         我注意到顺序解决方案有效。
    我已经在main函数上创建了线程。     谢谢您的帮助!

 void* transform()
    {
        pthread_mutex_lock(&lock);
         int thread_part = part++;
    int start=thread_part * (N / NumThreads);
    int stop=(thread_part + 1) * (N / NumThreads);
     int logstart=thread_part * (Log2N / NumThreads);
     int logstop=(thread_part + 1) * (Log2N / NumThreads);

        for (int j = start; j < stop; j++)
            AlfaVec[j] = BetaVec[j];

         if(start==0)
        {

                for (int i = start+2; i < stop / 2; i++)
                    W[i] = cpow(W[1],(double)i);

        }
        else
        {
            for (int i = start/2; i < stop / 2; i++)
                    W[i] = cpow(W[1],(double)i);
        }

        int n = 1;
        int a = N / 2;

        for (int j = logstart; j < logstop; j++) {//This is the bad code section,where the function doesn't do the right operations
            for (int i = start ; i < stop; i++) {
                if (!(i & n)) {
                    double complex temp = AlfaVec[i];
                    double complex Temp = W[(i * a) % (n * a)] * AlfaVec[i + n];
                    AlfaVec[i] = temp + Temp;
                    AlfaVec[i + n]  = temp - Temp;
                }
            }
            n *= 2;
            a = a / 2;
        }

     pthread_mutex_unlock(&lock);
    }
chuandahan 回答:如何在FFT函数上设置线程

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3170137.html

大家都在问