|
以下代码仅举例
你需要在工程属性里修改 library 使用 MKL 库
项目(或工程菜单),属性,然后按图设置:
[Fortran] 纯文本查看 复制代码 04 | Type , public :: CLS_FFT |
05 | type ( DFTI_DESCRIPTOR ) , Pointer :: h = > NULL ( ) |
16 | Subroutine Create ( this , N ) |
17 | class ( CLS_FFT ) :: this |
18 | Integer , Intent ( IN ) :: N |
19 | this % Err = DftiCreateDescriptor ( this % h , DFTI_SINGLE , DFTI_REAL , 1 , N ) |
20 | this % Err = DftiSetValue ( this % h , DFTI_PLACEMENT , DFTI_NOT_INPLACE ) |
21 | this % Err = DftiCommitDescriptor ( this % h ) |
24 | Function Forward ( this , X ) result ( F ) |
25 | class ( CLS_FFT ) :: this |
27 | Complex :: F ( size ( X ) / 2 +1 ) |
28 | this % Err = DftiComputeForward ( this % h , X , F ) |
31 | Function Backward ( this , X ) result ( T ) |
32 | class ( CLS_FFT ) :: this |
34 | Real :: T ( size ( X ) * 2 -1 ) |
35 | this % Err = DftiComputeBackward ( this % h , X , T ) |
38 | Subroutine Destory ( this ) |
39 | class ( CLS_FFT ) :: this |
40 | this % Err = DftiFreeDescriptor ( this % h ) |
41 | End Subroutine Destory |
48 | Type ( CLS_FFT ) :: FFT |
49 | Integer , parameter :: N = 30 |
51 | [ 3 , 2 , 4 , 6 , 2 , 5 , 7 , 8 , 5 , 3 , 7 , 8 , 4 , 2 , 4 , 7 , 8 , 9 , 3 , 2 , 5 , 7 , 8 , 4 , 2 , 5 , 8 , 9 , 4 , 6 ] |
57 | Write ( * , * ) i , f ( i ) |
59 | r = FFT % Backward ( f ) / n |
62 | Write ( * , * ) i , r ( i ) |
|
|