NumCpp  2.16.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
ifftshift.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/Core/Types.hpp"
32#include "NumCpp/NdArray.hpp"
33
34namespace nc::fft
35{
36 //===========================================================================
37 // Method Description:
48 template<typename dtype>
50 {
52
53 switch (inAxis)
54 {
55 case Axis::NONE:
56 {
57 auto shift = inX.size() / 2;
58 shift += inX.size() % 2 == 1 ? 1 : 0;
59 return roll(inX, shift, inAxis);
60 }
61 case Axis::COL:
62 {
63 auto shift = inX.numCols() / 2;
64 shift += inX.numCols() % 2 == 1 ? 1 : 0;
65 return roll(inX, shift, inAxis);
66 }
67 case Axis::ROW:
68 {
69 auto shift = inX.numRows() / 2;
70 shift += inX.numRows() % 2 == 1 ? 1 : 0;
71 return roll(inX, shift, inAxis);
72 }
73 default:
74 {
75 THROW_INVALID_ARGUMENT_ERROR("Unimplemented axis type.");
76 return {};
77 }
78 }
79 }
80} // namespace nc::fft
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition FFT/FFT.hpp:40
NdArray< dtype > ifftshift(const NdArray< dtype > &inX, Axis inAxis=Axis::NONE)
Definition ifftshift.hpp:49
Axis
Enum To describe an axis.
Definition Enums.hpp:36
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
NdArray< dtype > roll(const NdArray< dtype > &inArray, int32 inShift, Axis inAxis=Axis::NONE)
Definition roll.hpp:52