Skip to content

Commit

Permalink
changed reference order
Browse files Browse the repository at this point in the history
  • Loading branch information
josh146 committed May 11, 2018
1 parent 10bc9cd commit c9392a4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 29 deletions.
26 changes: 13 additions & 13 deletions doc/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -738,19 +738,6 @@ @article{gianfranco2016b

% further reading
@article{FR-adesso2014,
doi = {10.1142/s1230161214400010},
year = {2014},
month = {Jun},
publisher = {World Scientific Pub Co Pte Lt},
volume = {21},
number = {01n02},
pages = {1440001},
author = {Gerardo Adesso and Sammy Ragy and Antony R. Lee},
title = {Continuous Variable Quantum Information: Gaussian States and Beyond},
journal = {Open Systems {\&} Information Dynamics}
}

@article{FR-weedbrook2012,
doi = {10.1103/revmodphys.84.621},
archivePrefix = "arXiv",
Expand All @@ -766,6 +753,19 @@ @article{FR-weedbrook2012
journal = {Reviews of Modern Physics}
}

@article{FR-adesso2014,
doi = {10.1142/s1230161214400010},
year = {2014},
month = {Jun},
publisher = {World Scientific Pub Co Pte Lt},
volume = {21},
number = {01n02},
pages = {1440001},
author = {Gerardo Adesso and Sammy Ragy and Antony R. Lee},
title = {Continuous Variable Quantum Information: Gaussian States and Beyond},
journal = {Open Systems {\&} Information Dynamics}
}

@book{FR-serafini2017,
title={Quantum Continuous Variables: A Primer of Theoretical Methods},
author={Serafini, Alessio},
Expand Down
52 changes: 36 additions & 16 deletions strawberryfields/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,32 +1467,52 @@ def __init__(self, S, hbar=None, vacuum=False):
else:
self.hbar = hbar

O1, smat, O2 = bloch_messiah(S, tol=10)
N = S.shape[0]//2

X1 = O1[:N, :N]
P1 = O1[N:, :N]
X2 = O2[:N, :N]
P2 = O2[N:, :N]
# check if input symplectic is passive (orthogonal)
diffn = np.linalg.norm(S @ S.T - np.identity(2*N))

if np.round(diffn, 11) == 0.0:
# The transformation is passive, do Clements
self.active = False
X1 = S[:N, :N]
P1 = S[N:, :N]
self.U1 = X1+1j*P1
else:
# transformation is active, do Bloch-Messiah
self.active = True
O1, smat, O2 = bloch_messiah(S, tol=10)
N = S.shape[0]//2

X1 = O1[:N, :N]
P1 = O1[N:, :N]
X2 = O2[:N, :N]
P2 = O2[N:, :N]

self.U1 = X1+1j*P1
self.U2 = X2+1j*P2
self.Sq = np.diagonal(smat)[:N]

self.U1 = X1+1j*P1
self.U2 = X2+1j*P2
self.Sq = np.diagonal(smat)[:N]
self.ns = N
self.vacuum = vacuum

def decompose(self, reg):
cmds = []
if not self.vacuum:
cmds = [Command(Interferometer(self.U2), reg, decomp=True)]

for n, expr in enumerate(self.Sq):
if np.abs(np.round(expr, 13)) != 1.0:
r = abs(log(expr))
phi = np.angle(log(expr))
cmds.append(Command(Sgate(-r, phi), reg[n], decomp=True))
if self.active:
if not self.vacuum:
cmds = [Command(Interferometer(self.U2), reg, decomp=True)]

cmds.append(Command(Interferometer(self.U1), reg, decomp=True))
for n, expr in enumerate(self.Sq):
if np.abs(np.round(expr, 13)) != 1.0:
r = abs(log(expr))
phi = np.angle(log(expr))
cmds.append(Command(Sgate(-r, phi), reg[n], decomp=True))

cmds.append(Command(Interferometer(self.U1), reg, decomp=True))
else:
if not self.vacuum:
cmds = [Command(Interferometer(self.U1), reg, decomp=True)]

return cmds

Expand Down

0 comments on commit c9392a4

Please sign in to comment.