e-strauss commented on code in PR #2119: URL: https://github.com/apache/systemds/pull/2119#discussion_r1774719000
########## src/main/python/systemds/operator/nodes/matrix.py: ########## @@ -810,5 +809,36 @@ def quantile(self, p, weights: "Matrix" = None) -> "OperationNode": else: raise ValueError("P has to be a Scalar or Matrix") + def fft(self) -> 'MultiReturn': + """ + Performs the Fast Fourier Transform (FFT) on the matrix. + :return: A MultiReturn object representing the real and imaginary parts of the FFT output. + """ + + real_output = Matrix(self.sds_context, '') + imag_output = Matrix(self.sds_context, '') + + fft_node = MultiReturn(self.sds_context, 'fft', [real_output, imag_output], [self]) + + return fft_node + + def ifft(self, imag_input: 'Matrix' = None) -> 'MultiReturn': + """ + Performs the Inverse Fast Fourier Transform (IFFT) on a complex matrix. + + :param imag_input: The imaginary part of the input matrix (optional). + :return: A MultiReturn object representing the real and imaginary parts of the IFFT output. + """ + + real_output = Matrix(self.sds_context, '') + imag_output = Matrix(self.sds_context, '') + + if imag_input is None: + ifft_node = MultiReturn(self.sds_context, 'ifft', [real_output, imag_output], [self]) + else: + ifft_node = MultiReturn(self.sds_context, 'ifft', [real_output, imag_output], [self, imag_input]) + + return ifft_node + Review Comment: moved from systemds context because there the outputs were set as OperationNodes with OutputType Matrix to avoid a cyclic dependancy. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org