NumCpp  2.18.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
32#include "NumCpp/NdArray.hpp"
33
34namespace nc::fft
35{
36 //===========================================================================
37 // Method Description:
49 template<typename dtype>
51 {
53
54 switch (inAxis)
55 {
56 case Axis::NONE:
57 {
58 return roll(inX, inX.size() / 2, inAxis);
59 }
60 case Axis::COL:
61 {
62 return roll(inX, inX.numCols() / 2, inAxis);
63 }
64 case Axis::ROW:
65 {
66 return roll(inX, inX.numRows() / 2, inAxis);
67 }
68 default:
69 {
70 THROW_INVALID_ARGUMENT_ERROR("Unimplemented axis type.");
71 return {};
72 }
73 }
74 }
75} // 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:135
size_type size() const noexcept
Definition NdArrayCore.hpp:4600
size_type numCols() const noexcept
Definition NdArrayCore.hpp:3541
size_type numRows() const noexcept
Definition NdArrayCore.hpp:3553
Definition FFT/FFT.hpp:40
NdArray< dtype > fftshift(const NdArray< dtype > &inX, Axis inAxis=Axis::NONE)
Definition fftshift.hpp:50
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
NdArray< dtype > roll(const NdArray< dtype > &inArray, int32 inShift, Axis inAxis=Axis::NONE)
Definition roll.hpp:52