1 #ifndef VTESTBED_CORE_CONVOLUTION_HH 2 #define VTESTBED_CORE_CONVOLUTION_HH 6 #include <vtestbed/base/blitz.hh> 7 #include <vtestbed/core/fourier_transform.hh> 20 template <
class T,
int N>
25 typedef typename transform_type::shape_type shape_type;
26 typedef typename transform_type::array_type array_type;
27 typedef blitz::RectDomain<N> domain_type;
30 shape_type _blockshape;
40 const shape_type& signal_shape,
41 const shape_type& kernel_shape
43 this->shape(signal_shape, kernel_shape);
47 shape(
const shape_type& signal_shape,
const shape_type& kernel_shape);
50 padded_block_shape(
const shape_type& block_size,
const shape_type& padding) {
51 this->check(block_size, padding);
52 this->_blockshape = block_size;
53 this->_padding = padding;
54 this->_fft.shape(this->padded_block_shape());
58 padded_block_shape()
const noexcept {
59 return this->_blockshape + this->_padding;
62 inline const shape_type&
63 block_shape()
const noexcept {
64 return this->_blockshape;
67 inline const shape_type&
68 padding()
const noexcept {
69 return this->_padding;
73 operator()(array_type signal, array_type kernel) {
74 return this->
convolve(signal, kernel);
78 convolve(array_type signal, array_type kernel);
83 check(
const shape_type& blocksize,
const shape_type& padding) {
85 if (!all(padding >= 0)) {
88 if (!all(blocksize > 0)) {
91 if (!all(blocksize >= padding)) {
94 if (!all(is_power_of_two(blocksize + padding))) {
101 const shape_type& signal_shape,
102 const shape_type& kernel_shape
111 #endif // vim:filetype=cpp
Multidimensional convolution based on Fourier transform.
array_type convolve(array_type signal, array_type kernel)