问题
How can I use Blas to multiply a real matrix with a complex vector ? When I use functions like ccsrgemv() I get type mismatch errors?
error: argument of type "float *" is incompatible with parameter of type "std::complex<float> *"
回答1:
Use two matrix-vector multiplications (A * (x + iy) = A * x + i A * y). More precisely, consider your complex vector as two entangled real vectors with stride 2. BLAS lets you do this.
UPDATE: actually, I did not notice that you were doing Sparse BLAS. For dgemv
my trick works, but for csrgemv
it doesn't. I'm afraid you have to maintain real and imaginary part separately.
来源:https://stackoverflow.com/questions/7619492/multiplying-real-matrix-with-a-complex-vector-using-blas