Accumulating complex number using boost compute problem
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Description
this below code face with a compile error, but it is reasonable to accumulate complex number (because I can accumulate complex number using boost compute with boost::transfare_reduce so this should be also reasonable to works with complex numbers)
```
#include
#include
#include
#include
#include
namespace compute = boost::compute;
int main()
{
compute::vector> v;
compute::accumulate(v.begin(),v.end(),std::complex(0,0));
}
```
and I face with below compile error
```
In file included from ~/boost/compute/memory_object.hpp:16:0,
from ~/boost/compute/buffer.hpp:17,
from ~/boost/compute/core.hpp:18,
from ~/main.cpp:1:
~/boost/compute/kernel.hpp: In instantiation of ‘struct boost::compute::detail::set_kernel_arg >’:
~/boost/compute/kernel.hpp:251:17: required from ‘void boost::compute::kernel::set_arg(size_t, const T&) [with T = std::complex; size_t = long unsigned int]’
~/boost/compute/algorithm/detail/serial_accumulate.hpp:46:5: required from ‘void boost::compute::detail::serial_accumulate(InputIterator, InputIterator, OutputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; OutputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:46:30: required from ‘T boost::compute::detail::generic_accumulate(InputIterator, InputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:118:34: required from ‘T boost::compute::detail::dispatch_accumulate(InputIterator, InputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:182:39: required from ‘T boost::compute::accumulate(InputIterator, InputIterator, T, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex]’
~/main.cpp:22:70: required from here
~/boost/compute/kernel.hpp:398:5: error: no type named ‘type’ in ‘struct boost::enable_if >, void>’
operator()(kernel &kernel_, size_t index, const T &value)
^~~~~~~~
In file included from ~/boost/compute/memory_object.hpp:16:0,
from ~/boost/compute/buffer.hpp:17,
from ~/boost/compute/core.hpp:18,
from ~/main.cpp:1:
~/boost/compute/kernel.hpp: In instantiation of ‘void boost::compute::kernel::set_arg(size_t, const T&) [with T = std::complex; size_t = long unsigned int]’:
~/boost/compute/algorithm/detail/serial_accumulate.hpp:46:5: required from ‘void boost::compute::detail::serial_accumulate(InputIterator, InputIterator, OutputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; OutputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:46:30: required from ‘T boost::compute::detail::generic_accumulate(InputIterator, InputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:118:34: required from ‘T boost::compute::detail::dispatch_accumulate(InputIterator, InputIterator, T, BinaryFunction, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex; BinaryFunction = boost::compute::plus >]’
~/boost/compute/algorithm/accumulate.hpp:182:39: required from ‘T boost::compute::accumulate(InputIterator, InputIterator, T, boost::compute::command_queue&) [with InputIterator = boost::compute::buffer_iterator >; T = std::complex]’
~/main.cpp:22:70: required from here
~/boost/compute/kernel.hpp:251:36: error: no match for call to ‘(boost::compute::detail::set_kernel_arg >) (boost::compute::kernel&, size_t&, const std::complex&)’
detail::set_kernel_arg()(*this, index, value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
```
Contributor guide
Assessment
This issue has not been assessed yet.