简体   繁体   English

使用BLAS将实矩阵与复矢量相乘

[英]Multiplying real matrix with a complex vector using BLAS

How can I use Blas to multiply a real matrix with a complex vector ? 如何使用Blas将实矩阵与复矢量相乘? When I use functions like ccsrgemv() I get type mismatch errors? 当我使用像ccsrgemv()这样的函数时,我得到类型不匹配错误?

error: argument of type "float *" is incompatible with parameter of type "std::complex<float> *"

Use two matrix-vector multiplications (A * (x + iy) = A * x + i A * y). 使用两个矩阵向量乘法(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. 更准确地说,将复杂向量视为两个纠缠的实数向量,步长为2. BLAS允许您执行此操作。

UPDATE : actually, I did not notice that you were doing Sparse BLAS. 更新 :实际上,我没有注意到你在做稀疏BLAS。 For dgemv my trick works, but for csrgemv it doesn't. 对于dgemv我的诀窍是有效的,但对于csrgemv它没有。 I'm afraid you have to maintain real and imaginary part separately. 我担心你必须分开维护真实和想象的部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM