Registered Member
|
I have one cx_mat, "cx_mat X" ,i need convert X.real() to double xr[], and X.imag() to double xi[], how can i do it fastly?
Thank you |
Moderator
|
What is cx_mat? Anyway, assuming it's equivalent to a MatrixXcd, if you want to extract the real and imaginary part as sequential buffers, then you first need to copy them to MatrixXd:
MatrixXcd X; MatrixXd R, I; R = X.real(); I = X.imag(); double* xr = R.data(); double* xi = I.data(); If you can deal with interleaved real/imag parts, then: double* xr = &numext::real_ref(X(0,0)); double* xi = xr+1; and then: i-th real part == xr[2*i] i-th imag part == xi[2*i] |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft