NumCpp  2.16.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
fftshift.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/Core/Types.hpp"
33#include "NumCpp/NdArray.hpp"
34
35namespace nc::fft
36{
37 //===========================================================================
38 // Method Description:
50 template<typename dtype>
52 {
54
55 switch (inAxis)
56 {
57 case Axis::NONE:
58 {
59 return roll(inX, inX.size() / 2, inAxis);
60 }
61 case Axis::COL:
62 {
63 return roll(inX, inX.numCols() / 2, inAxis);
64 }
65 case Axis::ROW:
66 {
67 return roll(inX, inX.numRows() / 2, inAxis);
68 }
69 default:
70 {
71 THROW_INVALID_ARGUMENT_ERROR("Unimplemented axis type.");
72 return {};
73 }
74 }
75 }
76} // 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 > fftshift(const NdArray< dtype > &inX, Axis inAxis=Axis::NONE)
Definition fftshift.hpp:51
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