Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

MKL FFT Fortran in Test Code - Transformed Values are not correct

$
0
0

Hello!

I was trying to learn about the MKL's FFT Function and wrote a small 1D program to show the forward transformed values. From my understanding, the arguments for the forward function - mentioned in the comment in the program (italicised and not in bold) - should be right and it should perform fine. 

When I try to run this, I get 0 as my transformed value (the array y1). Now I am confused about why that happens and what the error in the code is for me to get this error. 

Could someone help me to understand the issue? 

I am attaching the program file(test.f90), the executable link file (link1.txt - might have to use chmod 700) and the output text file (text.txt).

Thanks!

- Adhyanth

PROGRAM test
!   IMPLICIT NONE
   USE MKL_DFTI
   REAL(KIND = DFTI_DPKP), DIMENSION(201) :: x,y,z
   COMPLEX(KIND = DFTI_DPKP), DIMENSION(201) ::x1, y1
   INTEGER :: i, status
   TYPE(DFTI_DESCRIPTOR), POINTER :: plan
   plan => null()
DO i=1,201
   x(i) = REAL(i-101)/100
   y(i)= 5*SIN(2*x(i))
END DO

OPEN(9, file='text.txt', form = 'FORMATTED')
WRITE(9,*) 'Y values'
WRITE(9,*) y
status = dfti_create_descriptor_1d(plan, DFTI_DOUBLE, DFTI_COMPLEX, 1, 200)
status = dfti_commit_descriptor_external(plan)
DO i=1,201
status = dfti_compute_forward_dz(plan, y(i), y1(i))

!Using the(desc,xreinout,ximinout) argument format
ENDDO
status = dfti_free_descriptor_external(plan)
WRITE(9,*) 'Y1 Values'
WRITE(9,*) y1
WRITE(9,*) 'Y values - After Transform'
WRITE(9,*) y

END PROGRAM test

AttachmentSize
Downloadtext/plaintext.txt19.22 KB
Downloadapplication/octet-streamtest.f90805 bytes
Downloadtext/plainlink1.txt223 bytes

Viewing all articles
Browse latest Browse all 2652

Trending Articles