Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

problem with complex DFT with split arrays

supersteveee
Beginner
865 Views
Hi!

I try to implement a DFT of an image (so a 2 dimensional DFT) with split arrays (one array for the real part of a complex number - one array for the complex part). The DFT should be performed not inplace. The array is alligned so that i get the (i,j)th element by array(i*m_Step+j). The arrays are of type float (actually they are allocated with ippimalloc_32f). I use MKL721 (trial version). I searched through the web, the manual and this forum, but somehow I couldnt make my code working:

DFTI_DESCRIPTOR_HANDLE l_Desc=0;
long l_Stride[3];
l_Stride[0] = 0;
l_Stride[1] = m_Step;
l_Stride[2] = 1;
long l_Length[2];
l_Length[0] = m_Height;
l_Length[1] = m_Width;

long l_Status = DftiCreateDescriptor( &l_Desc, DFTI_SINGLE, DFTI_COMPLEX, 2, l_Length );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}
DftiSetValue(l_Desc, DFTI_INPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_OUTPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
DftiSetValue(l_Desc, DFTI_COMPLEX_STORAGE, DFTI_REAL_REAL );

l_Status = DftiCommitDescriptor( l_Desc );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}

if( DFTI_NO_ERROR != DftiComputeForward(l_Desc, lp_ImageReal->mp_ImageBuffer, lp_ImageImag->mp_ImageBuffer,
lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer ) ){
std::cerr << "Forward error!" << std::endl;
}

if( DFTI_NO_ERROR != DftiComputeBackward(l_Desc, lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer,
lp_ResultReal->mp_ImageBuffer, lp_ResultImag->mp_ImageBuffer ) ){
std::cerr << "Backward error!" << std::endl;
}

DftiFreeDescriptor(&l_Desc);

what did I do wrong? *Real is always the real part array and *Imag respectivly the imaginary part.
Another question: is dfti of mkl or the dft of IPP faster?
Thanks in advance,
Stefan Hinterstoisser
0 Kudos
2 Replies
Intel_C_Intel
Employee
865 Views
Stefan, I am going to ask Nadya to respond to the first part of your question. As to the relative speed of MKL vs IPP, except for quite small transforms their speed is essentially the same since they both use IPP kernels. Bruce
0 Kudos
nadezhda
Beginner
865 Views
Stefan,
DFT interface doesn't support split arrays now. There is this functionality in DFT documentation but one doesn't implemented. You can see about DFT limitations in mklnotes.htm, Known limitations chapter.
Unfortunately we don't plan to add this possibility in the nearest version and we are going to delete it from DFT documentation. We can use FFT MKL interface for split tight arrays with length order of 2.
Any way you canmake requestfor this functionality. It is important for us to know about customer needs.
Thanks,
Nadezhda
0 Kudos
Reply