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

Initializing states from numpy array #519

Open
1 task done
JacobHast opened this issue Nov 5, 2024 · 1 comment
Open
1 task done

Initializing states from numpy array #519

JacobHast opened this issue Nov 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@JacobHast
Copy link
Contributor

Before posting a feature request

  • I have searched exisisting GitHub issues to make sure the feature request does not already exist.

Feature details

I would like initialize a state using the syntax mm.State.from_fock(modes=[0], array=numpy_array) where numpy_array is a 1-dimensional numpy array. This should return a pure state with the values in numpy_array as Fock-basis coefficients.
Right now, an error is thrown if I try this. Also, the example code in the doc string throws an error, "'Coherent' object has no attribute 'ansatz'" array = Coherent(modes, x=0.1).to_fock().ansatz.array

I believe that this can also be done

Implementation

No response

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

No response

@JacobHast JacobHast added the enhancement New feature or request label Nov 5, 2024
@ziofil
Copy link
Collaborator

ziofil commented Nov 5, 2024

Hi Jacob. Are you using lab? If so you should switch to lab_dev. Try Ket.from_fock

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

No branches or pull requests

2 participants