20#ifndef CCGSL_FFT_REAL_HPP
21#define CCGSL_FFT_REAL_HPP
23#include <gsl/gsl_fft_real.h>
44 inline int transform(
double data[],
size_t const stride,
size_t const n ){
45 return gsl_fft_real_radix2_transform( data, stride,
n ); }
54 template<
typename DATA>
55 inline int transform( DATA& data,
size_t const stride = 1 ){
56 return gsl_fft_real_radix2_transform( data.data(), stride, data.size() / stride ); }
65 return gsl_fft_real_radix2_transform( data, 1,
n ); }
89 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
139#ifdef __GXX_EXPERIMENTAL_CXX0X__
145 std::swap(
count, v.count );
146 v.ccgsl_pointer =
nullptr;
154 wavetable( std::move( v ) ).swap( *
this );
264#ifdef __GXX_EXPERIMENTAL_CXX0X__
291 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
341#ifdef __GXX_EXPERIMENTAL_CXX0X__
347 std::swap(
count, v.count );
348 v.ccgsl_pointer =
nullptr;
356 workspace( std::move( v ) ).swap( *
this );
466#ifdef __GXX_EXPERIMENTAL_CXX0X__
481 inline int transform(
double data[],
size_t const stride,
size_t const n,
483 return gsl_fft_real_transform( data, stride,
n,
wavetable.
get(), work.
get() ); }
493 inline int unpack(
double const real_coefficient[],
double complex_coefficient[],
494 size_t const stride,
size_t const n ){
495 return gsl_fft_real_unpack( real_coefficient, complex_coefficient, stride,
n ); }
506 template<
typename DATA>
508 return gsl_fft_real_transform( data.data(), stride, data.size() / stride,
519 template<
typename R,
typename C>
520 inline int unpack( R
const& real_coefficient, C& complex_coefficient,
size_t const stride ){
521 size_t n =
std::max( real_coefficient.size(), complex_coefficient.size() / 2) / stride;
522 return gsl_fft_real_unpack( real_coefficient.data(), complex_coefficient.data(),
537 size_t n =
std::max( real_coefficient.
size(), complex_coefficient.
size() ) / stride;
538 return gsl_fft_real_unpack( real_coefficient.
data(), complex_coefficient.
data(),
562 inline int unpack(
double const real_coefficient[],
double complex_coefficient[],
size_t const n ){
563 return gsl_fft_real_unpack( real_coefficient, complex_coefficient, 1,
n ); }
573 template<
typename DATA>
575 return gsl_fft_real_transform( data.data(), 1, data.size(),
585 template<
typename R,
typename C>
586 inline int unpack( R
const& real_coefficient, C& complex_coefficient ){
587 size_t n =
std::max( real_coefficient.size(), complex_coefficient.size() / 2);
588 return gsl_fft_real_unpack( real_coefficient.data(), complex_coefficient.data(),
603 return gsl_fft_real_unpack( real_coefficient.
data(), complex_coefficient.
data(),
C++ version of gsl_fft_real_wavetable functions.
bool empty() const
Find if the wavetable is empty.
void swap(wavetable &v)
Swap two wavetable.
wavetable(wavetable &&v)
Move constructor.
size_t use_count() const
Find how many workspace objects share this pointer.
wavetable(gsl_fft_real_wavetable *v)
Could construct from a gsl_fft_real_wavetable.
gsl_fft_real_wavetable * ccgsl_pointer
The shared pointer.
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.
bool operator>=(wavetable const &v) const
A container needs to define an ordering for sorting.
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.
gsl_fft_real_wavetable * get() const
Get the gsl_fft_real_wavetable.
wavetable & operator=(wavetable const &v)
The assignment operator.
size_t * count
The shared reference count.
bool unique() const
Find if this is the only object sharing the gsl_fft_real_wavetable.
~wavetable()
The destructor only deletes the pointers if count reaches zero.
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 operator==(wavetable const &v) const
Two wavetable are identically equal if their elements are identical.
Workspace for real fast fourier transforms.
bool unique() const
Find if this is the only object sharing the gsl_fft_real_workspace.
bool empty() const
Find if the workspace is empty.
workspace(gsl_fft_real_workspace *v)
Could construct from a gsl_fft_real_workspace.
gsl_fft_real_workspace * ccgsl_pointer
The shared pointer.
size_t * count
The shared reference count.
bool operator==(workspace const &v) const
Two workspace are identically equal if their elements are identical.
bool operator<(workspace const &v) const
A container needs to define an ordering for sorting.
workspace & operator=(workspace &&v)
Move operator.
workspace()
The default constructor is only really useful for assigning to.
bool operator>(workspace const &v) const
A container needs to define an ordering for sorting.
gsl_fft_real_workspace * get() const
Get the gsl_fft_real_workspace.
bool operator<=(workspace const &v) const
A container needs to define an ordering for sorting.
workspace(workspace &&v)
Move constructor.
workspace & operator=(workspace const &v)
The assignment operator.
bool operator!=(workspace const &v) const
Two workspace are different equal if their elements are not identical.
~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.
void swap(workspace &v)
Swap two workspace.
workspace(workspace const &v)
The copy constructor.
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.
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 transform(double data[], size_t const stride, size_t const n)
C++ version of gsl_fft_real_radix2_transform().
int transform(double data[], size_t const stride, size_t const n, wavetable const &wavetable, workspace &work)
C++ version of gsl_fft_real_transform().
int unpack(double const real_coefficient[], double complex_coefficient[], size_t const stride, size_t const n)
C++ version of gsl_fft_real_unpack().
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++.