odeint-v2 icon indicating copy to clipboard operation
odeint-v2 copied to clipboard

ODEINT Controlled Steppers do not work with complex thrust device vectors as state type.

Open Vishwatosh opened this issue 5 years ago • 3 comments

I found that the controlled steppers of ODEINT are not working when the state_type is a thrust::device_vector<thrust::complex>. Does anyone else have the same problem. It would be very helpful if anyone can please suggest a possible solution for the problem?

Vishwatosh avatar Jun 05 '20 10:06 Vishwatosh

I solved it by recasting the vector into thrust::device_vector before transferring it to the odeint-function. In my RHS-function I casted it back into thrust::device_vectorthrust::complex. I know that that is not the best approach, but at least a workaround.

anates avatar Jul 15 '20 12:07 anates

Hi Anates, Thanks for your reply. As far as I understand from your reply that you convert the device_vector of thrust::complex to the device_vector of (something like interleaved real and imaginary parts in the new device vector) before entering the system function of the ODEINT and then convert the final result back to a device_vector of thrust::complex? Could you kindly confirm if my understanding is correct. I am asking this because I have used this method as a workaround.

Thanks a lot!

Vishwatosh avatar Jul 20 '20 11:07 Vishwatosh

Yes, more or less like that. Before entering the boost::odeint-function I recasted it into a -vector, and within my right hand side function it was casted back into a thrust::complex-vector. The return-value of the RHS was re-casted into double, and casted back into thrust::complex afterwards

anates avatar Jul 20 '20 12:07 anates