bqskit
bqskit copied to clipboard
Running Qsearch with qfactor method raises error with model
An error arises when running the following code:
# backend.num_qubits == 127
model = MachineModel(backend.num_qubits, gate_set=[ECRGate(), RZGate(), SXGate(), XGate(), IdentityGate()])
with Compiler() as compiler:
partitionWorkFlow = [
SetModelPass(model),
QuickPartitioner(block_size=3),
ForEachBlockPass(
IfThenElsePass(
WidthPredicate(3),
NOOPPass(),
QSearchSynthesisPass(instantiate_options={'method': "qfactor", 'multistarts': 4})
),
replace_filter='less-than-respecting-multi'
),
UnfoldPass()
]
outputScanCircuit = compiler.compile(circuit, partitionWorkFlow)
The following code fixes this issue:
model = MachineModel(backend.num_qubits, gate_set=[ECRGate(), RZGate(), SXGate(), XGate(), IdentityGate()])
layergen = SimpleLayerGenerator(ECRGate(), VariableUnitaryGate(1))
with Compiler() as compiler:
# Play around with multistart: 4 or 8
partitionWorkFlow = [
SetModelPass(model),
QuickPartitioner(block_size=3),
ForEachBlockPass(
IfThenElsePass(
WidthPredicate(3),
NOOPPass(),
QSearchSynthesisPass(layer_generator=layergen, instantiate_options={'method': "qfactor", 'multistarts': 4})
),
replace_filter='less-than-respecting-multi'
),
UnfoldPass()
]
outputScanCircuit = compiler.compile(circuit, partitionWorkFlow)
Can we figure out a way to avoid specifying the layer generator?