- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include <iostream>
#include "mkl_dfti.h"
int main()
{
using namespace std;
complex <float>x[32];
int i;
DFTI_DESCRIPTOR_HANDLE my_desc1_handle;
MKL_LONG status;
{
x = ((i+1)*1.0, (i+1)*1.0);
}
status = DftiCommitDescriptor(my_desc1_handle);
status = DftiComputeForward(my_desc1_handle, x);
status = DftiFreeDescriptor(&my_desc1_handle);
{
cout << x << endl;
}
}
USE MKL_DFTI
IMPLICIT NONE
Complex :: X(32)
INTEGER :: I
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle
Integer :: Status
DO I=1,32
X(I)=CMPLX(1d0*i,1d0*i)
END DO
Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_SINGLE, DFTI_COMPLEX, 1, 32 )
Status = DftiCommitDescriptor( My_Desc1_Handle )
Status = DftiComputeForward( My_Desc1_Handle, X )
Status = DftiFreeDescriptor(My_Desc1_Handle)
DO I=1,32
write(*,*)x(i)
END DO
END
(-16,162.451) (-178.4507,146.4507)
(-16,80.4374) (-96.43743,64.43743)
(-16,52.7449) (-68.74493,36.74493)
(-16,38.6274) (-54.62742,22.62742)
(-16,29.9339) (-45.93389,13.93389)
(-16,23.9457) (-39.94569,7.945690)
(-16,19.4961) (-35.49606,3.496048)
(-16,16) (-32.00000,0.0000000E+00)
(-16,13.1309) (-29.13086,-2.869139)
(-16,10.6909) (-26.69086,-5.309141)
(-16,8.55218) (-24.55218,-7.447823)
(-16,6.62742) (-22.62742,-9.372583)
(-16,4.85355) (-20.85354,-11.14646)
(-16,3.1826) (-19.18260,-12.81741)
(-16,1.57586) (-17.57586,-14.42414)
(-16,0) (-16.00000,-16.00000)
(-16,-1.57586) (-14.42414,-17.57586)
(-16,-3.18259) (-12.81741,-19.18260)
(-16,-4.85355) (-11.14646,-20.85355)
(-16,-6.62742) (-9.372583,-22.62742)
(-16,-8.55217) (-7.447824,-24.55218)
(-16,-10.6909) (-5.309142,-26.69086)
(-16,-13.1309) (-2.869135,-29.13086)
(-16,-16) (0.0000000E+00,-32.00000)
(-16,-19.4961) (3.496052,-35.49606)
(-16,-23.9457) (7.945692,-39.94569)
(-16,-29.9339) (13.93390,-45.93390)
(-16,-38.6274) (22.62742,-54.62742)
(-16,-52.7449) (36.74493,-68.74493)
(-16,-80.4374) (64.43743,-96.43742)
(-16,-162.451) (146.4507,-178.4507)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please also change initialization of the input array as follows?
for (i = 0; i < 32; i++)
{
x = std::complex<float>((i+1)*1.0,(i+1)*1.0);
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Zonglin G!
Could you please check if casting 32 to MKL_LONG in the C++ code fixes the problem?
DftiCreateDescriptor is variadic, so the compiler cannot do this cast for you.
Evgueni.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Evgueni Petrov aka espetrov (Intel) wrote:
Hi Zonglin G!
Could you please check if casting 32 to MKL_LONG in the C++ code fixes the problem?
DftiCreateDescriptor is variadic, so the compiler cannot do this cast for you.
Evgueni.
Thank you very much for your reply!
I happen to be a beginner. So I'm wondering if you could be more specific?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please add (MKL_LONG) so that DftiCreateDescriptor is called as follows?
status = DftiCreateDescriptor(&my_desc1_handle, DFTI_SINGLE, DFTI_COMPLEX, 1, (MKL_LONG)32);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Evgueni Petrov aka espetrov (Intel) wrote:
Could you please add (MKL_LONG) so that DftiCreateDescriptor is called as follows?
status = DftiCreateDescriptor(&my_desc1_handle, DFTI_SINGLE, DFTI_COMPLEX, 1, (MKL_LONG)32);
Thank you for your patience with me.
I tried your suggestion, but the problem remains.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please also change initialization of the input array as follows?
for (i = 0; i < 32; i++)
{
x = std::complex<float>((i+1)*1.0,(i+1)*1.0);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Evgueni Petrov aka espetrov (Intel) wrote:
Could you please also change initialization of the input array as follows?
for (i = 0; i < 32; i++)
{
x = std::complex<float>((i+1)*1.0,(i+1)*1.0);
}
Yes, it works now!
I really appreicate your help!
But why should we explicitly specify "std::"? Is it meant to avoid some conflicts of name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, std:: can be omitted since 'using namespace std;' is present.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page