Skip to content

Commit 67ac3c6

Browse files
authored
support real input in fft with mkl (#1120)
* add mkl to handle real input in fft
1 parent 7595c82 commit 67ac3c6

File tree

7 files changed

+419
-96
lines changed

7 files changed

+419
-96
lines changed

dpnp/backend/include/dpnp_iface_fft.hpp

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,33 +53,76 @@
5353
* Compute the one-dimensional discrete Fourier Transform.
5454
*
5555
* @param[in] q_ref Reference to SYCL queue.
56-
* @param[in] array_in Input array.
57-
* @param[out] result Output array.
56+
* @param[in] array1_in Input array.
57+
* @param[out] result_out Output array.
5858
* @param[in] input_shape Array with shape information for input array.
59-
* @param[in] output_shape Array with shape information for output array.
60-
* @param[in] shape_size Number of elements in @ref input_shape or @ref output_shape arrays.
59+
* @param[in] result_shape Array with shape information for result array.
60+
* @param[in] shape_size Number of elements in @ref input_shape or @ref result_shape arrays.
6161
* @param[in] axis Axis ID to compute by.
6262
* @param[in] input_boundarie Limit number of elements for @ref axis.
6363
* @param[in] inverse Using inverse algorithm.
6464
* @param[in] norm Normalization mode. 0 - backward, 1 - forward, 2 - ortho.
6565
* @param[in] dep_event_vec_ref Reference to vector of SYCL events.
6666
*/
67-
template <typename _DataType>
67+
template <typename _DataType_input, typename _DataType_output>
6868
INP_DLLEXPORT DPCTLSyclEventRef dpnp_fft_fft_c(DPCTLSyclQueueRef q_ref,
69-
const void* array_in,
70-
void* result,
69+
const void* array1_in,
70+
void* result_out,
7171
const shape_elem_type* input_shape,
72-
const shape_elem_type* output_shape,
72+
const shape_elem_type* result_shape,
7373
size_t shape_size,
7474
long axis,
7575
long input_boundarie,
7676
size_t inverse,
7777
const size_t norm,
7878
const DPCTLEventVectorRef dep_event_vec_ref);
7979

80-
template <typename _DataType>
81-
INP_DLLEXPORT void dpnp_fft_fft_c(const void* array_in,
82-
void* result,
80+
template <typename _DataType_input, typename _DataType_output>
81+
INP_DLLEXPORT void dpnp_fft_fft_c(const void* array1_in,
82+
void* result_out,
83+
const shape_elem_type* input_shape,
84+
const shape_elem_type* output_shape,
85+
size_t shape_size,
86+
long axis,
87+
long input_boundarie,
88+
size_t inverse,
89+
const size_t norm);
90+
91+
92+
/**
93+
* @ingroup BACKEND_FFT_API
94+
* @brief 1D discrete Fourier Transform.
95+
*
96+
* Compute the one-dimensional discrete Fourier Transform for real input.
97+
*
98+
* @param[in] q_ref Reference to SYCL queue.
99+
* @param[in] array1_in Input array.
100+
* @param[out] result_out Output array.
101+
* @param[in] input_shape Array with shape information for input array.
102+
* @param[in] result_shape Array with shape information for result array.
103+
* @param[in] shape_size Number of elements in @ref input_shape or @ref result_shape arrays.
104+
* @param[in] axis Axis ID to compute by.
105+
* @param[in] input_boundarie Limit number of elements for @ref axis.
106+
* @param[in] inverse Using inverse algorithm.
107+
* @param[in] norm Normalization mode. 0 - backward, 1 - forward, 2 - ortho.
108+
* @param[in] dep_event_vec_ref Reference to vector of SYCL events.
109+
*/
110+
template <typename _DataType_input, typename _DataType_output>
111+
INP_DLLEXPORT DPCTLSyclEventRef dpnp_fft_rfft_c(DPCTLSyclQueueRef q_ref,
112+
const void* array1_in,
113+
void* result_out,
114+
const shape_elem_type* input_shape,
115+
const shape_elem_type* result_shape,
116+
size_t shape_size,
117+
long axis,
118+
long input_boundarie,
119+
size_t inverse,
120+
const size_t norm,
121+
const DPCTLEventVectorRef dep_event_vec_ref);
122+
123+
template <typename _DataType_input, typename _DataType_output>
124+
INP_DLLEXPORT void dpnp_fft_fft_c(const void* array1_in,
125+
void* result_out,
83126
const shape_elem_type* input_shape,
84127
const shape_elem_type* output_shape,
85128
size_t shape_size,

dpnp/backend/include/dpnp_iface_fptr.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ enum class DPNPFuncName : size_t
166166
DPNP_FN_FABS_EXT, /**< Used in numpy.fabs() impl, requires extra parameters */
167167
DPNP_FN_FFT_FFT, /**< Used in numpy.fft.fft() impl */
168168
DPNP_FN_FFT_FFT_EXT, /**< Used in numpy.fft.fft() impl, requires extra parameters */
169+
DPNP_FN_FFT_RFFT, /**< Used in numpy.fft.rfft() impl */
170+
DPNP_FN_FFT_RFFT_EXT, /**< Used in numpy.fft.rfft() impl, requires extra parameters */
169171
DPNP_FN_FILL_DIAGONAL, /**< Used in numpy.fill_diagonal() impl */
170172
DPNP_FN_FILL_DIAGONAL_EXT, /**< Used in numpy.fill_diagonal() impl, requires extra parameters */
171173
DPNP_FN_FLATTEN, /**< Used in numpy.flatten() impl */

0 commit comments

Comments
 (0)