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> *"
In terms of serial complexity, the matrix-vector multiplication is qualified as a quadratic complexity algorithm (or a bilinear complexity algorithm if the matrix is rectangular).
First, multiply Row 1 of the matrix by Column 1 of the vector. Next, multiply Row 2 of the matrix by Column 1 of the vector. Finally multiply Row 3 of the matrix by Column 1 of the vector.
Matrix-vector product So, if A is an m×n matrix (i.e., with n columns), then the product Ax is defined for n×1 column vectors x. If we let Ax=b, then b is an m×1 column vector. In other words, the number of rows in A (which can be anything) determines the number of rows in the product b.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With