Rust OCL and complex Numbers

Hello,

I am using OpenCL for a project where I need to create a Buffer for complex numbers. So I want to show something like that:

use ocl::{Buffer, MemFlags, ProQue};
pub buffer: Buffer<Complex32>;

can someone share some experience with complex numbers and the ocl crate? I always get this error:

the trait ocl::OclPrm is not implemented for num_complex::Complex<f32>

Does someone knows a workaround or a better way to implement?

Many thanks in advance and can of course share more infos if needed.

You can wrap it with your type and implement the trait for that type.
To wrap it simply do

struct Complex32(Complex<f32>);

The downside to this is you must forward all the traits and functions yourself.

Thank you! I figured it out. It's a pain and not the proper way to wrap it, but it works fine for me. So thanks :slight_smile:

2 Likes