Multiplying real matrix with a complex vector using BLAS

懵懂的女人 提交于 2021-01-26 19:07:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!