Skip to content

Optimize wigner function and marginal function for Bosonic state#99

Merged
sansiro77 merged 3 commits intoTuringQ:mainfrom
Hugh-888:dev-bosonic
Apr 24, 2025
Merged

Optimize wigner function and marginal function for Bosonic state#99
sansiro77 merged 3 commits intoTuringQ:mainfrom
Hugh-888:dev-bosonic

Conversation

@Hugh-888
Copy link
Collaborator

@Hugh-888 Hugh-888 commented Apr 24, 2025

Update bosonic wigner function and marginal function
example:

sq = 1
r = torch.tensor(2, dtype=torch.double)
r_prime = (np.cosh(sq)+np.sinh(sq))*r/2
cir = dq.QumodeCircuit(nmode=1, init_state='vac', cutoff=3, backend='bosonic')
cir.cat(wires=0, r=r_prime, theta=0, p=0) # plus cat state
cir.s(0, sq)
cir.homodyne_p(0)
cir.to(torch.double)
re = cir()
s = dq.BosonicState(state=re, nmode=1) # squeezed plus cat state

qrange = 10
prange = 15
marginal_q =s.marginal(wire=0, qrange=qrange)
marginal_p = s.marginal(wire=0, qrange=prange, phi=np.pi/2)
wigner = s.wigner(wire=0, qrange=qrange, prange=prange)

image

@sansiro77 sansiro77 self-requested a review April 24, 2025 08:20
@sansiro77 sansiro77 self-assigned this Apr 24, 2025
@sansiro77 sansiro77 added the enhancement New feature or request label Apr 24, 2025
@sansiro77 sansiro77 changed the title Update bosonic wigner function and marginal function Optimize wigner function and marginal function for Bosonic state Apr 24, 2025
Copy link
Contributor

@sansiro77 sansiro77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ

@sansiro77 sansiro77 merged commit 7318ab0 into TuringQ:main Apr 24, 2025
@Hugh-888 Hugh-888 deleted the dev-bosonic branch August 8, 2025 07:34
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

Successfully merging this pull request may close these issues.

2 participants