Comments (2)
A couple possible re-writes:
def Reset2(qubits, measDelay = 1e-6, signVec = None, doubleRound = True, buf = 30e-9, showPlot=False, measChans=None, docals=True, calRepeats=2):
if measChans is None:
measChans = qubits
if signVec == None:
signVec = [0]*len(qubits)
# for each qubit, build the set of feedback action to perform when
# receing a zero or one in the comparison register
FbGates = []
for ct, q in enumerate(qubits):
if signVec[ct] == 0:
FbGates.append([gate(q) for gate in [Id, X]])
else: # inverted logic
FbGates.append([gate(q) for gate in [X, Id]])
FbSeq = [reduce(operator.mul, x) for x in product(*FbGates)]
# load register
resetSeq = [Id(qubits[0], measDelay), qwait('CMP'), Id(qubits[0], buf)]
# create a branch for each possible comparison value
for ct in range(2**len(qubits)):
resetSeq += qif(ct, [FbSeq[ct]])
resetSeq += [MEAS(*measChans)]
if doubleRound:
pass # do something
# the copy isn't quite sufficient because we need to create all new labels
seqs = [prep + copy(resetSeq) for prep in create_cal_seqs(qubits,1)]
# add final qwait('CMP')
for seq in seqs:
seq.append(qwait('CMP'))
if docals:
seqs += create_cal_seqs(qubits, calRepeats, measChans=measChans)
return seqs
or alternatively with a qfunction
:
@qfunction
def qreset(qubits, signVec, measDelay, buf):
# for each qubit, build the set of feedback action to perform when
# receing a zero or one in the comparison register
FbGates = []
for ct, q in enumerate(qubits):
if signVec[ct] == 0:
FbGates.append([gate(q) for gate in [Id, X]])
else: # inverted logic
FbGates.append([gate(q) for gate in [X, Id]])
FbSeq = [reduce(operator.mul, x) for x in product(*FbGates)]
# load register
seq = [Id(qubits[0], measDelay), qwait('CMP'), Id(qubits[0], buf)]
# create a branch for each possible comparison value
for ct in range(2**len(qubits)):
seq += qif(ct, [FbSeq[ct]])
seq += [MEAS(*qubits)]
return seq
def Reset3(qubits, measDelay = 1e-6, signVec = None, doubleRound = True, buf = 30e-9, showPlot=False, measChans=None, docals=True, calRepeats=2):
if measChans is None:
measChans = qubits
if signVec == None:
signVec = [0]*len(qubits)
signVec = tuple(signVec)
seqs = [prep + [qreset(qubits, signVec, measDelay, buf)] for prep in create_cal_seqs(qubits,1)]
if doubleRound:
for seq in seqs:
seq.append(qreset(qubits, signVec, measDelay, buf))
# add final qwait('CMP')
for seq in seqs:
seq.append(qwait('CMP'))
if docals:
seqs += create_cal_seqs(qubits, calRepeats, measChans=measChans)
return seqs
from qgl.
Closed by #10
from qgl.
Related Issues (20)
- Fix `align` function for same-length pulses
- Default values for instrument specific attributes
- Marker comes after measurement if they are the same length HOT 2
- PulsedSpec broken for APS1 HOT 1
- Add TDM channels sqlalchemy branch HOT 1
- Add save_svg() to custom toolbar and make it work...
- Align CompoundGates
- Compiled diatomic cliffords HOT 1
- Tests for APS3Pattern HOT 1
- Update example notebooks HOT 2
- Update QGL documentation
- ChannelLibrary database notes not set HOT 5
- Fix compile to TDM HOT 1
- Store TDM word size and memory size in APSPattern HOT 3
- QGL examples have database related errors HOT 2
- Do we still use in-place file updates? HOT 1
- Write ChannelLibrary methods for terminal use HOT 2
- Coherence times too long. HOT 1
- sqlalchemy syntax changed HOT 2
- Unexpected behavior for long sequences with APS2 HOT 1
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 qgl.