Skip to content

Add Bosonic backend#74

Merged
sansiro77 merged 28 commits intoTuringQ:mainfrom
Hugh-888:dev-bosonic
Mar 21, 2025
Merged

Add Bosonic backend#74
sansiro77 merged 28 commits intoTuringQ:mainfrom
Hugh-888:dev-bosonic

Conversation

@Hugh-888
Copy link
Collaborator

@Hugh-888 Hugh-888 commented Jan 22, 2025

  1. support construct nongaussian state
cov = torch.stack([torch.eye(4)]*3)
mean = torch.tensor([[1,1,0,0],
                     [2,2,0,0],
                     [3,3,0,0]])
weight = torch.tensor([0.1, 0.4, 0.5])
state1 = dq.NonGaussianState([cov, mean, weight])
cat = dq.CatState(r=1.55, theta=0, p=1)
vac = dq.NonGaussianState(state='vac')
  1. support forward for nongaussian state
cir = dq.QumodeCircuit(nmode=2, init_state='vac', cutoff=3, backend='bosonic')
cir.cat(wires=0, r=1, theta=0, p=1)
cir.gkp(wires=1, theta=0., phi=0.)
cir.s(0, 0.)
cir.s(1, 0.)
result = cir()
  1. support non-gaussian state visulisation
gkp = dq.GKPState(theta=0., phi=0., amp_cutoff=0.01, epsilon=0.05)
qvec = torch.linspace(-8, 6, 100)
pvec = torch.linspace(-10, 7, 100)
test =gkp.wigner(0, qvec, pvec, plot=True)

@sansiro77 sansiro77 changed the title Add bosonic backend Add Bosonic backend Jan 22, 2025
@sansiro77 sansiro77 self-requested a review January 22, 2025 12:21
@sansiro77 sansiro77 self-assigned this Jan 22, 2025
@sansiro77 sansiro77 added the enhancement New feature or request label Jan 22, 2025
@sansiro77
Copy link
Contributor

截屏2025-03-05 18 16 20

@sansiro77
Copy link
Contributor

截屏2025-03-12 23 48 47

@sansiro77
Copy link
Contributor

Now we support:

cir = dq.QumodeCircuit(nmode=2, init_state='vac', backend='bosonic')
cir.cat(0)
cir.gkp(1, 1., 1.)
cir.bs([0,1])
cir()

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.

kappa还没加

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.

Good job!

@sansiro77 sansiro77 merged commit 87c03da into TuringQ:main Mar 21, 2025
@Hugh-888 Hugh-888 deleted the dev-bosonic branch March 25, 2025 05:13
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