Ooplace#
#include <hpk/fft/fft.hpp>
Declares a class template for computing Fast Fourier Transforms out of place,
i.e., the input data is const
and the output data is written to a distinct,
nonoverlapping region of memory.
A free function for conveniently allocating scratch memory is also provided.
TYPEDEFS

template<typename fp_t>
using hpk::fft::OoplaceCC = Ooplace<fp_t, std::complex<fp_t>, std::complex<fp_t>># Convenience type alias for outofplace transforms having complex time and complex frequency domains.

template<typename fp_t>
using hpk::fft::OoplaceRC = Ooplace<fp_t, fp_t, std::complex<fp_t>># Convenience type alias for outofplace transforms having real time domain and complex frequency domain.
CLASS

template<typename fp_t, typename time_t, typename freq_t>
class Ooplace# Abstract class for performing Fast Fourier Transforms outofplace.
Instances of this class are returned by the
makeOoplace()
function of aFactory
. Note that all member functions areconst
qualified. AnOoplace
object is immutable and can be shared in a multithreaded environment.Public Types

using realTimeType = remove_complex_t<timeType>#
Real timeType.

using realFreqType = remove_complex_t<freqType>#
Real freqType.
Public Functions

template<typename Allocator = AlignedAllocator<mathType>, typename in_t, typename out_t>
inline void forwardCopy(const in_t *in, out_t *out, Allocator &&alloc = Allocator()) const# Computes an unscaled outofplace forward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.alloc – Optionally provides an Allocator which will be used if scratch memory is needed. If omitted, an instance of the function’s first template parameter is constructed. If that also is not specified, the default is
hpk::AlignedAllocator
.

template<typename in_t, typename out_t, typename Smartptr>
inline void forwardCopy(const in_t *in, out_t *out, const Smartptr &scratch) const noexcept# Computes an unscaled outofplace forward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.scratch – Smart pointer (e.g.,
std::unique_ptr
) owningscratchSize()
elements ofmathType
to be used as needed for temporary storage in computing the FFT.

template<typename in_t, typename out_t>
inline void forwardCopy(const in_t *in, out_t *out, mathType *scratch) const noexcept# Computes an unscaled outofplace forward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.scratch – Raw pointer to
scratchSize()
elements ofmathType
to be used as needed for temporary storage.

template<typename Allocator = AlignedAllocator<mathType>, typename in_t, typename out_t>
inline void backwardCopy(const in_t *in, out_t *out, Allocator &&alloc = Allocator()) const# Computes an unscaled outofplace backward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.alloc – Optionally provides an Allocator which will be used if scratch memory is needed. If omitted, an instance of the function’s first template parameter is constructed. If that also is not specified, the default is
hpk::AlignedAllocator
.

template<typename in_t, typename out_t, typename Smartptr>
inline void backwardCopy(const in_t *in, out_t *out, const Smartptr &scratch) const noexcept# Computes an unscaled outofplace backward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.scratch – Smart pointer (e.g.,
std::unique_ptr
) owningscratchSize()
elements ofmathType
to be used as needed for temporary storage in computing the FFT.

template<typename in_t, typename out_t>
inline void backwardCopy(const in_t *in, out_t *out, mathType *scratch) const noexcept# Computes an unscaled outofplace backward FFT.
 Parameters:
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.scratch – Raw pointer to
scratchSize()
elements ofmathType
to be used as needed for temporary storage.

template<typename Allocator = AlignedAllocator<mathType>, typename in_t, typename out_t>
inline void scaleForwardCopy(const mathType *scale, const in_t *in, out_t *out, Allocator &&alloc = Allocator()) const# Computes a scaled (by a real value) outofplace forward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.alloc – Optionally provides an Allocator which will be used if scratch memory is needed. If omitted, an instance of the function’s first template parameter is constructed. If that also is not specified, the default is
hpk::AlignedAllocator
.

template<typename in_t, typename out_t, typename Smartptr>
inline void scaleForwardCopy(const mathType *scale, const in_t *in, out_t *out, const Smartptr &scratch) const noexcept# Computes a scaled (by a real value) outofplace forward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.scratch – Smart pointer (e.g.,
std::unique_ptr
) owningscratchSize()
elements ofmathType
to be used as needed for temporary storage in computing the FFT.

template<typename in_t, typename out_t>
inline void scaleForwardCopy(const mathType *scale, const in_t *in, out_t *out, mathType *scratch) const noexcept# Computes a scaled (by a real value) outofplace forward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
timeType*
orrealTimeType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
freqType*
orrealFreqType*
.scratch – Raw pointer to
scratchSize()
elements ofmathType
to be used as needed for temporary storage.

template<typename Allocator = AlignedAllocator<mathType>, typename in_t, typename out_t>
inline void scaleBackwardCopy(const mathType *scale, const in_t *in, out_t *out, Allocator &&alloc = Allocator()) const# Computes a scaled (by a real value) outofplace backward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.alloc – Optionally provides an Allocator which will be used if scratch memory is needed. If omitted, an instance of the function’s first template parameter is constructed. If that also is not specified, the default is
hpk::AlignedAllocator
.

template<typename in_t, typename out_t, typename Smartptr>
inline void scaleBackwardCopy(const mathType *scale, const in_t *in, out_t *out, const Smartptr &scratch) const noexcept# Computes a scaled (by a real value) outofplace backward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.scratch – Smart pointer (e.g.,
std::unique_ptr
) owningscratchSize()
elements ofmathType
to be used as needed for temporary storage in computing the FFT.

template<typename in_t, typename out_t>
inline void scaleBackwardCopy(const mathType *scale, const in_t *in, out_t *out, mathType *scratch) const noexcept# Computes a scaled (by a real value) outofplace backward FFT.
 Parameters:
scale – Pointer to a realvalued scaling factor.
in – Pointer to the input data. Its type can be
freqType*
orrealFreqType*
and can beconst
qualified.out – Pointer to the output data to be written. Its type can be
timeType*
orrealTimeType*
.scratch – Raw pointer to
scratchSize()
elements ofmathType
to be used as needed for temporary storage.

virtual std::size_t scratchSize() const noexcept = 0#
Returns the number of mathType real elements needed as scratch space.

inline std::size_t scratchSizeBytes() const noexcept#
Returns the number of bytes needed as scratch space,
sizeof(mathType) * scratchSize()
.

virtual int maxThreads() const = 0#
Returns an upper bound on the number of threads that could be used.

virtual std::string toString() const = 0#
Returns a short string describing the transform.

template<typename fp_t, typename time_t, typename freq_t>
inline std::ostream &operator<<(std::ostream &os, const Ooplace<fp_t, time_t, freq_t> &fft)# Overload for ostream’s
<<
operator for anOoplace
.

template<typename fp_t, typename Allocator = AlignedAllocator<fp_t>, typename time_t, typename freq_t>
inline auto allocateScratch(const Ooplace<fp_t, time_t, freq_t> &fft, Allocator &&alloc = Allocator())# Allocates scratch memory for an instance of
Ooplace
.Convenience function for allocating the scratch memory needed when using an instance of
hpk::fft::Ooplace
to compute an FFT. The required memory size is obtained fromfft.scratchSize()
, and the return value is constructed usingallocateMemory()
.Example using an instance of an
AlignedAllocator
:auto factory = hpk::fft::makeFactory<float>(); auto fft = factory>makeOoplace({1024}); auto alloc = hpk::AlignedAllocator<float, 128>(); auto scratch = allocateScratch(*fft, alloc); // 128Baligned
 Returns:
std::unique_ptr
that owns the allocated memory

using realTimeType = remove_complex_t<timeType>#