54 if (x.size() == 0 || n == 0)
59 const auto necessaryInputPoints = n / 2 + 1;
61 if (x.size() > necessaryInputPoints)
63 input = x.flatten()(0,
Slice(necessaryInputPoints + 1));
65 else if (x.size() < necessaryInputPoints)
75 auto realN = 2 * (input.size() - 1);
76 realN += n % 2 == 1 ? 1 : 0;
80 fullOutput.begin() + input.size(),
82 [](
const auto& value) { return std::conj(value); });
99 template<
typename dtype>
114 const auto&
shape = inArray.shape();
116 const auto dataColSlice = data.cSlice();
117 const auto resultColSlice = result.cSlice();
119 for (
uint32 row = 0; row < data.numRows(); ++row)
121 const auto rowData = data(row, dataColSlice);
123 result.put(row, resultColSlice, rowResult);
151 template<
typename dtype>
160 return irfft(inArray, 2 * (inArray.size() - 1), inAxis);
164 return irfft(inArray, 2 * (inArray.numCols() - 1), inAxis);
168 return irfft(inArray, 2 * (inArray.numRows() - 1), inAxis);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
self_type transpose() const
Definition NdArrayCore.hpp:4963
A Class for slicing into NdArrays.
Definition Slice.hpp:45
Definition FFT/FFT.hpp:42
NdArray< std::complex< double > > ifft_internal(const NdArray< std::complex< double > > &x, uint32 n)
Definition ifft.hpp:50
NdArray< double > irfft_internal(const NdArray< std::complex< double > > &x, uint32 n)
Definition irfft.hpp:52
Definition FFT/FFT.hpp:40
NdArray< double > irfft(const NdArray< std::complex< dtype > > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
Definition irfft.hpp:100
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:776
OutputIt copy(InputIt first, InputIt last, OutputIt destination) noexcept
Definition StlAlgorithms.hpp:98
Axis
Enum To describe an axis.
Definition Enums.hpp:36
@ ROW
Definition Enums.hpp:38
@ COL
Definition Enums.hpp:39
@ NONE
Definition Enums.hpp:37
auto real(const std::complex< dtype > &inValue)
Definition real.hpp:48
auto complex(dtype inReal)
Definition complex.hpp:47
NdArray< dtype > zeros(uint32 inSquareSize)
Definition zeros.hpp:48
Shape shape(const NdArray< dtype > &inArray) noexcept
Definition Functions/shape.hpp:42
std::uint32_t uint32
Definition Types.hpp:40