kml_fft(f)_plan_guru64_r2r
The data sequence of a single FFT does not need to be contiguous and can cross steps. Different from kml_fft_plan_guru_dft, kml_fft_plan_guru64_dft allows some parameters to be 64-bit integers.
Interface Definition
kml_fft_plan kml_fft_plan_guru64_r2r(int rank, const kml_fft_iodim64 *dims, int howmany_rank, const kml_fft_iodim64 *howmany_dims, double *in, double *out, const kml_fft_r2r_kind *kind, unsigned flags);
kml_fftf_plan kml_fftf_plan_guru64_r2r(int rank, const kml_fftf_iodim64 *dims, int howmany_rank, const kml_fftf_iodim64 *howmany_dims, float *in, float *out, const kml_fftf_r2r_kind *kind, unsigned flags);
Fortran interface:
RES = KML_FFT_PLAN_GURU64_DFT_R2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, IN, OUT, KIND, FLAGS);
RES = KML_FFTF_PLAN_GURU64_DFT_R2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, IN, OUT, KIND, FLAGS);
KML_FFT_REDFT11 and KML_FFT_ROODFT11 support only sequences whose length is an integer multiple of 4. Other transforms support only sequences whose length is an integer multiple of 2.
Return Value
The function returns a structure pointer of the kml_fft(f)_plan type. This object is used as a parameter in the kml_fft(f)_execute function to perform FFT on the current input and output. In addition, the object may also be added into the kml_fft(f)_execute_r2r function as a parameter to perform FFT on the new input and output.
If this function returns a non-null pointer, the plan has been successfully executed. Otherwise, the plan failed to be executed.
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 of 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 |
in |
|
Inputs the data to be transformed. |
Input |
out |
|
Outputs the data generated using FFT. |
Output |
kind |
|
kind is an array whose size is rank, including the R2R transform type in each dimension of an FFT sequence. kind[i] (for i in 0 to rank - 1) has the following options:
|
Input |
flags |
unsigned int |
A planning option, not in use. |
Input |
Dependencies
C: "kfft.h"
Fortran: "kfft.f03"
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 = 2;
dims[1].n = 2;
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 * 2;
double init[8] = {120, 0, 8, 8, 0, 0, 0, 16};
double *in;
in = (double*)kml_fft_malloc(sizeof(double) * 8);
for (int i = 0; i < 8; i++) {
in[i] = init[i];
}
double *out;
out = (double*)kml_fft_malloc(sizeof(double) * 8);
kml_fft_r2r_kind *kind;
kind = (kml_fft_r2r_kind*)kml_fft_malloc(sizeof(kml_fft_r2r_kind) * rank);
kind[0] = KML_FFT_DHT;
kind[1] = KML_FFT_REDFT01;
kml_fft_plan plan;
plan = kml_fft_plan_guru64_r2r(rank, dims, howmany_rank, howmany_dims, in, out, kind, KML_FFT_ESTIMATE);
kml_fft_execute_r2r(plan, in, out);
kml_fft_destroy_plan(plan);
kml_fft_free(howmany_dims);
kml_fft_free(dims);
kml_fft_free(kind);
kml_fft_free(in);
kml_fft_free(out);
/*
* out = {1.393137e+02, 1.166863e+02, 1.006863e+02, 1.233137e+02,
* 2.262742e+01, -2.262742e+01, -2.262742e+01, 2.262742e+01}
*/
Fortran interface:
INTEGER(C_INT) :: RANK = 2
INTEGER(C_INT) :: KIND(2)
INTEGER(C_INT) :: HOWMANY_RANK = 1
TYPE(KML_FFT_IODIM64), POINTER :: DIMS(:), HOWMANY_DIMS(:)
REAL(C_DOUBLE), DIMENSION(8) :: INIT
TYPE(C_DOUBLE), POINTER :: IN(:), OUT(:)
TYPE(C_PTR) :: PIN, POUT, PDIMS, PHOWMANY_DIMS
INTEGER(C_SIZE_T) :: SIZE1, SIZE2, SIZE3
SIZE1 = 8 * 12
SIZE3 = 24 * RANK
SIZE4 = 24 * HOWMANY_RANK
PDIMS = KML_FFT_MALLOC(SIZE2)
PHOWMANY_DIMS = KML_FFT_MALLOC(SIZE3)
PIN = KML_FFT_MALLOC(SIZE1)
POUT = KML_FFT_MALLOC(SIZE1)
CALL C_F_POINTER(PIN, IN, SHAPE=[8])
CALL C_F_POINTER(POUT, OUT, SHAPE=[8])
CALL C_F_POINTER(PDIMS, DIMS, SHAPE=[RANK])
CALL C_F_POINTER(PHOWMANY_DIMS, HOWMANY_DIMS, SHAPE=[HOWMANY_RANK])
DIMS(0)%N = 2
DIMS(0)%IS = 2
DIMS(0)%OS = 2
DIMS(1)%N = 2
DIMS(1)%IS = 1
DIMS(1)%OS = 1
HOWMANY_DIMS(0)%N = 2
HOWMANY_DIMS(0)%IS = 2 * 2
HOWMANY_DIMS(0)%OS = 2 * 2
DATA INIT/120, 0, 8, 8, 0, 0, 0, 16/
INTEGER :: I
DO WHILE(I <= 8)
IN(I) = INIT(I)
END DO
KIND(0) = KML_FFT_DHT
KIND(1) = KML_FFT_REDFT01
TYPE(C_PTR) :: PLAN
PLAN = KML_FFT_PLAN_GURU4_R2R(RANK, DIMS, HOWMANY_RANK, HOWMANY_DIMS, IN, OUT, KIND, KML_FFT_ESTIMATE)
CALL KML_FFT_EXECUTE_R2R(PLAN, IN, OUT)
CALL KML_FFT_DESTROY_PLAN(PLAN)
CALL KML_FFT_FREE(PHOWMANY_DIMS)
CALL KML_FFT_FREE(PDIMS)
CALL KML_FFT_FREE(PIN)
CALL KML_FFT_FREE(POUT)
!
! OUT = /1.393137E+02, 1.166863E+02, 1.006863E+02, 1.233137E+02,
! 2.262742E+01, -2.262742E+01, -2.262742E+01, 2.262742E+01/
!