20#ifndef CCGSL_FFT_COMPLEX_HPP
21#define CCGSL_FFT_COMPLEX_HPP
23#include <gsl/gsl_fft_complex.h>
46 return gsl_fft_complex_radix2_forward( data, stride,
n ); }
56 return gsl_fft_complex_radix2_backward( data, stride,
n ); }
66 return gsl_fft_complex_radix2_inverse( data, stride,
n ); }
78 return gsl_fft_complex_radix2_transform( data, stride,
n,
sign ); }
88 return gsl_fft_complex_radix2_dif_forward( data, stride,
n ); }
98 return gsl_fft_complex_radix2_dif_backward( data, stride,
n ); }
108 return gsl_fft_complex_radix2_dif_inverse( data, stride,
n ); }
120 return gsl_fft_complex_radix2_dif_transform( data, stride,
n,
sign ); }
130 return gsl_fft_complex_radix2_forward( data, 1,
n ); }
139 return gsl_fft_complex_radix2_backward( data, 1,
n ); }
148 return gsl_fft_complex_radix2_inverse( data, 1,
n ); }
159 return gsl_fft_complex_radix2_transform( data, 1,
n,
sign ); }
168 return gsl_fft_complex_radix2_dif_forward( data, 1,
n ); }
177 return gsl_fft_complex_radix2_dif_backward( data, 1,
n ); }
186 return gsl_fft_complex_radix2_dif_inverse( data, 1,
n ); }
197 return gsl_fft_complex_radix2_dif_transform( data, 1,
n,
sign ); }
206 template<
typename DATA>
207 inline int forward( DATA& data,
size_t const stride = 1 ){
208 return gsl_fft_complex_radix2_forward( data.data(), stride, data.size() / (2 * stride) ); }
217 template<
typename DATA>
218 inline int backward( DATA& data,
size_t const stride = 1 ){
219 return gsl_fft_complex_radix2_backward( data.data(), stride, data.size() / (2 * stride) ); }
228 template<
typename DATA>
229 inline int inverse( DATA& data,
size_t const stride = 1 ){
230 return gsl_fft_complex_radix2_inverse( data.data(), stride, data.size() / (2 * stride) ); }
240 template<
typename DATA>
242 return gsl_fft_complex_radix2_transform( data.data(), stride,
243 data.size() / (2 * stride),
sign ); }
251 template<
typename DATA>
253 return gsl_fft_complex_radix2_transform( data.data(), 1, data.size() / 2,
sign ); }
262 template<
typename DATA>
264 return gsl_fft_complex_radix2_dif_forward( data.data(), stride, data.size() / (2 * stride) ); }
273 template<
typename DATA>
275 return gsl_fft_complex_radix2_dif_backward( data.data(), stride, data.size() / (2 * stride) ); }
284 template<
typename DATA>
286 return gsl_fft_complex_radix2_dif_inverse( data.data(), stride, data.size() / (2 * stride) ); }
296 template<
typename DATA>
298 return gsl_fft_complex_radix2_dif_transform( data.data(), stride,
299 data.size() / (2 * stride),
sign ); }
307 template<
typename DATA>
309 return gsl_fft_complex_radix2_dif_transform( data.data(), 1, data.size() / 2,
sign ); }
318 return gsl_fft_complex_radix2_forward( data.
data(), stride, data.
size() / stride ); }
328 return gsl_fft_complex_radix2_backward( data.
data(), stride, data.
size() / stride ); }
338 return gsl_fft_complex_radix2_inverse( data.
data(), stride, data.
size() / stride ); }
349 return gsl_fft_complex_radix2_transform( data.
data(), stride, data.
size() / stride,
sign ); }
359 return gsl_fft_complex_radix2_forward( data.
data(), 1, data.
size() ); }
367 return gsl_fft_complex_radix2_backward( data.
data(), 1, data.
size() ); }
375 return gsl_fft_complex_radix2_inverse( data.
data(), 1, data.
size() ); }
384 return gsl_fft_complex_radix2_transform( data.
data(), 1,
393 return gsl_fft_complex_radix2_dif_forward( data.
data(), 1, data.
size() ); }
401 return gsl_fft_complex_radix2_dif_backward( data.
data(), 1, data.
size() ); }
409 return gsl_fft_complex_radix2_dif_inverse( data.
data(), 1, data.
size() ); }
418 return gsl_fft_complex_radix2_dif_transform( data.
data(), 1,
443 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
492 throw( std::bad_alloc() );
508#ifdef __GXX_EXPERIMENTAL_CXX0X__
514 std::swap(
count, v.count );
515 v.ccgsl_pointer =
nullptr;
523 wavetable( std::move( v ) ).swap( *
this );
633#ifdef __GXX_EXPERIMENTAL_CXX0X__
660 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
710#ifdef __GXX_EXPERIMENTAL_CXX0X__
716 std::swap(
count, v.count );
717 v.ccgsl_pointer =
nullptr;
725 workspace( std::move( v ) ).swap( *
this );
835#ifdef __GXX_EXPERIMENTAL_CXX0X__
852 return gsl_fft_complex_forward( data, stride,
n,
wavetable.
get(), work.
get() ); }
865 return gsl_fft_complex_backward( data, stride,
n,
wavetable.
get(), work.
get() ); }
878 return gsl_fft_complex_inverse( data, stride,
n,
wavetable.
get(), work.
get() ); }
906 return gsl_fft_complex_forward( data, 1,
n,
wavetable.
get(), work.
get() ); }
918 return gsl_fft_complex_backward( data, 1,
n,
wavetable.
get(), work.
get() ); }
930 return gsl_fft_complex_inverse( data, 1,
n,
wavetable.
get(), work.
get() ); }
956 template<
typename DATA>
958 return gsl_fft_complex_forward( data.data(), stride, data.size() / (2 * stride),
970 template<
typename DATA>
972 return gsl_fft_complex_backward( data.data(), stride, data.size() / (2 * stride),
984 template<
typename DATA>
986 return gsl_fft_complex_inverse( data.data(), stride, data.size() / (2 * stride),
999 template<
typename DATA>
1002 return gsl_fft_complex_transform( data.data(), stride, data.size() / (2 * stride),
1015 return gsl_fft_complex_forward( data.
data(), stride, data.
size() / stride,
1029 return gsl_fft_complex_backward( data.
data(), stride, data.
size() / stride,
1043 return gsl_fft_complex_inverse( data.
data(), stride, data.
size() / stride,
1058 return gsl_fft_complex_transform( data.
data(), stride, data.
size() / stride,
1071 template<
typename DATA>
1073 return gsl_fft_complex_forward( data.data(), 1, data.size() / 2,
1084 template<
typename DATA>
1086 return gsl_fft_complex_backward( data.data(), 1, data.size() / 2,
1097 template<
typename DATA>
1099 return gsl_fft_complex_inverse( data.data(), 1, data.size() / 2,
1111 template<
typename DATA>
1114 return gsl_fft_complex_transform( data.data(), 1, data.size() / 2,
1126 return gsl_fft_complex_forward( data.
data(), 1, data.
size(),
1139 return gsl_fft_complex_backward( data.
data(), 1, data.
size(),
1152 return gsl_fft_complex_inverse( data.
data(), 1, data.
size(),
1166 return gsl_fft_complex_transform( data.
data(), 1, data.
size(),
This class handles complex numbers.
C++ version of gsl_fft_complex_wavetable functions.
bool operator>=(wavetable const &v) const
A container needs to define an ordering for sorting.
wavetable & operator=(wavetable const &v)
The assignment operator.
bool operator<(wavetable const &v) const
A container needs to define an ordering for sorting.
gsl_fft_complex_wavetable * get() const
Get the gsl_fft_complex_wavetable.
wavetable(size_t const n)
The default constructor creates a new workspace of size n.
bool empty() const
Find if the wavetable is empty.
bool operator!=(wavetable const &v) const
Two wavetable are different equal if their elements are not identical.
wavetable(wavetable const &v)
The copy constructor.
wavetable & operator=(wavetable &&v)
Move operator.
bool unique() const
Find if this is the only object sharing the gsl_fft_complex_wavetable.
wavetable()
The default constructor is only really useful for assigning to.
wavetable clone() const
The clone function.
bool operator>(wavetable const &v) const
A container needs to define an ordering for sorting.
bool operator<=(wavetable const &v) const
A container needs to define an ordering for sorting.
wavetable(wavetable &&v)
Move constructor.
size_t * count
The shared reference count.
gsl_fft_complex_wavetable * ccgsl_pointer
The shared pointer.
bool operator==(wavetable const &v) const
Two wavetable are identically equal if their elements are identical.
~wavetable()
The destructor only deletes the pointers if count reaches zero.
void swap(wavetable &v)
Swap two wavetable.
wavetable(gsl_fft_complex_wavetable *v)
Could construct from a gsl_fft_complex_wavetable.
size_t use_count() const
Find how many workspace objects share this pointer.
Workspace for complex fast fourier transforms.
bool unique() const
Find if this is the only object sharing the gsl_fft_complex_workspace.
workspace(workspace const &v)
The copy constructor.
workspace(workspace &&v)
Move constructor.
bool operator>=(workspace const &v) const
A container needs to define an ordering for sorting.
gsl_fft_complex_workspace * get() const
Get the gsl_fft_complex_workspace.
bool operator<(workspace const &v) const
A container needs to define an ordering for sorting.
size_t use_count() const
Find how many workspace objects share this pointer.
bool operator!=(workspace const &v) const
Two workspace are different equal if their elements are not identical.
gsl_fft_complex_workspace * ccgsl_pointer
The shared pointer.
size_t * count
The shared reference count.
workspace(gsl_fft_complex_workspace *v)
Could construct from a gsl_fft_complex_workspace.
bool empty() const
Find if the workspace is empty.
~workspace()
The destructor only deletes the pointers if count reaches zero.
workspace(size_t const n)
The default constructor creates a new workspace of size n.
bool operator<=(workspace const &v) const
A container needs to define an ordering for sorting.
workspace & operator=(workspace &&v)
Move operator.
workspace & operator=(workspace const &v)
The assignment operator.
bool operator>(workspace const &v) const
A container needs to define an ordering for sorting.
workspace()
The default constructor is only really useful for assigning to.
void swap(workspace &v)
Swap two workspace.
bool operator==(workspace const &v) const
Two workspace are identically equal if their elements are identical.
This class handles vector_complex objects as shared handles.
size_type size() const
The size (number of elements) of the vector_complex.
double * data()
Give access to the data block.
int dif_inverse(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_dif_inverse().
int transform(gsl::complex_packed_array data, size_t const stride, size_t const n, fft::direction const sign)
C++ version of gsl_fft_complex_radix2_transform().
int forward(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_forward().
int backward(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_backward().
int dif_transform(gsl::complex_packed_array data, size_t const stride, size_t const n, fft::direction const sign)
C++ version of gsl_fft_complex_radix2_dif_transform().
int inverse(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_inverse().
int dif_backward(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_dif_backward().
int dif_forward(gsl::complex_packed_array data, size_t const stride, size_t const n)
C++ version of gsl_fft_complex_radix2_dif_forward().
int forward(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, workspace &work)
C++ version of gsl_fft_complex_forward().
int inverse(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, workspace &work)
C++ version of gsl_fft_complex_inverse().
int backward(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, workspace &work)
C++ version of gsl_fft_complex_backward().
int transform(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, workspace &work, fft::direction const sign)
C++ version of gsl_fft_complex_transform().
gsl_fft_direction direction
Typedef for fft::direction.
size_t n(workspace const &w)
C++ version of gsl_rstat_n().
The gsl package creates an interface to the GNU Scientific Library for C++.
gsl_complex_packed_array complex_packed_array
Typedef.
short sign(T const &x)
Find the sign of x: returns +1 for a value of zero to be consistent with GNU Scientific Library.