MrMustard icon indicating copy to clipboard operation
MrMustard copied to clipboard

Compute oscillator eigenstate for any angle

Open elib20 opened this issue 1 year ago • 1 comments

Before posting a feature request

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

Feature details

In physics.fock, there is a function to compute the Fock representation of oscillator eigenstates for the q-quadrature, i.e. <n|q>. It is simple to compute <n|R(phi)|q>=exp(i*n)<n|q> as well, but I am not good enough at tensorflow to figure out how to implement this myself.

Implementation

Provide an extra phi argument to the function, and wherever the loop over n occurs, just add the extra complex phase to each term.

How important would you say this feature is?

2: Somewhat important. Needed this quarter.

Additional information

No response

elib20 avatar Mar 23 '23 16:03 elib20

if you are in a hurry this should work:

cutoff = 10
phase = 0.5
q = math.arange(-1,1,0.1)

exp_iphin = 1j*math.cast(phase * math.arange(cutoff), 'complex128')
q_to_n = math.cast(oscillator_eigenstate(q, cutoff), 'complex128')
exp_iphin[:,None] * q_to_n

(double check the signs)

ziofil avatar Mar 23 '23 17:03 ziofil

This is available in lab_dev now

ziofil avatar Jul 18 '24 07:07 ziofil