Comments (3)
Adriaan, thanks for the nice description. This is a confirmed bug in pyGSTi 0.9.3 and earlier, and only currently fixed on the beta branch. The error arises due to an incorrect 1-qubit phase that is included when using the CZ(pi, Q0, Q1)
specification in build_gateset
. A similar error occurs when creating a CNOT gate from CX(pi, Q0, Q1)
. The CZ(theta)
gate uses a Z-rotation, whose unitary is defined as exp(i 0.5 theta Z), which for theta=pi gives an extra phase factor of "i", namely
[ -i 0 ]
[ 0 i ]
instead of
[ 1 0 ]
[ 0 -1]
as desired.
The workaround for the time being is to do exactly as Adriaan suggests, which I'll repeat here in the context of creating a GateSet
:
myGateset = pygsti.construction.build_gateset(
[4], [('Q0','Q1')],['Gix','Giy','Gxi','Gyi'],
[ "I(Q0):X(pi/2,Q1)", "I(Q0):Y(pi/2,Q1)", "X(pi/2,Q0):I(Q1)", "Y(pi/2,Q0):I(Q1)" ],
prepLabels=['rho0'], prepExpressions=["0"],
effectLabels=['E0','E1','E2'], effectExpressions=["0","1","2"],
spamdefs={'upup': ('rho0','E0'), 'updn': ('rho0','E1'),
'dnup': ('rho0','E2'), 'dndn': ('rho0','remainder') }, basis="pp")
cphaseUnitary = np.diag([1,1,1,-1])
cphaseSuperOp_stdbasis = pygsti.unitary_to_process_mx(cphaseUnitary)
cphaseSuperOp_ppbasis = pygsti.std_to_pp(cphaseSuperOp_stdbasis)
myGateset['Gcphase'] = mySuperOp_ppbasis
The next version of pyGSTi (hopefully pushed out soon) will include fixes for these bugs as they affect the standard gate sets in pygsti.construction
. I'm not sure if we'll change the implementation of CX and CZ, but will comment again once this has been resolved.
from pygsti.
@enielse Thanks for the update 👍
from pygsti.
So... "hopefully soon" ended up being a year later, but the recently released pyGSTi version 0.9.4 now includes a proper cphase gate - so you can do:
pygsti.construction.build_gate([4],[('Q0', 'Q1')], 'CPHASE(Q0, Q1)', basis='pp')
and
pygsti.construction.build_gate([4],[('Q0', 'Q1')], 'CNOT(Q0, Q1)', basis='pp')
to obtain the standard CPhase and CNot gates. Using the CZ
and CX
directives still act as before, since, for instance, we want the "Z" in a "controlled-Z" operation to have a consistent phase with a rotation by 0 degrees being the identity (not i times the identity). This means, somewhat non-intuitively, that 'CPHASE(Q0,Q1)'
and 'CZ(pi,Q0,Q1)'
are equivalent only up to a phase on the target qubit and not exactly equal.
Finally, it's worth noting that any standard gate set in pyGSTi, as of version 0.9.4, that includes a CPhase or CNot gate uses the standard form of these gates, which should be intuitive to most users.
from pygsti.
Related Issues (20)
- Method `parameter_labels()` returns an empty array HOT 1
- 1/2 Diamond Norm Errorbars
- Raw Estimates Errorbars for TPInstrument HOT 1
- CP Instruments & Instrument Error Generators
- QI Report Fixes & Additions
- Wildcard w/ QILGST
- Fisher Information w/ Experiment Designs Containing MCMs
- Explicit Model Construction from MCM-Containing Pspec
- Help with detecting crosstalk errors of simulated data
- Serialization Issue w/ Processor Spec Nonstd_Instruments HOT 1
- Numpy version dependency HOT 1
- Gswap cannot be used as a two-qubit standard native gate for two-qubit RB as CliffordCompilationRules taking too long
- Line label reordering during `Circuit` concatenation
- Generating Random Error Generators HOT 4
- Design pspec sslbl bug in modelpacks
- Serialization for ModelEstimateResults HOT 2
- Depolarizing SPAM in H-Only Models Silently Fails (and Discussion of How to Properly Regularize Reduced Models)
- Add cycle benchmarking with mid-circuit measurements
- `germsel.find_germs()` does not support `operations.ComposedOp()` and is limited in large models. HOT 2
- Affine term disappers when applying cloud crosstalk model HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygsti.