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

Move zeroing of hamiltonian outside of the matrix function #28

Open
ksunden opened this issue Dec 31, 2017 · 0 comments
Open

Move zeroing of hamiltonian outside of the matrix function #28

ksunden opened this issue Dec 31, 2017 · 0 comments
Labels

Comments

@ksunden
Copy link
Member

ksunden commented Dec 31, 2017

//TODO: zero once, take this loop out of the inner most loop
for (int i=0; i<ham.nStates * ham.nStates; i++) out[i] = pycuda::complex<double>();

While nice to not need to remember, the zeroing does nothing for any call other than the first. Elements which already have a value will be overwritten. Elements which are zero don't need to be.
This only needs to be done once, not at every time step.

Either move this loop to the calling function (runge-kutta for now), or add a boolean argument to the function, and hide this behind an if statement.

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

No branches or pull requests

1 participant