-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy over and edit scripts from qibojit-benchmarks
Slight modifications made to make it work for Qibochem
- Loading branch information
Showing
34 changed files
with
3,012 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
def parse(options): | ||
"""Parse options from string. | ||
Args: | ||
options (str): String with options. | ||
It should have the form 'arg1=value1,arg2=value2,...'. | ||
Returns: | ||
dict: {'arg1': value1, 'arg2': value2, ...} | ||
""" | ||
kwargs = {} | ||
if options is not None: | ||
for parameter in options.split(","): | ||
if "=" in parameter: | ||
k, v = parameter.split("=") | ||
kwargs[k] = v | ||
else: | ||
raise ValueError(f"Cannot parse parameter {parameter}.") | ||
return kwargs | ||
|
||
|
||
def get(circuit_name, nqubits, options=None, qibo=False): | ||
if qibo: | ||
from benchmarks.circuits import qibo as module | ||
else: | ||
from benchmarks.circuits import qasm as module | ||
|
||
if circuit_name in ("qft", "QFT"): | ||
circuit = module.QFT | ||
elif circuit_name == "one-qubit-gate": | ||
circuit = module.OneQubitGate | ||
elif circuit_name == "two-qubit-gate": | ||
circuit = module.TwoQubitGate | ||
elif circuit_name in ("variational", "variational-circuit"): | ||
circuit = module.VariationalCircuit | ||
elif circuit_name in ("bernstein-vazirani", "bv"): | ||
circuit = module.BernsteinVazirani | ||
elif circuit_name in ("hidden-shift", "hs"): | ||
circuit = module.HiddenShift | ||
elif circuit_name == "qaoa": | ||
circuit = module.QAOA | ||
elif circuit_name == "supremacy": | ||
circuit = module.SupremacyCircuit | ||
elif circuit_name in ("basis-change", "bc"): | ||
circuit = module.BasisChange | ||
elif circuit_name in ("quantum-volume", "qv"): | ||
circuit = module.QuantumVolume | ||
else: | ||
raise NotImplementedError(f"Cannot find circuit {circuit_name}.") | ||
|
||
kwargs = parse(options) | ||
return circuit(nqubits, **kwargs) |
Oops, something went wrong.