Skip to content

dft


dft_stage class

template <typename T> dft_stage

Internal structure representing a single DFT stage


dft_order enum

enum class dft_order

Specifies the desired order for DFT output (and IDFT input)

Currenly ignored.


dft_pack_format enum

enum class dft_pack_format

Specifies the packing format for real DFT output data. See https://www.kfr.dev/docs/latest/dft_format/ for details

Perm enumerator (dft_pack_format::Perm)

Packed format: {X[0].r, X[N].r}, ... {X[i].r, X[i].i}, ... {X[N-1].r, X[N-1].i} Number of complex samples is \(\frac{N}{2}\) where N is the number of real samples

CCs enumerator (dft_pack_format::CCs)

Conjugate-symmetric format: {X[0].r, 0}, ... {X[i].r, X[i].i}, ... {X[N-1].r, X[N-1].i}, {X[N].r, 0} Number of complex samples is \(\frac{N}{2}+1\) where N is the number of real samples


dft_plan class

template <typename T> dft_plan

Class for performing 1D DFT/FFT.

The same plan is used for both direct DFT and inverse DFT. The type is default-constructible and movable but non-copyable. It is advisable to create an instance of the dft_plan with a specific size beforehand and reuse this instance in all subsequent DFT operations.
Template param T Template parameter specifying the floating-point type. Must be either float or double; other types are not supported.


dft_plan_real class

template <typename T> dft_plan_real

Real-to-complex and Complex-to-real 1D DFT


dft_plan class

template <typename T> dft_plan

Class for performing 1D DFT/FFT.

The same plan is used for both direct DFT and inverse DFT. The type is default-constructible and movable but non-copyable. It is advisable to create an instance of the dft_plan with a specific size beforehand and reuse this instance in all subsequent DFT operations.
Template param T Template parameter specifying the floating-point type. Must be either float or double; other types are not supported.

size variable (dft_plan::size)

size_t size

The size of the DFT as passed to the contructor.

temp_size variable (dft_plan::temp_size)

size_t temp_size

The temporary (scratch) buffer size for the DFT plan.
Note Preallocating a byte buffer of this size and passing its pointer to the execute function may improve performance.

dft_plan<T> function (dft_plan::dft_plan<T>)

dft_plan()
    : size(0), temp_size(0), data_size(0), arblen(false),
      disposition_inplace

Constructs an empty DFT plan.

This default constructor ensures the type is default-constructible.

dft_plan(const dft_plan &) = delete

Copy constructor (deleted).

Copying of dft_plan instances is not allowed.

operator= function (dft_plan::operator=)

dft_plan &operator=(const dft_plan &) = delete

Copy assignment operator (deleted).

Copy assignment of dft_plan instances is not allowed.

dft_plan<T> function (dft_plan::dft_plan<T>)

dft_plan(dft_plan &&) = default

Move constructor.

operator= function (dft_plan::operator=)

dft_plan &operator=(dft_plan &&) = default

Move assignment operator.

is_initialized function (dft_plan::is_initialized)

bool is_initialized() const

Checks whether the plan is non-empty.
Returns true if the plan was constructed with a specific DFT size, false otherwise.

dft_plan<T> function (dft_plan::dft_plan<T>)

explicit dft_plan(size_t size,
                  dft_order order = dft_order::normal,
                  bool progressive_optimized = false)
    : size(size), temp_size(0), data_size(0), arblen(false),
      progressive_optimized(progressive_optimized)

Constructs a DFT plan with the specified size and order.
Param size The size of the DFT.
Param order The order of the DFT samples. See dft_order.
Param progressive_optimized If true, the plan will be optimized for progressive execution.

dump function (dft_plan::dump)

void dump() const

Dumps details of the DFT plan to stdout for inspection.

May be used to determine the selected architecture at runtime and the chosen DFT algorithms.

execute function (dft_plan::execute)

void execute(complex<T> *out, const complex<T> *in,
             u8 *temp, bool inverse = false) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

~dft_plan<T> function (dft_plan::~dft_plan<T>)

~dft_plan()

Destructor.

Deallocates internal data.

execute function (dft_plan::execute)

template <bool inverse>
void execute(complex<T> *out, const complex<T> *in,
             u8 *temp, cbool_t<inverse> inv) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Template param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

template <univector_tag Tag1, univector_tag Tag2,
          univector_tag Tag3>
void execute(univector<complex<T>, Tag1> &out,
             const univector<complex<T>, Tag2> &in,
             univector<u8, Tag3> &temp,
             bool inverse = false) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

template <bool inverse, univector_tag Tag1,
          univector_tag Tag2, univector_tag Tag3>
void execute(univector<complex<T>, Tag1> &out,
             const univector<complex<T>, Tag2> &in,
             univector<u8, Tag3> &temp,
             cbool_t<inverse> inv) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Template param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

template <univector_tag Tag1, univector_tag Tag2>
void execute(univector<complex<T>, Tag1> &out,
             const univector<complex<T>, Tag2> &in,
             u8 *temp, bool inverse = false) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

template <bool inverse, univector_tag Tag1,
          univector_tag Tag2>
void execute(univector<complex<T>, Tag1> &out,
             const univector<complex<T>, Tag2> &in,
             u8 *temp, cbool_t<inverse> inv) const

Execute the complex DFT on in and write the result to out.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. If NULL, scratch buffer of size plan-\>temp_size will be allocated on stack or heap.
Template param inverse If true, apply the inverse DFT.
Note No scaling is applied. This function reads \(N\) complex values from in and writes \(N\) complex values to out, where \(N\) is the size passed to the constructor.

data variable (dft_plan::data)

autofree<u8> data

*/

data_size variable (dft_plan::data_size)

size_t data_size

*/

all_stages variable (dft_plan::all_stages)

std::vector<dft_stage_ptr<T>> all_stages

*/

stages variable (dft_plan::stages)

std::array<std::vector<dft_stage<T> *>, 2> stages

*/

arblen variable (dft_plan::arblen)

bool arblen

*/

progressive_optimized variable (dft_plan::progressive_optimized)

bool progressive_optimized

*/

disposition_inplace variable (dft_plan::disposition_inplace)

std::array<bitset, 2> disposition_inplace

*/

disposition_outofplace variable (dft_plan::disposition_outofplace)

std::array<bitset, 2> disposition_outofplace

*/

calc_disposition function (dft_plan::calc_disposition)

void calc_disposition()

Internal function

precompute_disposition function (dft_plan::precompute_disposition)

static bitset
precompute_disposition(int num_stages,
                       bitset can_inplace_per_stage,
                       bool inplace_requested)

Internal function

progressive class (dft_plan::progressive)

progressive

Internal data structure for progressive execution of the DFT. Do not access the members directly as they may change in future versions.

progressive_total_steps function (dft_plan::progressive_total_steps)

size_t progressive_total_steps() const

Returns the number of steps for progressive execution of the DFT.
Returns The number of steps for progressive execution.

progressive_start function (dft_plan::progressive_start)

progressive progressive_start(bool inverse, complex<T> *out,
                              const complex<T> *in,
                              u8 *temp) const

Initiates the progressive execution of the DFT.
Param inverse If true, applies the inverse DFT.
Param out Pointer to the output data.
Param in Pointer to the input data.
Param temp Temporary (scratch) buffer. A scratch buffer of size plan-\>temp_size must be provided.
Returns A progressive structure that can be used with progressive_step.
Note Ensure that the entire input data is available in the in buffer before calling this function. The out buffer will contain the result data after the final step of the progressive execution.

progressive_step function (dft_plan::progressive_step)

bool progressive_step(progressive &progressive) const

Steps the progressive execution of the DFT.
Param progressive A progressive structure returned by progressive_start.
Returns true if there are more steps to execute, false if the DFT is complete.

noinit class (dft_plan::noinit)

noinit

dft_plan_real class

template <typename T> dft_plan_real

Real-to-complex and Complex-to-real 1D DFT


dft_plan_md class

template <typename T, index_t Dims = dynamic_shape>
dft_plan_md

Multidimensional DFT


dft_plan_md_real class

template <typename T, index_t Dims = dynamic_shape>
dft_plan_md_real

Multidimensional DFT


dct_plan class

template <typename T> dct_plan

DCT type 2 (unscaled)


dft_cache_impl class (generic::dft_cache_impl)

template <int = 0> dft_cache_impl

dft function (generic::dft)

template <typename T, univector_tag Tag>
univector<complex<T>>
dft(const univector<complex<T>, Tag> &input)

Performs Direct DFT using cached plan


idft function (generic::idft)

template <typename T, univector_tag Tag>
univector<complex<T>>
idft(const univector<complex<T>, Tag> &input)

Performs Inverse DFT using cached plan


realdft function (generic::realdft)

template <typename T, univector_tag Tag>
univector<complex<T>>
realdft(const univector<T, Tag> &input)

Performs Real Direct DFT using cached plan


irealdft function (generic::irealdft)

template <typename T, univector_tag Tag>
univector<T>
irealdft(const univector<complex<T>, Tag> &input)

Permorms Real Inverse DFT using cached plan


reference_dft_nonpo2 function (internal_generic::reference_dft_nonpo2)

template <typename T>
void reference_dft_nonpo2(complex<T> *out,
                          const complex<T> *in, size_t size,
                          bool inversion,
                          size_t out_delta = 1,
                          size_t in_delta = 1)

Performs Complex FFT using reference implementation (slow, used for testing)


reference_dft function

template <typename T>
void reference_dft(complex<T> *out, const complex<T> *in,
                   size_t size, bool inversion = false,
                   size_t out_delta = 1,
                   size_t in_delta = 1)

Performs Complex DFT using reference implementation (slow, used for testing)


template <typename T>
void reference_dft(complex<T> *out, const T *in,
                   size_t size, size_t out_delta = 1,
                   size_t in_delta = 1)

Performs Direct Real DFT using reference implementation (slow, used for testing)


reference_dft_md function

template <typename T>
void reference_dft_md(complex<T> *out, const complex<T> *in,
                      shape<dynamic_shape> size,
                      bool inversion = false,
                      size_t out_delta = 1,
                      size_t in_delta = 1)

Performs Multidimensional Complex DFT using reference implementation (slow, used for testing)


template <typename T>
void reference_dft_md(complex<T> *out, const T *in,
                      shape<dynamic_shape> shape,
                      bool inversion = false,
                      size_t out_delta = 1,
                      size_t in_delta = 1)

Performs Multidimensional Direct Real DFT using reference implementation (slow, used for testing)


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/