Ben birçok şeyi test sona erdi ve nihayet ben ne istersem bu üç fonksiyon ile sona erdi ve ben basit örnekler olarak gördüğünü.
Bazı girdilere karşı test ettim ve iyi sonuçlar aldım. Yine de kapsamlı bir test yapmamıştım.
//Note after each operation status should be 0 on success
std::vector<std::complex<float>> fft_complex(std::vector<std::complex<float>>& in){
std::vector<std::complex<float>> out(in.size());
DFTI_DESCRIPTOR_HANDLE descriptor;
MKL_LONG status;
status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 1, in.size()); //Specify size and precision
status = DftiSetValue(descriptor, DFTI_PLACEMENT, DFTI_NOT_INPLACE); //Out of place FFT
status = DftiCommitDescriptor(descriptor); //Finalize the descriptor
status = DftiComputeForward(descriptor, in.data(), out.data()); //Compute the Forward FFT
status = DftiFreeDescriptor(&descriptor); //Free the descriptor
return out;
}
std::vector<std::complex<float>> fft_real(std::vector<float>& in_real){
std::vector<std::complex<float>> in(in_real.size());
std::copy(in_real.begin(), in_real.end(), in.begin());
return fft_complex(in);
}
std::vector<float> ifft(std::vector<std::complex<float>>& in){
std::vector<std::complex<float>> out(in.size());
DFTI_DESCRIPTOR_HANDLE descriptor;
MKL_LONG status;
status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 1, in.size()); //Specify size and precision
status = DftiSetValue(descriptor, DFTI_PLACEMENT, DFTI_NOT_INPLACE); //Out of place FFT
status = DftiSetValue(descriptor, DFTI_BACKWARD_SCALE, 1.0f/in.size()); //Scale down the output
status = DftiCommitDescriptor(descriptor); //Finalize the descriptor
status = DftiComputeBackward(descriptor, in.data(), out.data()); //Compute the Forward FFT
status = DftiFreeDescriptor(&descriptor); //Free the descriptor
std::vector<float> output(out.size());
for(std::size_t i = 0; i < out.size(); ++i){
output[i] = out[i].real();
}
return output;
}
Sana [bu örnekler] kastediyoruz varsaymak istiyorum (https://software.intel.com/en-us/node/471390), belki daha spesifik "C Arayüz" olanlar. Eğer durum buysa, beraberindeki üst kısmında (https://software.intel.com/en-us/node/470818#8EB0A29C-06D8-4C97-ACD0-C8A320501A6A) bağlantısını [Fourier İşlevleri Transform] mutlaka okuyun. – SleuthEye
@SleuthEye Evet, onlara atıfta bulundu. Şahsen bu şişirilmiş örnekleri yararlı bulmuyorum, ama muhtemelen başkaları için yeterli. Daha basit örnekler bulmak isterim. Görünüşe göre muhtemelen onlarla yapmak zorundayım. –
Ben resmi örneklerini kontrol devam etti ama bazıları bile Başlamak için gerçekten iyi bir yol değildir ... derlemek yok ... –