git-svn-id: svn://db.shs.com.ru/pip@335 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -52,10 +52,13 @@ include_directories("src")
|
|||||||
foreach(F ${PIP_FOLDERS})
|
foreach(F ${PIP_FOLDERS})
|
||||||
include_directories("src/${F}")
|
include_directories("src/${F}")
|
||||||
file(GLOB HS "src/${F}/*.h")
|
file(GLOB HS "src/${F}/*.h")
|
||||||
|
file(GLOB PHS "src/${F}/*_p.h")
|
||||||
file(GLOB CS "src/${F}/*.cpp")
|
file(GLOB CS "src/${F}/*.cpp")
|
||||||
list(APPEND HDRS ${HS})
|
list(APPEND HDRS ${HS})
|
||||||
|
list(APPEND PHDRS ${PHS})
|
||||||
list(APPEND CPPS ${CS})
|
list(APPEND CPPS ${CS})
|
||||||
endforeach(F)
|
endforeach(F)
|
||||||
|
list(REMOVE_ITEM HDRS ${PHDRS})
|
||||||
|
|
||||||
# Check Bessel functions
|
# Check Bessel functions
|
||||||
set(CMAKE_REQUIRED_INCLUDES math.h)
|
set(CMAKE_REQUIRED_INCLUDES math.h)
|
||||||
@@ -150,7 +153,7 @@ if (FFTW)
|
|||||||
if (WIN32)
|
if (WIN32)
|
||||||
list(APPEND LIBS fftw3-3 fftw3f-3 fftw3l-3)
|
list(APPEND LIBS fftw3-3 fftw3f-3 fftw3l-3)
|
||||||
else ()
|
else ()
|
||||||
list(APPEND LIBS fftw3 fftw3f fftw3l)
|
list(APPEND LIBS fftw3 fftw3f)
|
||||||
endif ()
|
endif ()
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Building without fftw3 support")
|
message(STATUS "Building without fftw3 support")
|
||||||
@@ -183,7 +186,7 @@ if (WIN32)
|
|||||||
list(APPEND LIBS ws2_32 iphlpapi psapi)
|
list(APPEND LIBS ws2_32 iphlpapi psapi)
|
||||||
list(APPEND CPPS "pip_resource_win.rc")
|
list(APPEND CPPS "pip_resource_win.rc")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPSAPI_VERSION=1")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPSAPI_VERSION=1")
|
||||||
add_library(pip SHARED ${CPPS} ${HDRS})
|
add_library(pip SHARED ${CPPS} ${HDRS} ${PHDRS})
|
||||||
if (${CMAKE_C_COMPILER} STREQUAL "cl")
|
if (${CMAKE_C_COMPILER} STREQUAL "cl")
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
generate_export_header(pip)
|
generate_export_header(pip)
|
||||||
|
|||||||
3
main.cpp
3
main.cpp
@@ -43,8 +43,9 @@ int asize(ssize_t s, size_t pid_rsize) {
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
PIFFTWf fft;
|
PIFFTWf fft;
|
||||||
PIVector<float> in;
|
PIVector<float> in;
|
||||||
for (int i = 0; i < 32; ++i)
|
for (int i = 0; i < 50; ++i)
|
||||||
in << i%10;
|
in << i%10;
|
||||||
|
fft.preparePlan(50, PIFFTWf::foReal);
|
||||||
PIVector<complexf> out = fft.calcFFT(in);
|
PIVector<complexf> out = fft.calcFFT(in);
|
||||||
piCout << out;
|
piCout << out;
|
||||||
/*for (int i = 0; i < 16; ++i) {
|
/*for (int i = 0; i < 16; ++i) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ PICrypt::PICrypt() {
|
|||||||
randombytes_buf(key_.data(), key_.size());
|
randombytes_buf(key_.data(), key_.size());
|
||||||
randombytes_buf(nonce_.data(), nonce_.size());
|
randombytes_buf(nonce_.data(), nonce_.size());
|
||||||
#else
|
#else
|
||||||
piCout << "[PICrypt]" << "Warning: PICrypt is disabled, to enable install sodium library and build pip with -DCRYPT=";
|
piCout << "[PICrypt]" << "Warning: PICrypt is disabled, to enable install libsodium-dev library and build pip with -DCRYPT=1";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void operator =(const PIFFTW & );
|
void operator =(const PIFFTW & );
|
||||||
|
PIFFTW(const PIFFTW &);
|
||||||
inline void newP(void *& _p) {}
|
inline void newP(void *& _p) {}
|
||||||
inline void deleteP(void *& _p) {}
|
inline void deleteP(void *& _p) {}
|
||||||
|
|
||||||
@@ -167,6 +168,8 @@ template<> inline void PIFFTW<float>::preparePlan(int size, FFT_Operation op) {(
|
|||||||
template<> inline void PIFFTW<float>::newP(void *& _p) {_p = new _PIFFTW_P_float_();}
|
template<> inline void PIFFTW<float>::newP(void *& _p) {_p = new _PIFFTW_P_float_();}
|
||||||
template<> inline void PIFFTW<float>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_float_*)_p; _p = 0;}
|
template<> inline void PIFFTW<float>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_float_*)_p; _p = 0;}
|
||||||
|
|
||||||
|
typedef PIFFTW<float> PIFFTWf;
|
||||||
|
|
||||||
|
|
||||||
template<> inline const PIVector<complex<double> > & PIFFTW<double>::calcFFT(const PIVector<complex<double> > & in) {return ((_PIFFTW_P_double_*)p)->calcFFT(in);}
|
template<> inline const PIVector<complex<double> > & PIFFTW<double>::calcFFT(const PIVector<complex<double> > & in) {return ((_PIFFTW_P_double_*)p)->calcFFT(in);}
|
||||||
template<> inline const PIVector<complex<double> > & PIFFTW<double>::calcFFT(const PIVector<double> & in) {return ((_PIFFTW_P_double_*)p)->calcFFTR(in);}
|
template<> inline const PIVector<complex<double> > & PIFFTW<double>::calcFFT(const PIVector<double> & in) {return ((_PIFFTW_P_double_*)p)->calcFFTR(in);}
|
||||||
@@ -175,7 +178,10 @@ template<> inline void PIFFTW<double>::preparePlan(int size, FFT_Operation op) {
|
|||||||
template<> inline void PIFFTW<double>::newP(void *& _p) {_p = new _PIFFTW_P_double_();}
|
template<> inline void PIFFTW<double>::newP(void *& _p) {_p = new _PIFFTW_P_double_();}
|
||||||
template<> inline void PIFFTW<double>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_double_*)_p; _p = 0;}
|
template<> inline void PIFFTW<double>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_double_*)_p; _p = 0;}
|
||||||
|
|
||||||
|
typedef PIFFTW<double> PIFFTWd;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFT(in);}
|
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFT(in);}
|
||||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<ldouble> & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTR(in);}
|
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFT(const PIVector<ldouble> & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTR(in);}
|
||||||
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFTinverse(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTI(in);}
|
template<> inline const PIVector<complex<ldouble> > & PIFFTW<ldouble>::calcFFTinverse(const PIVector<complex<ldouble> > & in) {return ((_PIFFTW_P_ldouble_*)p)->calcFFTI(in);}
|
||||||
@@ -183,10 +189,7 @@ template<> inline void PIFFTW<ldouble>::preparePlan(int size, FFT_Operation op)
|
|||||||
template<> inline void PIFFTW<ldouble>::newP(void *& _p) {_p = new _PIFFTW_P_ldouble_();}
|
template<> inline void PIFFTW<ldouble>::newP(void *& _p) {_p = new _PIFFTW_P_ldouble_();}
|
||||||
template<> inline void PIFFTW<ldouble>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_ldouble_*)_p; _p = 0;}
|
template<> inline void PIFFTW<ldouble>::deleteP(void *& _p) {if (_p) delete (_PIFFTW_P_ldouble_*)_p; _p = 0;}
|
||||||
|
|
||||||
|
|
||||||
typedef PIFFTW<float> PIFFTWf;
|
|
||||||
typedef PIFFTW<double> PIFFTWd;
|
|
||||||
typedef PIFFTW<ldouble> PIFFTWld;
|
typedef PIFFTW<ldouble> PIFFTWld;
|
||||||
|
#endif // WINDOWS
|
||||||
|
|
||||||
#endif // PIFFT_H
|
#endif // PIFFT_H
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "pivector.h"
|
#include "pivector.h"
|
||||||
#include "pimutex.h"
|
#include "pimutex.h"
|
||||||
#include <complex.h>
|
#include "picout.h"
|
||||||
#ifdef PIP_FFTW
|
#ifdef PIP_FFTW
|
||||||
# include "fftw3.h"
|
# include "fftw3.h"
|
||||||
#else
|
#else
|
||||||
@@ -36,106 +36,136 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static PIMutex __pip_fft_plan_mutex;
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class PIFFTW_Private
|
class PIFFTW_Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PIFFTW_Private() {plan = 0; newPlan(plan);}
|
explicit PIFFTW_Private() {
|
||||||
~PIFFTW_Private() {deletePlan(plan);}
|
plan = 0;
|
||||||
|
#ifdef PIP_FFTW
|
||||||
|
// fftwf_m
|
||||||
|
#else
|
||||||
|
piCout << "[PIFFTW]" << "Warning: PIFFTW is disabled, to enable install libfftw3-dev library and build pip with -DFFTW=1";
|
||||||
|
#endif
|
||||||
|
p_makeThreadSafe();
|
||||||
|
}
|
||||||
|
~PIFFTW_Private() {p_destroyPlan(plan);}
|
||||||
|
|
||||||
const PIVector<complex<T> > & calcFFT(const PIVector<complex<T> > & in) {
|
const PIVector<complex<T> > & calcFFT(const PIVector<complex<T> > & in) {
|
||||||
result.resize(in.size());
|
if (prepare != PlanParams(in.size(), fo_complex)) {
|
||||||
__pip_fft_plan_mutex.lock();
|
p_out.resize(in.size());
|
||||||
createPlan_c_1d(plan, in.size_s(), in.data(), result.data(), FFTW_FORWARD, FFTW_ESTIMATE);
|
piCout << "[PIFFTW]" << "creating plan";
|
||||||
__pip_fft_plan_mutex.unlock();
|
p_createPlan_c2c_1d(plan, in.size(), in.data(), p_out.data(), FFTW_FORWARD, FFTW_ESTIMATE | FFTW_UNALIGNED);
|
||||||
executePlan(plan);
|
prepare = PlanParams(in.size(), fo_complex);
|
||||||
destroyPlan(plan);
|
}
|
||||||
return result;
|
p_executePlan_c2c(plan, in.data(), p_out.data());
|
||||||
|
return p_out;
|
||||||
}
|
}
|
||||||
const PIVector<complex<T> > & calcFFT(const PIVector<T> & in) {
|
const PIVector<complex<T> > & calcFFT(const PIVector<T> & in) {
|
||||||
result.resize(in.size());
|
if (prepare != PlanParams(in.size(), fo_real)) {
|
||||||
__pip_fft_plan_mutex.lock();
|
p_out.resize(in.size());
|
||||||
createPlan_r2c_1d(plan, in.size_s(), in.data(), result.data(), FFTW_ESTIMATE);
|
piCout << "[PIFFTW]" << "creating plan";
|
||||||
__pip_fft_plan_mutex.unlock();
|
p_createPlan_r2c_1d(plan, in.size(), in.data(), p_out.data(), FFTW_ESTIMATE | FFTW_UNALIGNED);
|
||||||
executePlan(plan);
|
prepare = PlanParams(in.size(), fo_real);
|
||||||
destroyPlan(plan);
|
}
|
||||||
return result;
|
p_executePlan_r2c(plan, in.data(), p_out.data());
|
||||||
|
return p_out;
|
||||||
}
|
}
|
||||||
const PIVector<complex<T> > & calcFFTinverse(const PIVector<complex<T> > & in) {
|
const PIVector<complex<T> > & calcFFTinverse(const PIVector<complex<T> > & in) {
|
||||||
result.resize(in.size());
|
if (prepare != PlanParams(in.size(), fo_inverse)) {
|
||||||
__pip_fft_plan_mutex.lock();
|
p_out.resize(in.size());
|
||||||
createPlan_c_1d(plan, in.size_s(), in.data(), result.data(), FFTW_BACKWARD, FFTW_ESTIMATE);
|
piCout << "[PIFFTW]" << "creating plan";
|
||||||
__pip_fft_plan_mutex.unlock();
|
p_createPlan_c2c_1d(plan, in.size(), in.data(), p_out.data(), FFTW_BACKWARD, FFTW_ESTIMATE | FFTW_UNALIGNED);
|
||||||
executePlan(plan);
|
prepare = PlanParams(in.size(), fo_inverse);
|
||||||
destroyPlan(plan);
|
}
|
||||||
return result;
|
p_executePlan_c2c(plan, in.data(), p_out.data());
|
||||||
|
return p_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum FFT_Operation {fo_real, fo_complex, fo_inverse};
|
enum FFT_Operation {fo_real, fo_complex, fo_inverse};
|
||||||
|
|
||||||
void preparePlan(int size, int op) {
|
void preparePlan(int size, int op) {
|
||||||
PIVector<complex<T> > in(size), out(size);
|
p_inr.clear();
|
||||||
PIVector<T> inr(size);
|
p_in.clear();
|
||||||
__pip_fft_plan_mutex.lock();
|
p_out.clear();
|
||||||
switch ((FFT_Operation)op) {
|
switch ((FFT_Operation)op) {
|
||||||
case fo_real:
|
case fo_real:
|
||||||
createPlan_r2c_1d(plan, in.size_s(), inr.data(), out.data(), FFTW_MEASURE);
|
p_inr.resize(size);
|
||||||
|
p_out.resize(size);
|
||||||
|
p_createPlan_r2c_1d(plan, size, p_inr.data(), p_out.data(), FFTW_MEASURE | FFTW_UNALIGNED);
|
||||||
break;
|
break;
|
||||||
case fo_complex:
|
case fo_complex:
|
||||||
createPlan_c_1d(plan, in.size_s(), in.data(), out.data(), FFTW_FORWARD, FFTW_MEASURE);
|
p_in.resize(size);
|
||||||
|
p_out.resize(size);
|
||||||
|
p_createPlan_c2c_1d(plan, size, p_in.data(), p_out.data(), FFTW_FORWARD, FFTW_MEASURE | FFTW_UNALIGNED);
|
||||||
break;
|
break;
|
||||||
case fo_inverse:
|
case fo_inverse:
|
||||||
createPlan_c_1d(plan, in.size_s(), in.data(), out.data(), FFTW_BACKWARD, FFTW_MEASURE);
|
p_in.resize(size);
|
||||||
|
p_out.resize(size);
|
||||||
|
p_createPlan_c2c_1d(plan, size, p_in.data(), p_out.data(), FFTW_BACKWARD, FFTW_MEASURE | FFTW_UNALIGNED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
size = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
__pip_fft_plan_mutex.unlock();
|
prepare = PlanParams(size, (FFT_Operation)op);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void createPlan_c_1d(void * plan, int size, const void * in, void * out, int dir, int flags) {}
|
inline void p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {}
|
||||||
inline void createPlan_r2c_1d(void * plan, int size, const void * in, void * out, int flags) {}
|
inline void p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {}
|
||||||
inline void executePlan(void * plan) {}
|
inline void p_executePlan_c2c(void * plan, const void * in, void * out) {}
|
||||||
inline void destroyPlan(void * plan) {}
|
inline void p_executePlan_r2c(void * plan, const void * in, void * out) {}
|
||||||
inline void newPlan(void *& plan) {}
|
inline void p_destroyPlan(void *& plan) {}
|
||||||
inline void deletePlan(void *& plan) {}
|
inline void p_makeThreadSafe() {}
|
||||||
|
|
||||||
PIVector<complex<T> > result;
|
struct PlanParams {
|
||||||
|
PlanParams() {size = 0; op = fo_complex;}
|
||||||
|
PlanParams(int size_, FFT_Operation op_) {size = size_; op = op_;}
|
||||||
|
bool isValid() {return size > 0;}
|
||||||
|
bool operator ==(const PlanParams & v) const {return (v.size == size) && (v.op == op);}
|
||||||
|
bool operator !=(const PlanParams & v) const {return !(*this == v);}
|
||||||
|
int size;
|
||||||
|
FFT_Operation op;
|
||||||
|
};
|
||||||
|
|
||||||
|
PIVector<complex<T> > p_in;
|
||||||
|
PIVector<T> p_inr;
|
||||||
|
PIVector<complex<T> > p_out;
|
||||||
void * plan;
|
void * plan;
|
||||||
|
PlanParams prepare;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef PIP_FFTW
|
#ifdef PIP_FFTW
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||||
|
plan = fftwf_plan_dft_1d(size, (fftwf_complex *)in, (fftwf_complex *)out, dir, flags);}
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
|
||||||
|
plan = fftwf_plan_dft_r2c_1d(size, (float *)in, (fftwf_complex *)out, flags);}
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftwf_execute_dft((fftwf_plan)plan, (fftwf_complex *)in, (fftwf_complex *)out);}
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftwf_execute_dft_r2c((fftwf_plan)plan, (float *)in, (fftwf_complex *)out);}
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_destroyPlan(void *& plan) {if (plan) fftwf_destroy_plan((fftwf_plan)plan); plan = 0;}
|
||||||
|
template<> inline void PIFFTW_Private<float>::p_makeThreadSafe() {fftwf_make_planner_thread_safe();}
|
||||||
|
|
||||||
template<> inline void PIFFTW_Private<float>::createPlan_c_1d(void * plan, int size, const void * in, void * out, int dir, int flags) {
|
template<> inline void PIFFTW_Private<double>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||||
*(fftwf_plan*)plan = fftwf_plan_dft_1d(size, (fftwf_complex *)in, (fftwf_complex *)out, dir, flags);}
|
plan = fftw_plan_dft_1d(size, (fftw_complex *)in, (fftw_complex *)out, dir, flags);}
|
||||||
template<> inline void PIFFTW_Private<float>::createPlan_r2c_1d(void * plan, int size, const void * in, void * out, int flags) {
|
template<> inline void PIFFTW_Private<double>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
|
||||||
*(fftwf_plan*)plan = fftwf_plan_dft_r2c_1d(size, (float *)in, (fftwf_complex *)out, flags);}
|
plan = fftw_plan_dft_r2c_1d(size, (double *)in, (fftw_complex *)out, flags);}
|
||||||
template<> inline void PIFFTW_Private<float>::executePlan(void * plan) {fftwf_execute(*(fftwf_plan*)plan);}
|
template<> inline void PIFFTW_Private<double>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftw_execute_dft((fftw_plan)plan, (fftw_complex *)in, (fftw_complex *)out);}
|
||||||
template<> inline void PIFFTW_Private<float>::destroyPlan(void * plan) {fftwf_destroy_plan(*(fftwf_plan*)plan);}
|
template<> inline void PIFFTW_Private<double>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftw_execute_dft_r2c((fftw_plan)plan, (double *)in, (fftw_complex *)out);}
|
||||||
template<> inline void PIFFTW_Private<float>::newPlan(void *& plan) {plan = new fftwf_plan();}
|
template<> inline void PIFFTW_Private<double>::p_destroyPlan(void *& plan) {if (plan) fftw_destroy_plan((fftw_plan)plan); plan = 0;}
|
||||||
template<> inline void PIFFTW_Private<float>::deletePlan(void *& plan) {if (plan) delete (fftwf_plan*)plan; plan = 0;}
|
template<> inline void PIFFTW_Private<double>::p_makeThreadSafe() {fftw_make_planner_thread_safe();}
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_createPlan_c2c_1d(void *& plan, int size, const void * in, void * out, int dir, int flags) {
|
||||||
|
plan = fftwl_plan_dft_1d(size, (fftwl_complex *)in, (fftwl_complex *)out, dir, flags);}
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_createPlan_r2c_1d(void *& plan, int size, const void * in, void * out, int flags) {
|
||||||
|
plan = fftwl_plan_dft_r2c_1d(size, (ldouble *)in, (fftwl_complex *)out, flags);}
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_executePlan_c2c(void * plan, const void * in, void * out) {fftwl_execute_dft((fftwl_plan)plan, (fftwl_complex *)in, (fftwl_complex *)out);}
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_executePlan_r2c(void * plan, const void * in, void * out) {fftwl_execute_dft_r2c((fftwl_plan)plan, (ldouble *)in, (fftwl_complex *)out);}
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_destroyPlan(void *& plan) {if (plan) fftwl_destroy_plan((fftwl_plan)plan); plan = 0;}
|
||||||
|
template<> inline void PIFFTW_Private<ldouble>::p_makeThreadSafe() {fftwl_make_planner_thread_safe();}
|
||||||
|
#endif // WINDOWS
|
||||||
|
|
||||||
template<> inline void PIFFTW_Private<double>::createPlan_c_1d(void * plan, int size, const void * in, void * out, int dir, int flags) {
|
|
||||||
*(fftw_plan*)plan = fftw_plan_dft_1d(size, (fftw_complex *)in, (fftw_complex *)out, dir, flags);}
|
|
||||||
template<> inline void PIFFTW_Private<double>::createPlan_r2c_1d(void * plan, int size, const void * in, void * out, int flags) {
|
|
||||||
*(fftw_plan*)plan = fftw_plan_dft_r2c_1d(size, (double *)in, (fftw_complex *)out, flags);}
|
|
||||||
template<> inline void PIFFTW_Private<double>::executePlan(void * plan) {fftw_execute(*(fftw_plan*)plan);}
|
|
||||||
template<> inline void PIFFTW_Private<double>::destroyPlan(void * plan) {fftw_destroy_plan(*(fftw_plan*)plan);}
|
|
||||||
template<> inline void PIFFTW_Private<double>::newPlan(void *& plan) {plan = new fftw_plan();}
|
|
||||||
template<> inline void PIFFTW_Private<double>::deletePlan(void *& plan) {if (plan) delete (fftw_plan*)plan; plan = 0;}
|
|
||||||
|
|
||||||
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::createPlan_c_1d(void * plan, int size, const void * in, void * out, int dir, int flags) {
|
|
||||||
*(fftwl_plan*)plan = fftwl_plan_dft_1d(size, (fftwl_complex *)in, (fftwl_complex *)out, dir, flags);}
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::createPlan_r2c_1d(void * plan, int size, const void * in, void * out, int flags) {
|
|
||||||
*(fftwl_plan*)plan = fftwl_plan_dft_r2c_1d(size, (ldouble *)in, (fftwl_complex *)out, flags);}
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::executePlan(void * plan) {fftwl_execute(*(fftwl_plan*)plan);}
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::destroyPlan(void * plan) {fftwl_destroy_plan(*(fftwl_plan*)plan);}
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::newPlan(void *& plan) {plan = new fftwl_plan();}
|
|
||||||
template<> inline void PIFFTW_Private<ldouble>::deletePlan(void *& plan) {if (plan) delete (fftwl_plan*)plan; plan = 0;}
|
|
||||||
|
|
||||||
#endif // PIP_FFTW
|
#endif // PIP_FFTW
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user