Method: Numo::Pocketfft.rfft

Defined in:
lib/numo/pocketfft.rb

.rfft(a) ⇒ Numo::DComplex

Compute the 1-dimensional discrete Fourier Transform for real input.

Parameters:

  • a (Numo::DFloat)

    Real 1-dimensional input array.

Returns:

  • (Numo::DComplex)

    Transformed data.

Raises:

  • (ArgumentError)

    This error is raised if input array is not Numo::NArray, is not one-dimensional array, or is empty.



95
96
97
98
99
100
101
# File 'lib/numo/pocketfft.rb', line 95

def rfft(a)
  raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
  raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
  raise ArgumentError, 'Expect input array to be one-dimensional.' unless a.ndim == 1

  raw_fft(a, 0, inverse: false, real: true)
end