20#ifndef CCGSL_FFT_HALFCOMPLEX_HPP
21#define CCGSL_FFT_HALFCOMPLEX_HPP
23#include <gsl/gsl_fft_halfcomplex.h>
33 namespace halfcomplex {
45 inline int backward(
double data[],
size_t const stride,
size_t const n ){
46 return gsl_fft_halfcomplex_radix2_backward( data, stride,
n ); }
55 inline int inverse(
double data[],
size_t const stride,
size_t const n ){
56 return gsl_fft_halfcomplex_radix2_inverse( data, stride,
n ); }
64 inline int backward(
double data[],
size_t const n ){
65 return gsl_fft_halfcomplex_radix2_backward( data, 1,
n ); }
73 inline int inverse(
double data[],
size_t const n ){
74 return gsl_fft_halfcomplex_radix2_inverse( data, 1,
n ); }
83 template<
typename DATA>
84 inline int backward( DATA& data,
size_t const stride = 1 ){
85 return gsl_fft_halfcomplex_radix2_backward( data.data(), stride, data.size() / stride ); }
94 template<
typename DATA>
95 inline int inverse( DATA& data,
size_t const stride = 1 ){
96 return gsl_fft_halfcomplex_radix2_inverse( data.data(), stride, data.size() / stride ); }
120 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
170#ifdef __GXX_EXPERIMENTAL_CXX0X__
176 std::swap(
count, v.count );
177 v.ccgsl_pointer =
nullptr;
185 wavetable( std::move( v ) ).swap( *
this );
295#ifdef __GXX_EXPERIMENTAL_CXX0X__
312 return gsl_fft_halfcomplex_backward( data, stride,
n,
wavetable.
get(), work.
get() ); }
325 return gsl_fft_halfcomplex_inverse( data, stride,
n,
wavetable.
get(), work.
get() ); }
335 inline int unpack(
double const real_coefficient[],
double complex_coefficient[],
336 size_t const stride,
size_t const n ){
337 return gsl_fft_halfcomplex_unpack( real_coefficient, complex_coefficient, stride,
n ); }
348 template<
typename DATA>
351 return gsl_fft_halfcomplex_backward( data.data(), stride, data.size(),
363 template<
typename DATA>
366 return gsl_fft_halfcomplex_inverse( data.data(), stride, data.size(),
377 template<
typename R,
typename C>
378 inline int unpack( R
const& real_coefficient, C& complex_coefficient,
size_t const stride ){
379 size_t n =
std::max( real_coefficient.size(), complex_coefficient.size() / 2);
380 return gsl_fft_halfcomplex_unpack( real_coefficient.data(), complex_coefficient.data(),
394 size_t const stride ){
396 return gsl_fft_halfcomplex_unpack( real_coefficient.
data(), complex_coefficient.
data(),
411 return gsl_fft_halfcomplex_backward( data, 1,
n,
wavetable.
get(), work.
get() ); }
423 return gsl_fft_halfcomplex_inverse( data, 1,
n,
wavetable.
get(), work.
get() ); }
432 inline int unpack(
double const real_coefficient[],
double complex_coefficient[],
size_t const n ){
433 return gsl_fft_halfcomplex_unpack( real_coefficient, complex_coefficient, 1,
n ); }
443 template<
typename DATA>
446 return gsl_fft_halfcomplex_backward( data.data(), 1, data.size(),
457 template<
typename DATA>
460 return gsl_fft_halfcomplex_inverse( data.data(), 1, data.size(),
470 template<
typename R,
typename C>
471 inline int unpack( R
const& real_coefficient, C& complex_coefficient ){
472 size_t n =
std::max( real_coefficient.size(), complex_coefficient.size() / 2);
473 return gsl_fft_halfcomplex_unpack( real_coefficient.data(), complex_coefficient.data(), 1,
n ); }
485 return gsl_fft_halfcomplex_unpack( real_coefficient.
data(), complex_coefficient.
data(), 1,
n ); }
C++ version of gsl_fft_halfcomplex_wavetable functions.
wavetable(gsl_fft_halfcomplex_wavetable *v)
Could construct from a gsl_fft_halfcomplex_wavetable.
bool unique() const
Find if this is the only object sharing the gsl_fft_halfcomplex_wavetable.
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()
The default constructor is only really useful for assigning to.
wavetable & operator=(wavetable const &v)
The assignment operator.
wavetable(size_t const n)
The default constructor creates a new workspace of size n.
bool operator<=(wavetable const &v) const
A container needs to define an ordering for sorting.
bool empty() const
Find if the wavetable is empty.
wavetable(wavetable const &v)
The copy constructor.
gsl_fft_halfcomplex_wavetable * ccgsl_pointer
The shared pointer.
bool operator==(wavetable const &v) const
Two wavetable are identically equal if their elements are identical.
size_t use_count() const
Find how many workspace objects share this pointer.
size_t * count
The shared reference count.
wavetable & operator=(wavetable &&v)
Move operator.
bool operator!=(wavetable const &v) const
Two wavetable are different equal if their elements are not identical.
void swap(wavetable &v)
Swap two wavetable.
bool operator<(wavetable const &v) const
A container needs to define an ordering for sorting.
~wavetable()
The destructor only deletes the pointers if count reaches zero.
gsl_fft_halfcomplex_wavetable * get() const
Get the gsl_fft_halfcomplex_wavetable.
wavetable(wavetable &&v)
Move constructor.
Workspace for real fast fourier transforms.
gsl_fft_real_workspace * get() const
Get the gsl_fft_real_workspace.
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.
This class handles vector objects as shared handles.
size_type size() const
The size (number of elements) of the vector.
double * data()
Give access to the data block.
int backward(double data[], size_t const stride, size_t const n)
C++ version of gsl_fft_halfcomplex_radix2_backward().
int inverse(double data[], size_t const stride, size_t const n)
C++ version of gsl_fft_halfcomplex_radix2_inverse().
int unpack(double const real_coefficient[], double complex_coefficient[], size_t const stride, size_t const n)
C++ version of gsl_fft_halfcomplex_unpack().
int inverse(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, real::workspace &work)
C++ version of gsl_fft_halfcomplex_inverse().
int backward(gsl::complex_packed_array data, size_t const stride, size_t const n, wavetable const &wavetable, real::workspace &work)
C++ version of gsl_fft_halfcomplex_backward().
int max(movstat::end_t const endtype, vector const &x, vector &y, workspace &w)
C++ version of gsl_movstat_max().
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.