Discrete Fourier Transform Functions#

oneMKL provides a DPC++ interface to \(d\)-dimensional \(\left(d \in \mathbb{Z}_{>0}\right)\) Discrete Fourier Transforms (DFTs).

Definitions#

Let \(w^{m}_{k_1, k_2, \ldots, k_d}\) be the entry of multi-index \(\left(k_1, k_2, \ldots, k_d\right) \in \mathbb{Z}^d\) in the \(m\)-th sequence of a set \(w\) of \(M\) \(d\)-dimensional periodic discrete sequences of period(s) (or “length(s)”) \(n_1 \times n_2 \times \dots \times n_d\) (\(M \in \mathbb{Z}_{>0}\), \(m \in \lbrace 0, 1, \ldots, M-1\rbrace\) and \(n_{\ell} \in \mathbb{Z}_{>0}, \forall \ell \in \lbrace 1, \ldots, d \rbrace\)).

For every \(m \in \lbrace 0, 1, \ldots, M - 1 \rbrace\), the DFT of sequence \(w^{m}\) is the \(d\)-dimensional \(n_1 \times n_2 \times \dots \times n_d\) periodic discrete sequence \(z^{m}\) whose entries are defined as

(1)#\[z^{m}_{k_1, k_2,\ldots, k_d} = \sigma \displaystyle\sum_{j_d=0}^{n_d-1}\dots\displaystyle\sum_{j_2=0}^{n_2-1}\displaystyle\sum_{j_1=0}^{n_1-1} w^{m}_{j_1, j_2,\dots,j_d} \exp \left[ \delta 2\pi \imath \left( \sum_{\ell=1}^{d} \frac{j_{\ell}k_{\ell}}{n_{\ell}} \right) \right] \ \forall \left(k_1, \ldots, k_d\right) \in \mathbb{Z}^{d}\]

where \(\imath^2 = -1\) and \(\sigma\) is a scale factor. In (1), \(\delta\) determines one of the two “directions” of the DFT: \(\delta=-1\) defines the “forward DFT” while \(\delta=+1\) defines the “backward DFT”.

The domain of input (resp. output) discrete sequences for a forward (resp. backward) DFT is referred to as “forward domain”. Conversely, the domain of output (resp. input) discrete sequences for forward (resp. backward) DFT is referred to as “backward domain”.

oneMKL supports single-precision (fp32) and double-precision (fp64) floating-point arithmetic for the calculation of DFTs, using two types of forward domains:

  • the set of complex \(d\)-dimensional periodic sequences, referred to as “complex forward domain”;

  • the set of real \(d\)-dimensional periodic sequences, referred to as “real forward domain”.

Similarly, we refer to DFTs of complex (resp. real) forward domain as “complex DFTs” (resp. “real DFTs”). Regardless of the type of forward domain, the backward domain’s data sequences are always complex.

The calculation of the same DFT for several, i.e., \(M > 1\), data sets of the same type of forward domain, using the same precision is referred to as a “batched DFT”.

Finite range of indices#

In general, given the periodicity of the discrete data considered in any DFT, ranges of indices \(\left(k_1, \ldots, k_d\right) \in \mathbb{Z}^{d}\) such that \(0\leq k_{\ell} < n_{\ell}, \forall \ell \in \lbrace 1, \ldots, d \rbrace\) suffice to determine any relevant \(d\)-dimensional sequence unambiguously (for any valid \(m\)). In case of real DFTs, the data sequences in backward domain can be fully determined from a smaller range of indices. Indeed, if all entries of \(w\) are real in (1), then the entries of \(z\) are complex and, for any valid \(m\), \(\left(z^{m}_{k_1, k_2, \dots, k_d}\right)^{*} = z^{m}_{n_1 - k_1, n_2 - k_2, \dots, n_d - k_d}\) \(\forall \left(k_1, k_2, \ldots, k_d\right) \in \mathbb{Z}^{d}\) where \(\lambda^{*}\) represents the conjugate of complex number \(\lambda\). This conjugate symmetry relation makes roughly half the data redundant in backward domain: in case of real DFTs, the data sequences in backward domain can be fully determined even if one of the \(d\) indices \(k_{\ell}\) is limited to the range \(0\leq k_{\ell} \leq \lfloor \frac{n_{\ell}}{2}\rfloor\). In oneMKL, the index \(k_d\), i.e., the last dimension’s index, is restricted as such for capturing an elementary set of non-redundant entries of data sequences belonging to the backward domain of real DFTs.

Elementary range of indices#

In other words, oneMKL expects and produces a set of \(M\) \(d\)-dimensional finite data sequences \(\left(\cdot \right)^{m}_{k_1, k_2,\ldots, k_d}\) with integer indices \(m\) and \(k_{\ell}\ \left(\ell \in \lbrace 1, \ldots, d \rbrace\right)\) in the elementary range

  • \(0 \leq m < M\);

  • \(0 \leq k_j < n_j,\ \forall j \in \lbrace1, \ldots, d - 1\rbrace\), if \(d > 1\);

  • \(0 \leq k_d < n_d\), except for backward domain’s data sequences of real DFTs;

  • \(0 \leq k_d \leq \lfloor\frac{n_d}{2}\rfloor\), for backward domain’s data sequences of real DFTs.

Additional constraints for data in backward domain of real DFTs#

Finally, note that the conjugate symmetry relation further constrains some of the entries (or pairs thereof) in the backward domain’s data sequences for real DFTs. Specifically, for any of the \(M\) sequences,

  • the imaginary part must be \(0\) for any entry of multi-index \(\left(k_1, k_2, \ldots, k_d\right)\) such that \(k_{\ell} \equiv \left(n_{\ell} - k_{\ell}\right) \pmod {n_{\ell}}, \forall \ell \in \lbrace{1, \ldots, d\rbrace}\), e.g., entry of multi-index \(\left(0, 0, \ldots, 0\right)\);

  • pairs of entries of multi-indices \(\left(k_1, k_2, \ldots, k_d\right)\) and \(\left(j_1, j_2, \ldots, j_d\right)\) such that \(k_{\ell} \equiv \left(n_{\ell} - j_{\ell}\right) \pmod {n_{\ell}}, \forall \ell \in \lbrace{1, \ldots, d\rbrace}\) must be complex conjugates of one another, e.g., entries of multi-indices \(\left(1, 0, \ldots, 0\right)\) and \(\left(n_1 - 1, 0, \ldots, 0\right)\) must be complex conjugates (note that this case falls back to the above constraint if \(n_1 = 2\)).

Note

The behavior of oneMKL is undefined for real backward DFT if the input data does not satisfy those constraints. oneMKL considers it the user’s responsibility to guarantee that these constraints are satisfied by the input data for real backward DFTs.