kml_fft(f/h)_plan_guru64_split_dft_c2r
Create a plan for the n-dimensional C2R transform of multiple data sequences. The data sequence of a single FFT does not need to be contiguous and can be strided. The input and output of the split interfaces are stored in the real and imaginary arrays, respectively. Different from kml_fft(f)_plan_guru_split_dft_r2c, kml_fft(f)_plan_guru64_split_dft_r2c allows some parameters to be 64-bit integers.
Interface Definition
C interface:
kml_fft_plan kml_fft_plan_guru64_split_dft_c2r(int rank, const kml_fft_iodim64 *dims, int howmany_rank, const kml_fft_iodim64 *howmany_dims, double *ri, double *ii, double *out, unsigned flags);
kml_fftf_plan kml_fftf_plan_guru64_split_dft_c2r(int rank, const kml_fftf_iodim64 *dims, int howmany_rank, const kml_fftf_iodim64 *howmany_dims, float *ri, float *ii, float *out, unsigned flags);
kml_ffth_plan kml_ffth_plan_guru64_split_dft_c2r(int rank, const kml_ffth_iodim64 *dims, int howmany_rank, const kml_ffth_iodim64 *howmany_dims, __fp16 *ri, __fp16 *ii, __fp16 *out, unsigned flags);
Fortran interface:
RES = KML_FFT_PLAN_GURU64_SPLIT_DFT_C2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, RI, II, OUT, FLAGS);
RES = KML_FFTF_PLAN_GURU64_SPLIT_DFT_C2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, RI, II, OUT, FLAGS);
RES = KML_FFTH_PLAN_GURU64_SPLIT_DFT_C2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, RI, II, OUT, FLAGS);
Return Value
The function returns a structure pointer of the kml_fft(f/h)_plan type. This object can be passed to the kml_fft(f/h)_execute function as a parameter to perform FFT on the inputs ri and ii and output. You can also pass the object to the kml_fft(f/h)_execute_split_dft_c2r function as a parameter to perform FFT on new inputs ri and ii and output.
If this function returns a non-null pointer, the plan has been successfully created. Otherwise, the plan fails to be created.
Parameters
Parameter |
Data Type |
Description |
Input/Output |
|---|---|---|---|
rank |
int |
Dimension of a single FFT sequence. Constraint: 1 ≤ rank ≤ 3. |
Input |
dims |
|
dims is a structure array whose size is rank. dims[i] contains the following members:
Constraint: dims[i].n ≥ 1, for i in 0 to rank - 1. |
Input |
howmany_rank |
int |
The memory allocation between multiple rank-dimension FFTs is described by the howmany_dims array of the howmany_rank dimension. howmany_rank indicates the number of dimensions required by the memory access mode for the start address of each rank-dimension FFT to be calculated. Constraint: 0 ≤ howmany_rank ≤ 3. |
Input |
howmany_dims |
|
howmany_dims is a structure array whose size is howmany_rank. howmany_dims[i] contains the following members:
|
Input |
ri |
|
Inputs the real part of the data to be transformed. |
Input |
ii |
|
Inputs the imaginary part of the data to be transformed. |
Input |
out |
|
Outputs the data generated using FFT. |
Output |
flags |
unsigned int |
Planning option, which describes the ESTIMATE or PATIENT mode. KML_FFT_ESTIMATE: ESTIMATE mode KML_FFT_PATIENT: PATIENT mode |
Input |
Dependencies
C: "kfft.h"
Examples
C interface:
int rank = 2;
kml_fft_iodim64 *dims;
dims = (kml_fft_iodim64*)kml_fft_malloc(sizeof(kml_fft_iodim64) * rank);
dims[0].n = 2;
dims[0].is = 2;
dims[0].os = 3;
dims[1].n = 3;
dims[1].is = 1;
dims[1].os = 1;
int howmany_rank = 1;
kml_fft_iodim64 *howmany_dims;
howmany_dims = (kml_fft_iodim64*)kml_fft_malloc(sizeof(kml_fft_iodim64) * howmany_rank);
howmany_dims[0].n = 2;
howmany_dims[0].is = 2 * 2;
howmany_dims[0].os = 2 * 3;
double init[8][2] = {{120, 0}, {8, 8}, {0, 0}, {0, 16}, {0, 16}, {-8, 8}, {-8, 0}, {-8, 8}};
double *ri;
ri = (double*)kml_fft_malloc(sizeof(double) * 8);
double *ii;
ii = (double*)kml_fft_malloc(sizeof(double) * 8);
for (int i = 0; i < 8; i++) {
ri[i] = init[i][0];
ii[i] = init[i][1];
}
double *out;
out = (double*)kml_fft_malloc(sizeof(double) * 12);
kml_fft_plan plan;
plan = kml_fft_plan_guru64_split_dft_c2r(rank, dims, howmany_rank, howmany_dims, ri, ii, out, KML_FFT_ESTIMATE);
kml_fft_execute_split_dft_c2r(plan, ri, ii, out);
kml_fft_destroy_plan(plan);
kml_fft_free(howmany_dims);
kml_fft_free(dims);
kml_fft_free(ri);
kml_fft_free(ii);
kml_fft_free(out);
/*
* out = {1.360000e+02, 7.043078e+01, 1.535692e+02, 1.360000e+02,
* 1.258564e+02, 9.814359e+01, -4.000000e+01, -1.971281e+01,
* 3.571281e+01, 8.000000e+00, 8.000000e+00, 8.000000e+00}
*/
Fortran interface:
INTEGER(C_INT) :: RANK = 2
INTEGER(C_INT) :: HOWMANY_RANK = 1
REAL(C_DOUBLE), DIMENSION(8, 2) :: INIT
TYPE(KML_FFT_IODIM64), POINTER :: DIMS(:), HOWMANY_DIMS(:)
REAL(8), POINTER :: RI(:), II(:), OUT(:)
TYPE(C_PTR) :: PRI,PII, POUT, PDIMS, PHOWMANY_DIMS
INTEGER(C_SIZE_T) :: CSIZE, RSIZE
CSIZE = 8 * 8
RSIZE = 8 * 12
PRI = KML_FFT_MALLOC(CSIZE)
PII = KML_FFT_MALLOC(CSIZE)
POUT = KML_FFT_MALLOC(RSIZE)
CALL C_F_POINTER(PRI, IN, SHAPE=[8])
CALL C_F_POINTER(PII, IN, SHAPE=[8])
CALL C_F_POINTER(POUT, OUT, SHAPE=[12])
CSIZE = 24 * 2
RSIZE = 24 * 1
PIODIMS = KML_FFT_MALLOC(CSIZE)
PHOWMANY_DIMS = KML_FFT_MALLOC(RSIZE)
CALL C_F_POINTER(PIODIMS, DIMS, SHAPE=[2])
CALL C_F_POINTER(PHOWMANY_DIMS, HOWMANY_DIMS, SHAPE=[1])
DIMS(0)%N = 2
DIMS(0)%IS = 2
DIMS(0)%OS = 3
DIMS(1)%N = 3
DIMS(1)%IS = 1
DIMS(1)%OS = 1
HOWMANY_DIMS(0)%N = 2
HOWMANY_DIMS(0)%IS = 2 * 2
HOWMANY_DIMS(0)%OS = 2 * 3
DATA INIT/120, 8, 0, 0, 0, -8, -8, -8, 0, 8, 0, 16, 16, 8, 0, 8/
INTEGER :: I = 1
DO WHILE(I <= 8)
RI(I) = INIT(I, 0)
II(I) = INIT(I, 1)
I = I + 1
END DO
TYPE(C_PTR) :: PLAN
PLAN = KML_FFT_PLAN_GURU64_SPLIT_DFT_C2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, RI, II, OUT, KML_FFT_ESTIMATE)
CALL KML_FFT_EXECUTE_SPLIT_DFT_C2R(PLAN, RI, II, OUT);
CALL KML_FFT_DESTROY_PLAN(PLAN)
CALL KML_FFT_FREE(PHOWMANY_DIMS)
CALL KML_FFT_FREE(PDIMS)
CALL KML_FFT_FREE(PRI)
CALL KML_FFT_FREE(PII)
CALL KML_FFT_FREE(POUT)
!
! OUT = /1.360000E+02, 7.043078E+01, 1.535692E+02, 1.360000E+02,
! 1.258564E+02, 9.814359E+01, -4.000000E+01, -1.971281E+01,
! 3.571281E+01, 8.000000E+00, 8.000000E+00, 8.000000E+00/
!