Re: [eigen] Array of complex numbers

[ Thread Index | Date Index | More Archives ]


just to be sure I fully understood the operations you're considering, let's assume you have:

VectorXcf A1(300), A2(300), ...;
complex<float> c1, c2, ...;
float r1, r2, ...;

then "Scalar product" means:

 and "Linear combination" means:

r1*A1 + r2*A2 + .... 

If this is right, then linear combination with real coefficients should already be 100% optimal and the only problematic operation could be dot products because of the complex*complex product overhead. I think those can be optimized while keeping an AoS layout by accumulating within multiple packets that we combine only at the end of the reduction instead of doing and expensive combination for every product. This is similar to what we do in GEMM.

I gave it a shot, and I get similar speed than with a SoA layout. See attached file. This is a proof of concept : AVX only, no conjugation, n%16==0, etc.

I think this can be integrated within Eigen by generalizing a bit the current reduction code to allow for custom accumulation packets.


Attachment: bench_cplx_dotprod.cpp
Description: Binary data

Mail converted by MHonArc 2.6.19+