Skip to content

Support the graph visualization for Gaussian pure states#152

Merged
sansiro77 merged 12 commits intoTuringQ:mainfrom
Hugh-888:dev-gaussian_pure_visual
Apr 24, 2026
Merged

Support the graph visualization for Gaussian pure states#152
sansiro77 merged 12 commits intoTuringQ:mainfrom
Hugh-888:dev-gaussian_pure_visual

Conversation

@Hugh-888
Copy link
Copy Markdown
Collaborator

@Hugh-888 Hugh-888 commented Mar 19, 2026

  • Implementing a unified graphical calculus for Gaussian pure states based on the paper "Graphical calculus for Gaussian pure states" (Menicucci et al., 2011). It allows representing any Gaussian pure state as an undirected graph with complex-weighted edges (Z=V+iU), where:

    • V (Real part): Represents the entanglement structure (equivalent to Cz interaction strengths).
    • U (Imaginary part): Represents the squeezing properties of the state.
  • Code example

nmode = 4
cir = dq.QumodeCircuit(nmode, init_state='vac', backend='gaussian')
for i in range(nmode):
    cir.s(i, 1)
for i in range(nmode-1):
    cir.cz([i, i+1], [np.pi/3, np.pi/3])
re = cir()
cir.draw()
image
s = dq.GaussianState(re)
test = s.graph()
image
nmode = 4
cir = dq.QumodeCircuit(nmode, init_state='vac', backend='gaussian')
for i in range(nmode):
    cir.s(i, 1)

for i in range(nmode-1):
    cir.bs([i, i+1], [np.pi/3, np.pi/3])

for i in range(1, nmode):
    cir.bs([nmode-i, nmode-i-1], [np.pi/3, np.pi/3])
re = cir()
cir.draw()
image
s = dq.GaussianState(re)
test = s.graph(mode='simplified')
image
s = dq.GaussianState(re)
test = s.graph(mode='full')
image

@Hugh-888 Hugh-888 added the enhancement New feature or request label Mar 19, 2026
@sansiro77 sansiro77 self-requested a review March 30, 2026 07:08
@sansiro77 sansiro77 self-assigned this Mar 30, 2026
Comment thread src/deepquantum/photonic/draw.py Outdated
Comment thread src/deepquantum/photonic/draw.py Outdated
Comment thread src/deepquantum/photonic/draw.py Outdated
Comment thread src/deepquantum/photonic/draw.py Outdated
Comment thread src/deepquantum/photonic/draw.py Outdated
Comment thread src/deepquantum/photonic/state.py Outdated
Comment thread src/deepquantum/photonic/state.py Outdated
Comment thread src/deepquantum/photonic/state.py Outdated
Copy link
Copy Markdown
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.

LGTM

@sansiro77 sansiro77 changed the title Implementation of graph visualization for Gaussian pure state Support the graph visualization for Gaussian pure states Apr 24, 2026
@sansiro77 sansiro77 merged commit 58a3d35 into TuringQ:main Apr 24, 2026
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