Skip to content

Commit e3ea93e

Browse files
committed
continued skeletoning
1 parent 9cbe203 commit e3ea93e

File tree

18 files changed

+433
-80
lines changed

18 files changed

+433
-80
lines changed

include/NumCpp/FFT/fft.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace nc::fft
4747
/// @param x the data
4848
/// @param n Length of the transformed axis of the output.
4949
///
50-
NdArray<std::complex<double>> fft_internal(const NdArray<std::complex<double>>& x, uint32 n)
50+
inline NdArray<std::complex<double>> fft_internal(const NdArray<std::complex<double>>& x, uint32 n)
5151
{
5252
if (n == 0)
5353
{

include/NumCpp/FFT/fft2.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@
3535

3636
namespace nc::fft
3737
{
38+
namespace detail
39+
{
40+
//===========================================================================
41+
// Method Description:
42+
/// Fast Fourier Transform
43+
///
44+
/// @param x the data
45+
/// @param shape Shape (length of each transformed axis) of the output
46+
///
47+
inline NdArray<std::complex<double>> fft2_internal(const NdArray<std::complex<double>>& x, const Shape& shape)
48+
{
49+
return {};
50+
}
51+
} // namespace detail
52+
3853
//===========================================================================
3954
// Method Description:
4055
/// Compute the 2-dimensional discrete Fourier Transform.

include/NumCpp/FFT/fft2resample.hpp

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,56 +42,30 @@ namespace nc::fft
4242
///
4343
/// @param inArray
4444
/// @param n Length of the transformed axis of the output.
45-
/// @param inAxis (Optional, default NONE)
4645
///
4746
/// @return NdArray
4847
///
4948
template<typename dtype>
50-
NdArray<std::complex<double>> fft2_resample(const NdArray<dtype>& inArray, uint32 inN, Axis inAxis = Axis::NONE)
49+
NdArray<std::complex<double>> fft2resample(const NdArray<dtype>& inArray, const Shape& inShape)
5150
{
51+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
52+
53+
return ifft2(fft2(inArray, inShape), inShape);
5254
}
5355

5456
//===========================================================================
5557
// Method Description:
5658
/// Resample a series to m,n points via Fourier interpolation
5759
///
5860
/// @param inArray
59-
/// @param inAxis (Optional, default NONE)
6061
///
6162
/// @return NdArray
6263
///
6364
template<typename dtype>
64-
NdArray<std::complex<double>> fft2_resample(const NdArray<dtype>& inArray, Axis inAxis = Axis::NONE)
65+
NdArray<std::complex<double>> fft2resample(const NdArray<dtype>& inArray)
6566
{
66-
}
67+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
6768

68-
//============================================================================
69-
// Method Description:
70-
/// Resample a series to m,n points via Fourier interpolation
71-
///
72-
/// @param inArray
73-
/// @param n Length of the transformed axis of the output.
74-
/// @param inAxis (Optional, default NONE)
75-
///
76-
/// @return NdArray
77-
///
78-
template<typename dtype>
79-
NdArray<std::complex<double>>
80-
fft2_resample(const NdArray<std::complex<dtype>>& inArray, uint32 inN, Axis inAxis = Axis::NONE)
81-
{
82-
}
83-
84-
//============================================================================
85-
// Method Description:
86-
/// Resample a series to m,n points via Fourier interpolation
87-
///
88-
/// @param inArray
89-
/// @param inAxis (Optional, default NONE)
90-
///
91-
/// @return NdArray
92-
///
93-
template<typename dtype>
94-
NdArray<std::complex<double>> fft2_resample(const NdArray<std::complex<dtype>>& inArray, Axis inAxis = Axis::NONE)
95-
{
69+
return ifft2(fft2(inArray));
9670
}
9771
} // namespace nc::fft

include/NumCpp/FFT/fftfreq.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ namespace nc::fft
4545
///
4646
/// @return NdArray
4747
///
48-
inline NdArray<double> fftfreq(uint32 inN, double inD = 1.) { }
48+
inline NdArray<double> fftfreq(uint32 inN, double inD = 1.)
49+
{
50+
return {};
51+
}
4952
} // namespace nc::fft

include/NumCpp/FFT/fftresample.hpp

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ namespace nc::fft
4747
/// @return NdArray
4848
///
4949
template<typename dtype>
50-
NdArray<std::complex<double>> fft_resample(const NdArray<dtype>& inArray, uint32 inN, Axis inAxis = Axis::NONE)
50+
NdArray<std::complex<double>> fftresample(const NdArray<dtype>& inArray, uint32 inN, Axis inAxis = Axis::NONE)
5151
{
52+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
53+
54+
return ifft(fft(inArray, inN, inAxis), inN, inAxis);
5255
}
5356

5457
//===========================================================================
@@ -61,37 +64,10 @@ namespace nc::fft
6164
/// @return NdArray
6265
///
6366
template<typename dtype>
64-
NdArray<std::complex<double>> fft_resample(const NdArray<dtype>& inArray, Axis inAxis = Axis::NONE)
67+
NdArray<std::complex<double>> fftresample(const NdArray<dtype>& inArray, Axis inAxis = Axis::NONE)
6568
{
66-
}
69+
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
6770

68-
//============================================================================
69-
// Method Description:
70-
/// Resample a series to m points via Fourier interpolation
71-
///
72-
/// @param inArray
73-
/// @param n Length of the transformed axis of the output.
74-
/// @param inAxis (Optional, default NONE)
75-
///
76-
/// @return NdArray
77-
///
78-
template<typename dtype>
79-
NdArray<std::complex<double>>
80-
fft_resample(const NdArray<std::complex<dtype>>& inArray, uint32 inN, Axis inAxis = Axis::NONE)
81-
{
82-
}
83-
84-
//============================================================================
85-
// Method Description:
86-
/// Resample a series to m points via Fourier interpolation
87-
///
88-
/// @param inArray
89-
/// @param inAxis (Optional, default NONE)
90-
///
91-
/// @return NdArray
92-
///
93-
template<typename dtype>
94-
NdArray<std::complex<double>> fft_resample(const NdArray<std::complex<dtype>>& inArray, Axis inAxis = Axis::NONE)
95-
{
71+
return ifft(fft(inArray, inAxis), inAxis);
9672
}
9773
} // namespace nc::fft

include/NumCpp/FFT/fftshift.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,7 @@ namespace nc::fft
5050
NdArray<dtype> fftshift(const NdArray<dtype>& inX, Axis inAxis = Axis::NONE)
5151
{
5252
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
53+
54+
return {};
5355
}
5456
} // namespace nc::fft

include/NumCpp/FFT/ifft.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace nc::fft
4747
/// @param x the data
4848
/// @param n Length of the transformed axis of the output.
4949
///
50-
NdArray<std::complex<double>> internal_ifft(const NdArray<std::complex<double>>& x, uint32 n)
50+
inline NdArray<std::complex<double>> internal_ifft(const NdArray<std::complex<double>>& x, uint32 n)
5151
{
5252
if (n == 0)
5353
{

include/NumCpp/FFT/ifft2.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@
3535

3636
namespace nc::fft
3737
{
38+
namespace detail
39+
{
40+
//===========================================================================
41+
// Method Description:
42+
/// Fast Fourier Transform
43+
///
44+
/// @param x the data
45+
/// @param shape Shape (length of each transformed axis) of the output
46+
///
47+
inline NdArray<std::complex<double>> ifft2_internal(const NdArray<std::complex<double>>& x, const Shape& shape)
48+
{
49+
return {};
50+
}
51+
} // namespace detail
52+
3853
//===========================================================================
3954
// Method Description:
4055
/// Compute the 2-dimensional inverse discrete Fourier Transform.

include/NumCpp/FFT/ifftshift.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ namespace nc::fft
4949
NdArray<dtype> ifftshift(const NdArray<dtype>& inX, Axis inAxis = Axis::NONE)
5050
{
5151
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
52+
53+
return {};
5254
}
5355
} // namespace nc::fft

include/NumCpp/FFT/irfft.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace nc::fft
4949
/// @param x the data
5050
/// @param n Length of the transformed axis of the output.
5151
///
52-
NdArray<double> internal_irfft(const NdArray<std::complex<double>>& x, uint32 n)
52+
inline NdArray<double> internal_irfft(const NdArray<std::complex<double>>& x, uint32 n)
5353
{
5454
if (x.size() == 0 || n == 0)
5555
{

0 commit comments

Comments
 (0)