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

Make functions accept StateVector in addition to Numpy array #253

Open
2 tasks
kevinsung opened this issue Jun 23, 2024 · 3 comments
Open
2 tasks

Make functions accept StateVector in addition to Numpy array #253

kevinsung opened this issue Jun 23, 2024 · 3 comments
Labels
good first issue Good for newcomers

Comments

@kevinsung
Copy link
Collaborator

kevinsung commented Jun 23, 2024

Now that the StateVector class exists, functions that accept vec as a Numpy array should be updated to also accept a StateVector, in which norb and nelec don't also need to be passed.

See sample_state_vector for an example of how to support both input types.

Non-exhaustive list of affected modules:

  • gates/
  • protocols/
@kevinsung kevinsung added the good first issue Good for newcomers label Jun 23, 2024
@tsmanral
Copy link

Hi @kevinsung. Does this issue still exists since this is a very old Issue? If yes, I'd like to assign it to myself and contribute. Please let me know.

@kevinsung
Copy link
Collaborator Author

Hi @kevinsung. Does this issue still exists since this is a very old Issue? If yes, I'd like to assign it to myself and contribute. Please let me know.

@tsmanral Yes, this issue still exists. For an example in the gates module, apply_orbital_rotation still only accepts a Numpy array, and should be update to support StateVector:

Note that StateVector now has an __array__ method, so many Numpy functions should work on it directly.

There's no need for me to assign the issue to you. Feel free to go ahead and open a pull request!

@tsmanral
Copy link

Thank you @kevinsung. I've forked this repo: https://github.com/tsmanral/ffsim/tree/fix-accpt-StateVector and will create a PR to the main after I update it with StateVectors.

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

No branches or pull requests

2 participants