Skip to content

Commit 9cbe203

Browse files
committed
more skeletoning
1 parent 159101d commit 9cbe203

File tree

10 files changed

+223
-10
lines changed

10 files changed

+223
-10
lines changed

docs/markdown/ReleaseNotes.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44

55
* added `fft` module for **Issue #137**
66
* `fft::fft` <https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html#numpy.fft.fft>
7-
* `fft::fft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2>
87
* `fft::ifft` <https://numpy.org/doc/stable/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft>
8+
* `fft::fftfreq` <https://numpy.org/doc/stable/reference/generated/numpy.fft.fftfreq.html>
9+
* `fft::fftshift` <https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshfit.html>
10+
* `fft::ifftshift` <https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshfit.html>
11+
* `fft::fftresample`: Resample a series to m points via Fourier interpolation
12+
* `fft::fft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2>
913
* `fft::ifft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2>
14+
* `fft::fft2resample`: Resample a series to m x n points via Fourier interpolation
1015
* `fft::rfft` <https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft.html#numpy.fft.rfft>
11-
* `fft::rfft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html#numpy.fft.rfft2>
1216
* `fft::irfft` <https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft.html#numpy.fft.irfft>
17+
* `fft::rfftfreq` <https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftfreq.html>
18+
* `fft::rfftresample`: Resample a series to m points via Fourier interpolation
19+
* `fft::rfft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html#numpy.fft.rfft2>
1320
* `fft::irfft2` <https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft2.html#numpy.fft.irfft2>
14-
* `fft::fft_resample`: Resample a series to m points via Fourier interpolation
15-
* `fft::fft2_resample`: Resample a series to m x n points via Fourier interpolation
16-
* `fft::rfft_resample`: Resample a series to m points via Fourier interpolation
17-
* `fft::rfft2_resample`: Resample a series to m x n points via Fourier interpolation
21+
* `fft::rfft2resample`: Resample a series to m x n points via Fourier interpolation
1822
* added `divmod` <https://numpy.org/doc/stable/reference/generated/numpy.divmod.html#numpy-divmod>
1923
* added `find_duplicates` <https://numpy.org/doc/stable//reference/generated/numpy.rec.find_duplicate.html>
2024
* added `mode` <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.mode.html>

include/NumCpp/FFT.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@
2929

3030
#include "NumCpp/FFT/fft.hpp"
3131
#include "NumCpp/FFT/fft2.hpp"
32-
#include "NumCpp/FFT/fft2_resample.hpp"
33-
#include "NumCpp/FFT/fft_resample.hpp"
32+
#include "NumCpp/FFT/fft2resample.hpp"
33+
#include "NumCpp/FFT/fftfreq.hpp"
34+
#include "NumCpp/FFT/fftresample.hpp"
35+
#include "NumCpp/FFT/fftshift.hpp"
3436
#include "NumCpp/FFT/ifft.hpp"
3537
#include "NumCpp/FFT/ifft2.hpp"
38+
#include "NumCpp/FFT/ifftshift.hpp"
3639
#include "NumCpp/FFT/irfft.hpp"
3740
#include "NumCpp/FFT/rfft.hpp"
3841
#include "NumCpp/FFT/rfft2.hpp"
39-
#include "NumCpp/FFT/rfft2_resample.hpp"
40-
#include "NumCpp/FFT/rfft_resample.hpp"
42+
#include "NumCpp/FFT/rfft2resample.hpp"
43+
#include "NumCpp/FFT/rfftfreq.hpp"
44+
#include "NumCpp/FFT/rfftresample.hpp"

include/NumCpp/FFT/fftfreq.hpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/// @file
2+
/// @author David Pilger <[email protected]>
3+
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
4+
///
5+
/// License
6+
/// Copyright 2018-2025 David Pilger
7+
///
8+
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
9+
/// software and associated documentation files(the "Software"), to deal in the Software
10+
/// without restriction, including without limitation the rights to use, copy, modify,
11+
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12+
/// permit persons to whom the Software is furnished to do so, subject to the following
13+
/// conditions :
14+
///
15+
/// The above copyright notice and this permission notice shall be included in all copies
16+
/// or substantial portions of the Software.
17+
///
18+
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19+
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20+
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21+
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22+
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
/// DEALINGS IN THE SOFTWARE.
24+
///
25+
/// Description
26+
/// Functions for working with NdArrays
27+
///
28+
#pragma once
29+
30+
#include "NumCpp/Core/Types.hpp"
31+
#include "NumCpp/NdArray.hpp"
32+
33+
namespace nc::fft
34+
{
35+
//===========================================================================
36+
// Method Description:
37+
/// Return the Discrete Fourier Transform sample frequencies.
38+
/// The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with
39+
/// zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second.
40+
///
41+
/// NumPy Reference: <https://numpy.org/doc/stable/reference/generated/numpy.fft.fftfreq.html#>
42+
///
43+
/// @param inN Window Length
44+
/// @param inD (Optional) Sample spacing (inverse of the sampling rate). Defaults to 1.
45+
///
46+
/// @return NdArray
47+
///
48+
inline NdArray<double> fftfreq(uint32 inN, double inD = 1.) { }
49+
} // namespace nc::fft

include/NumCpp/FFT/fftshift.hpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// @file
2+
/// @author David Pilger <[email protected]>
3+
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
4+
///
5+
/// License
6+
/// Copyright 2018-2025 David Pilger
7+
///
8+
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
9+
/// software and associated documentation files(the "Software"), to deal in the Software
10+
/// without restriction, including without limitation the rights to use, copy, modify,
11+
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12+
/// permit persons to whom the Software is furnished to do so, subject to the following
13+
/// conditions :
14+
///
15+
/// The above copyright notice and this permission notice shall be included in all copies
16+
/// or substantial portions of the Software.
17+
///
18+
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19+
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20+
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21+
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22+
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
/// DEALINGS IN THE SOFTWARE.
24+
///
25+
/// Description
26+
/// Functions for working with NdArrays
27+
///
28+
#pragma once
29+
30+
#include "NumCpp/Core/Internal/StaticAsserts.hpp"
31+
#include "NumCpp/Core/Types.hpp"
32+
#include "NumCpp/NdArray.hpp"
33+
34+
namespace nc::fft
35+
{
36+
//===========================================================================
37+
// Method Description:
38+
/// Shift the zero-frequency component to the center of the spectrum.
39+
/// This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component
40+
/// only if len(x) is even.
41+
///
42+
/// NumPy Reference: <https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html>
43+
///
44+
/// @param inX input array
45+
/// @param Axes (Optional) Axes over which to shift. Default is None, which shifts all axes.
46+
///
47+
/// @return NdArray
48+
///
49+
template<typename dtype>
50+
NdArray<dtype> fftshift(const NdArray<dtype>& inX, Axis inAxis = Axis::NONE)
51+
{
52+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
53+
}
54+
} // namespace nc::fft

include/NumCpp/FFT/ifftshift.hpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/// @file
2+
/// @author David Pilger <[email protected]>
3+
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
4+
///
5+
/// License
6+
/// Copyright 2018-2025 David Pilger
7+
///
8+
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
9+
/// software and associated documentation files(the "Software"), to deal in the Software
10+
/// without restriction, including without limitation the rights to use, copy, modify,
11+
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12+
/// permit persons to whom the Software is furnished to do so, subject to the following
13+
/// conditions :
14+
///
15+
/// The above copyright notice and this permission notice shall be included in all copies
16+
/// or substantial portions of the Software.
17+
///
18+
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19+
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20+
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21+
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22+
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
/// DEALINGS IN THE SOFTWARE.
24+
///
25+
/// Description
26+
/// Functions for working with NdArrays
27+
///
28+
#pragma once
29+
30+
#include "NumCpp/Core/Internal/StaticAsserts.hpp"
31+
#include "NumCpp/Core/Types.hpp"
32+
#include "NumCpp/NdArray.hpp"
33+
34+
namespace nc::fft
35+
{
36+
//===========================================================================
37+
// Method Description:
38+
/// The inverse of fftshift. Although identical for even-length x, the functions differ by one sample for odd-length
39+
/// x.
40+
///
41+
/// NumPy Reference: <https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshift.html>
42+
///
43+
/// @param inX input array
44+
/// @param Axes (Optional) Axes over which to shift. Default is None, which shifts all axes.
45+
///
46+
/// @return NdArray
47+
///
48+
template<typename dtype>
49+
NdArray<dtype> ifftshift(const NdArray<dtype>& inX, Axis inAxis = Axis::NONE)
50+
{
51+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
52+
}
53+
} // namespace nc::fft

include/NumCpp/FFT/rfftfreq.hpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/// @file
2+
/// @author David Pilger <[email protected]>
3+
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
4+
///
5+
/// License
6+
/// Copyright 2018-2025 David Pilger
7+
///
8+
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
9+
/// software and associated documentation files(the "Software"), to deal in the Software
10+
/// without restriction, including without limitation the rights to use, copy, modify,
11+
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12+
/// permit persons to whom the Software is furnished to do so, subject to the following
13+
/// conditions :
14+
///
15+
/// The above copyright notice and this permission notice shall be included in all copies
16+
/// or substantial portions of the Software.
17+
///
18+
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19+
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20+
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21+
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22+
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
/// DEALINGS IN THE SOFTWARE.
24+
///
25+
/// Description
26+
/// Functions for working with NdArrays
27+
///
28+
#pragma once
29+
30+
#include "NumCpp/Core/Types.hpp"
31+
#include "NumCpp/NdArray.hpp"
32+
33+
namespace nc::fft
34+
{
35+
//===========================================================================
36+
// Method Description:
37+
/// Return the Discrete Fourier Transform sample frequencies (for usage with rfft, irfft).
38+
/// The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with
39+
/// zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second.
40+
///
41+
/// NumPy Reference: <https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftfreq.html>
42+
///
43+
/// @param inN Window Length
44+
/// @param inD (Optional) Sample spacing (inverse of the sampling rate). Defaults to 1.
45+
///
46+
/// @return NdArray
47+
///
48+
inline NdArray<double> rfftfreq(uint32 inN, double inD = 1.) { }
49+
} // namespace nc::fft

0 commit comments

Comments
 (0)