Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Vishwatosh opened this issue Jun 5, 2020 · 3 comments

Comments

@Vishwatosh
Copy link

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?

@anates
Copy link

anates commented Jul 15, 2020

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.

@Vishwatosh
Copy link
Author

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!

@anates
Copy link

anates commented Jul 20, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants