Rate This Document
Findability
Accuracy
Completeness
Readability

kml_ffth_plan_many_dft_scale

Create a plan for the n-dimensional C2C transform of howmany data sequences. The data sequence of a single FFT does not need to be contiguous and can be strided.

Interface Definition

C interface:

kml_ffth_plan kml_ffth_plan_many_dft_scale(int rank, const int *n, int howmany, kml_ffth_complex *in, const int *inembed, int istride, int idist, kml_ffth_float_complex *out, const int *onembed, int ostride, int odist, int sign, unsigned flags);

Return Value

The function returns a structure pointer of the kml_ffth_plan type. This object can be passed to the kml_fft(f/h)_execute function as a parameter to perform FFT on the current input and output. You can also pass the object to the kml_ffth_execute_dft_scale function as a parameter to perform FFT on new input 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 FFT. The constraint is 1 ≤ rank ≤ 4.

Input

n

const int*

Indicates an array whose dimension is rank, including the size of each dimension in the FFT sequence. The constraint is n[i] ≥ 1, for i in 0, rank - 1.

Input

howmany

int

Indicates how many multi-dimensional FFTs are needed.

Input

in

  • kml_ffth_complex*

Inputs the data to be transformed.

Input

inembed

const int*

An array whose size is rank or NULL. This array indicates the size of each dimension of a larger space for input FFT data storage.

Constraint: inembed[i] ≥ n[i] for i in 0, rank-1. Or if inembed == NULL, inembed is equal to n.

Input

istride

int

Interval between successive elements of the i-th dimensional FFT input sequence.

Input

idist

int

Indicates the interval between FFT input sequences.

Input

out

  • kml_ffth_float_complex*

Outputs the data generated using FFT.

Output

onembed

const int*

An array whose size is rank or NULL. This array indicates the size of each dimension of a larger space for output FFT data storage.

Constraint: onembed[i] ≥ n[i] for i in 0, rank-1. Or if onembed == NULL, onembed is equal to n.

Input

ostride

int

Interval between successive elements of the i-th dimensional FFT output sequence.

Input

odist

int

Indicates the interval between FFT output sequences.

Input

sign

int

Specifies forward or backward transform.

  • -1(KML_FFT_FORWARD): forward
  • +1(KML_FFT_BACKWARD): backward

Input

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 = 1; 
    int *n; 
    n = (int*)kml_ffth_malloc(sizeof(int) * rank); 
    n[0] = 2; 
    int howmany = 3; 
    int istride = 1; 
    int ostride = 1; 
    int idist = 2; 
    int odist = 2; 
    __fp16 init[6][2] = {{120, 0}, {8, 8}, {0, 0}, {0, 16}, {0, 16}, {-8, 8}}; 
    kml_ffth_complex *in; 
    in = (kml_ffth_complex*)kml_ffth_malloc(sizeof(kml_ffth_complex) * 6); 
    for (int i = 0; i < 6; i++) { 
        in[i][0] = init[i][0]; 
        in[i][1] = init[i][1]; 
    } 
    kml_ffth_float_complex *out; 
    out = (kml_ffth_float_complex*)kml_ffth_malloc(sizeof(kml_ffth_float_complex) * 6); 
    kml_ffth_plan plan; 
    plan = kml_ffth_plan_many_dft_scale(rank, n, howmany, in, NULL, istride, idist, out, NULL, ostride, odist, KML_FFT_FORWARD, KML_FFT_ESTIMATE); 
    kml_ffth_execute_dft_scale(plan, in, out); 
 
    kml_ffth_destroy_plan(plan); 
    kml_ffth_free(n); 
    kml_ffth_free(in); 
    kml_ffth_free(out); 
 
    /* 
     * out = {{1.280000e+02, 8.000000e+00}, {1.120000e+02, -8.000000e+00}, 
     *        {0.000000e+00, 1.600000e+01}, {0.000000e+00, -1.600000e+01}, 
     *        {-8.000000e+00, 2.400000e+01}, {8.000000e+00, 8.000000e+00}} 
     */