From 7fe4ecdbb8907ef75e8f8df5a68d4af24e106add Mon Sep 17 00:00:00 2001 From: Evan McKinney <47376937+evmckinney9@users.noreply.github.com> Date: Thu, 12 Oct 2023 10:57:04 -0400 Subject: [PATCH] Add hardcoded qasm circuits to no-mqt branch (#20) * add: preloaded portfolioqaoa qasm file * add: twolocal qiskit circuits * fix: ecp as gate not operator, feat: hardcoded qasm files to skip mqt loading --- src/transpile_benchy/benchmark.py | 38 +- .../interfaces/hardcoded/adder_n4.qasm | 31 + .../interfaces/hardcoded/ae_n8.qasm | 176 +++ .../interfaces/hardcoded/dj_n8.qasm | 45 + .../interfaces/hardcoded/fredkin_n3.qasm | 26 + .../hardcoded/portfolioqaoa_n16.qasm | 1231 +++++++++++++++++ .../interfaces/hardcoded/qaoa_n8.qasm | 85 ++ .../interfaces/hardcoded/qft_n8.qasm | 174 +++ .../interfaces/hardcoded/qftentangled_n8.qasm | 181 +++ .../interfaces/hardcoded/qpeexact_n8.qasm | 177 +++ .../interfaces/hardcoded/toffoli_n3.qasm | 25 + .../interfaces/mqt_interface.py | 10 +- .../interfaces/qasm_interface.py | 42 +- .../interfaces/qiskit_circuits.py | 63 +- src/transpile_benchy/library.py | 3 + 15 files changed, 2280 insertions(+), 27 deletions(-) create mode 100644 src/transpile_benchy/interfaces/hardcoded/adder_n4.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/ae_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/dj_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/fredkin_n3.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/portfolioqaoa_n16.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/qaoa_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/qft_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/qftentangled_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/qpeexact_n8.qasm create mode 100644 src/transpile_benchy/interfaces/hardcoded/toffoli_n3.qasm diff --git a/src/transpile_benchy/benchmark.py b/src/transpile_benchy/benchmark.py index 44bf364..e89c989 100644 --- a/src/transpile_benchy/benchmark.py +++ b/src/transpile_benchy/benchmark.py @@ -39,7 +39,9 @@ def __init__( self.logger = logger # check that all the transpilers have different names - if len(set([t.name for t in self.transpilers])) != len(self.transpilers): + if len(set([t.name for t in self.transpilers])) != len( + self.transpilers + ): raise ValueError("Transpilers must have unique names") # give each transpiler a reference to the metrics @@ -63,7 +65,9 @@ def _try_transpilation(self, transpiler, circuit, run_index): """Attempt to transpile, returns transpiled circuit or raises Error.""" if not self._filter_circuit(circuit): if self.logger: - self.logger.debug(f"Skipping circuit {circuit.name} due to filtering") + self.logger.debug( + f"Skipping circuit {circuit.name} due to filtering" + ) return None if self.logger: self.logger.debug( @@ -78,6 +82,7 @@ def _try_transpilation(self, transpiler, circuit, run_index): transpiled_circuit = transpiler.run(circuit) except Exception as e: raise ValueError("Transpiler failed") from e + return transpiled_circuit def run_single_circuit(self, circuit: QuantumCircuit): @@ -133,7 +138,10 @@ def _calculate_statistics( # Error checking try: assert metric in self.metrics - assert transpiler_1 in self.transpilers and transpiler_2 in self.transpilers + assert ( + transpiler_1 in self.transpilers + and transpiler_2 in self.transpilers + ) except AssertionError: raise ValueError("Invalid metric or transpiler") @@ -154,14 +162,17 @@ def _calculate_statistics( total_2 += result_2.average if result_1.average == 0: - if result_2.average == 0: # The percentages are equal, no change + if ( + result_2.average == 0 + ): # The percentages are equal, no change change_percentage = 0 else: # result_1 is zero but result_2 not, ie ~infinite increase change_percentage = float("inf") else: # Normal case, result_1.average isn't zero change_percentage = ( - (result_2.average - result_1.average) / result_1.average + (result_2.average - result_1.average) + / result_1.average ) * 100 change_percentages.append(change_percentage) @@ -170,7 +181,9 @@ def _calculate_statistics( # Calculate average change and aggregate change average_change = sum(change_percentages) / len(change_percentages) aggregate_change = ( - ((total_2 - total_1) / total_1) * 100 if total_1 != 0 else float("inf") + ((total_2 - total_1) / total_1) * 100 + if total_1 != 0 + else float("inf") ) if metric.is_lower_better: @@ -207,11 +220,15 @@ def summary_statistics(self, transpiler_1, transpiler_2) -> dict: summary = {} if transpiler_1 is None or transpiler_2 is None: - raise ValueError("One or both specified transpilers could not be found.") + raise ValueError( + "One or both specified transpilers could not be found." + ) for metric in self.metrics: # calculate/store statistics for this metric on pair of transpilers - stats = self._calculate_statistics(metric, transpiler_1, transpiler_2) + stats = self._calculate_statistics( + metric, transpiler_1, transpiler_2 + ) summary[metric.name] = { "average_change": stats["average_change"], "aggregrate_change": stats["aggregate_change"], @@ -233,7 +250,10 @@ def __iter__(self): (metric_name, transpiler_name, circuit_name, mean_result, trials) """ for metric in self.metrics: - for transpiler_name, results_by_circuit in metric.saved_results.items(): + for ( + transpiler_name, + results_by_circuit, + ) in metric.saved_results.items(): for circuit_name, result in results_by_circuit.items(): yield ( metric.name, diff --git a/src/transpile_benchy/interfaces/hardcoded/adder_n4.qasm b/src/transpile_benchy/interfaces/hardcoded/adder_n4.qasm new file mode 100644 index 0000000..7c8f6d1 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/adder_n4.qasm @@ -0,0 +1,31 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[4]; +creg c[4]; +u(pi,0,pi) q[0]; +u(0,0,pi/4) q[0]; +u(pi,0,pi) q[1]; +u(0,0,pi/4) q[1]; +cx q[0],q[1]; +u(pi/2,0,pi) q[3]; +cx q[2],q[3]; +u(0,0,pi/4) q[2]; +u(0,0,-pi/4) q[3]; +cx q[2],q[3]; +cx q[1],q[2]; +cx q[3],q[0]; +cx q[0],q[1]; +u(0,0,-pi/4) q[0]; +u(0,0,-pi/4) q[1]; +cx q[0],q[1]; +cx q[2],q[3]; +u(0,0,-pi/4) q[2]; +u(0,0,pi/4) q[3]; +cx q[2],q[3]; +u(0,0,pi/2) q[3]; +cx q[3],q[0]; +u(pi/2,0,pi) q[3]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +measure q[2] -> c[2]; +measure q[3] -> c[3]; diff --git a/src/transpile_benchy/interfaces/hardcoded/ae_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/ae_n8.qasm new file mode 100644 index 0000000..484fe82 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/ae_n8.qasm @@ -0,0 +1,176 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg eval[7]; +qreg q[1]; +creg meas[8]; +u(pi/2,0,pi) eval[0]; +u(0,0,0) eval[0]; +u(pi/2,0,pi) eval[1]; +u(0,0,0) eval[1]; +u(pi/2,0,pi) eval[2]; +u(0,0,0) eval[2]; +u(pi/2,0,pi) eval[3]; +u(0,0,0) eval[3]; +u(pi/2,0,pi) eval[4]; +u(0,0,0) eval[4]; +u(pi/2,0,pi) eval[5]; +u(0,0,0) eval[5]; +u(pi/2,0,pi) eval[6]; +u(0,0,0) eval[6]; +u(0.9272952180016122,0,0) q[0]; +u(0,0,0) q[0]; +cx eval[0],q[0]; +u(-0.9272952180016122,0,0) q[0]; +cx eval[0],q[0]; +u(0.9272952180016122,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/128) eval[0]; +cx eval[1],q[0]; +u(-1.8545904360032244,0,0) q[0]; +cx eval[1],q[0]; +u(1.8545904360032244,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/64) eval[1]; +cx eval[2],q[0]; +u(-3.7091808720064487,0,0) q[0]; +cx eval[2],q[0]; +u(3.7091808720064487,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/32) eval[2]; +cx eval[3],q[0]; +u(-7.4183617440128975,0,0) q[0]; +cx eval[3],q[0]; +u(7.4183617440128975,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/16) eval[3]; +cx eval[4],q[0]; +u(-14.836723488025795,0,0) q[0]; +cx eval[4],q[0]; +u(14.836723488025795,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/8) eval[4]; +cx eval[5],q[0]; +u(-29.67344697605159,0,0) q[0]; +cx eval[5],q[0]; +u(29.67344697605159,0,0) q[0]; +u(0,0,0) q[0]; +u(0,0,-pi/4) eval[5]; +cx eval[6],q[0]; +u(-59.34689395210318,0,0) q[0]; +cx eval[6],q[0]; +u(59.34689395210318,0,0) q[0]; +u(pi/2,0,pi) eval[6]; +cx eval[5],eval[6]; +u(0,0,pi/4) eval[6]; +cx eval[5],eval[6]; +u(pi/2,0,pi) eval[5]; +u(0,0,-pi/4) eval[6]; +cx eval[4],eval[6]; +u(0,0,pi/8) eval[6]; +cx eval[4],eval[6]; +u(0,0,-pi/4) eval[4]; +cx eval[4],eval[5]; +u(0,0,pi/4) eval[5]; +cx eval[4],eval[5]; +u(pi/2,0,pi) eval[4]; +u(0,0,-pi/4) eval[5]; +u(0,0,-pi/8) eval[6]; +cx eval[3],eval[6]; +u(0,0,pi/16) eval[6]; +cx eval[3],eval[6]; +u(0,0,-pi/8) eval[3]; +cx eval[3],eval[5]; +u(0,0,pi/8) eval[5]; +cx eval[3],eval[5]; +u(0,0,-pi/4) eval[3]; +cx eval[3],eval[4]; +u(0,0,pi/4) eval[4]; +cx eval[3],eval[4]; +u(pi/2,0,pi) eval[3]; +u(0,0,-pi/4) eval[4]; +u(0,0,-pi/8) eval[5]; +u(0,0,-pi/16) eval[6]; +cx eval[2],eval[6]; +u(0,0,pi/32) eval[6]; +cx eval[2],eval[6]; +u(0,0,-pi/16) eval[2]; +cx eval[2],eval[5]; +u(0,0,pi/16) eval[5]; +cx eval[2],eval[5]; +u(0,0,-pi/8) eval[2]; +cx eval[2],eval[4]; +u(0,0,pi/8) eval[4]; +cx eval[2],eval[4]; +u(0,0,-pi/4) eval[2]; +cx eval[2],eval[3]; +u(0,0,pi/4) eval[3]; +cx eval[2],eval[3]; +u(pi/2,0,pi) eval[2]; +u(0,0,-pi/4) eval[3]; +u(0,0,-pi/8) eval[4]; +u(0,0,-pi/16) eval[5]; +u(0,0,-pi/32) eval[6]; +cx eval[1],eval[6]; +u(0,0,pi/64) eval[6]; +cx eval[1],eval[6]; +u(0,0,-pi/32) eval[1]; +cx eval[1],eval[5]; +u(0,0,pi/32) eval[5]; +cx eval[1],eval[5]; +u(0,0,-pi/16) eval[1]; +cx eval[1],eval[4]; +u(0,0,pi/16) eval[4]; +cx eval[1],eval[4]; +u(0,0,-pi/8) eval[1]; +cx eval[1],eval[3]; +u(0,0,pi/8) eval[3]; +cx eval[1],eval[3]; +u(0,0,-pi/4) eval[1]; +cx eval[1],eval[2]; +u(0,0,pi/4) eval[2]; +cx eval[1],eval[2]; +u(pi/2,0,pi) eval[1]; +u(0,0,-pi/4) eval[2]; +u(0,0,-pi/8) eval[3]; +u(0,0,-pi/16) eval[4]; +u(0,0,-pi/32) eval[5]; +u(0,0,-pi/64) eval[6]; +cx eval[0],eval[6]; +u(0,0,pi/128) eval[6]; +cx eval[0],eval[6]; +u(0,0,-pi/64) eval[0]; +cx eval[0],eval[5]; +u(0,0,pi/64) eval[5]; +cx eval[0],eval[5]; +u(0,0,-pi/32) eval[0]; +cx eval[0],eval[4]; +u(0,0,pi/32) eval[4]; +cx eval[0],eval[4]; +u(0,0,-pi/16) eval[0]; +cx eval[0],eval[3]; +u(0,0,pi/16) eval[3]; +cx eval[0],eval[3]; +u(0,0,-pi/8) eval[0]; +cx eval[0],eval[2]; +u(0,0,pi/8) eval[2]; +cx eval[0],eval[2]; +u(0,0,-pi/4) eval[0]; +cx eval[0],eval[1]; +u(0,0,pi/4) eval[1]; +cx eval[0],eval[1]; +u(pi/2,0,pi) eval[0]; +u(0,0,-pi/4) eval[1]; +u(0,0,-pi/8) eval[2]; +u(0,0,-pi/16) eval[3]; +u(0,0,-pi/32) eval[4]; +u(0,0,-pi/64) eval[5]; +u(0,0,-pi/128) eval[6]; +barrier eval[0],eval[1],eval[2],eval[3],eval[4],eval[5],eval[6],q[0]; +measure eval[0] -> meas[0]; +measure eval[1] -> meas[1]; +measure eval[2] -> meas[2]; +measure eval[3] -> meas[3]; +measure eval[4] -> meas[4]; +measure eval[5] -> meas[5]; +measure eval[6] -> meas[6]; +measure q[0] -> meas[7]; diff --git a/src/transpile_benchy/interfaces/hardcoded/dj_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/dj_n8.qasm new file mode 100644 index 0000000..65e359f --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/dj_n8.qasm @@ -0,0 +1,45 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; +creg c[7]; +u(pi/2,0,pi) q[0]; +u(pi,0,pi) q[0]; +u(pi/2,0,pi) q[1]; +u(pi,0,pi) q[1]; +u(pi/2,0,pi) q[2]; +u(pi/2,0,pi) q[3]; +u(pi,0,pi) q[3]; +u(pi/2,0,pi) q[4]; +u(pi/2,0,pi) q[5]; +u(pi,0,pi) q[5]; +u(pi/2,0,pi) q[6]; +u(pi,0,pi) q[6]; +u(pi,0,pi) q[7]; +u(pi/2,0,pi) q[7]; +cx q[0],q[7]; +u(pi,0,pi) q[0]; +u(pi/2,0,pi) q[0]; +cx q[1],q[7]; +u(pi,0,pi) q[1]; +u(pi/2,0,pi) q[1]; +cx q[2],q[7]; +u(pi/2,0,pi) q[2]; +cx q[3],q[7]; +u(pi,0,pi) q[3]; +u(pi/2,0,pi) q[3]; +cx q[4],q[7]; +u(pi/2,0,pi) q[4]; +cx q[5],q[7]; +u(pi,0,pi) q[5]; +u(pi/2,0,pi) q[5]; +cx q[6],q[7]; +u(pi,0,pi) q[6]; +u(pi/2,0,pi) q[6]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +measure q[2] -> c[2]; +measure q[3] -> c[3]; +measure q[4] -> c[4]; +measure q[5] -> c[5]; +measure q[6] -> c[6]; diff --git a/src/transpile_benchy/interfaces/hardcoded/fredkin_n3.qasm b/src/transpile_benchy/interfaces/hardcoded/fredkin_n3.qasm new file mode 100644 index 0000000..a9e25c3 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/fredkin_n3.qasm @@ -0,0 +1,26 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[3]; +creg c[3]; +u(pi,0,pi) q[0]; +u(pi,0,pi) q[1]; +cx q[2],q[1]; +cx q[0],q[1]; +u(0,0,pi/4) q[0]; +u(0,0,-pi/4) q[1]; +u(pi/2,0,pi) q[2]; +u(0,0,pi/4) q[2]; +cx q[2],q[1]; +cx q[0],q[2]; +u(0,0,pi/4) q[1]; +cx q[0],q[1]; +u(0,0,-pi/4) q[1]; +u(0,0,-pi/4) q[2]; +cx q[0],q[2]; +cx q[2],q[1]; +u(0,0,pi/4) q[1]; +u(pi/2,0,pi) q[2]; +cx q[2],q[1]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +measure q[2] -> c[2]; diff --git a/src/transpile_benchy/interfaces/hardcoded/portfolioqaoa_n16.qasm b/src/transpile_benchy/interfaces/hardcoded/portfolioqaoa_n16.qasm new file mode 100644 index 0000000..7a68ccd --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/portfolioqaoa_n16.qasm @@ -0,0 +1,1231 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[16]; +creg meas[16]; +creg meas0[16]; +u2(0,pi) q[0]; +u1(0.0022244177755190307) q[0]; +u2(0,pi) q[1]; +u1(-0.003931439759584398) q[1]; +cx q[0],q[1]; +u1(4.474246348289162) q[1]; +cx q[0],q[1]; +u2(0,pi) q[2]; +u1(0.04471799393834343) q[2]; +cx q[0],q[2]; +u1(4.474388260106366) q[2]; +cx q[0],q[2]; +cx q[1],q[2]; +u1(4.474344341349677) q[2]; +cx q[1],q[2]; +u2(0,pi) q[3]; +u1(0.0191078592253824) q[3]; +cx q[0],q[3]; +u1(4.474234810328732) q[3]; +cx q[0],q[3]; +cx q[1],q[3]; +u1(4.474350943736849) q[3]; +cx q[1],q[3]; +cx q[2],q[3]; +u1(4.474380381923581) q[3]; +cx q[2],q[3]; +u2(0,pi) q[4]; +u1(0.0013213133632317693) q[4]; +cx q[0],q[4]; +u1(4.474223781536631) q[4]; +cx q[0],q[4]; +cx q[1],q[4]; +u1(4.474166761718961) q[4]; +cx q[1],q[4]; +cx q[2],q[4]; +u1(4.474259753260163) q[4]; +cx q[2],q[4]; +cx q[3],q[4]; +u1(4.474008419365578) q[4]; +cx q[3],q[4]; +u2(0,pi) q[5]; +u1(0.0064424531377970315) q[5]; +cx q[0],q[5]; +u1(4.474303171396193) q[5]; +cx q[0],q[5]; +cx q[1],q[5]; +u1(4.474326631678515) q[5]; +cx q[1],q[5]; +cx q[2],q[5]; +u1(4.474207198817535) q[5]; +cx q[2],q[5]; +cx q[3],q[5]; +u1(4.474244892054802) q[5]; +cx q[3],q[5]; +cx q[4],q[5]; +u1(4.47420949821452) q[5]; +cx q[4],q[5]; +u2(0,pi) q[6]; +u1(-0.10968980899331425) q[6]; +cx q[0],q[6]; +u1(4.474005029074103) q[6]; +cx q[0],q[6]; +cx q[1],q[6]; +u1(4.4736672169089875) q[6]; +cx q[1],q[6]; +cx q[2],q[6]; +u1(4.475528814804548) q[6]; +cx q[2],q[6]; +cx q[3],q[6]; +u1(4.473671714990913) q[6]; +cx q[3],q[6]; +cx q[4],q[6]; +u1(4.474717113696577) q[6]; +cx q[4],q[6]; +cx q[5],q[6]; +u1(4.4735514355858745) q[6]; +cx q[5],q[6]; +u2(0,pi) q[7]; +u1(0.01899301866818128) q[7]; +cx q[0],q[7]; +u1(4.474140688356712) q[7]; +cx q[0],q[7]; +cx q[1],q[7]; +u1(4.474349746545446) q[7]; +cx q[1],q[7]; +cx q[2],q[7]; +u1(4.474277865721388) q[7]; +cx q[2],q[7]; +cx q[3],q[7]; +u1(4.474307927477316) q[7]; +cx q[3],q[7]; +cx q[4],q[7]; +u1(4.4744492020647755) q[7]; +cx q[4],q[7]; +cx q[5],q[7]; +u1(4.474279764980858) q[7]; +cx q[5],q[7]; +cx q[6],q[7]; +u1(4.474361314590081) q[7]; +cx q[6],q[7]; +u2(0,pi) q[8]; +u1(0.005822599629680518) q[8]; +cx q[0],q[8]; +u1(4.47408568366981) q[8]; +cx q[0],q[8]; +cx q[1],q[8]; +u1(4.474279443959016) q[8]; +cx q[1],q[8]; +cx q[2],q[8]; +u1(4.474214640966174) q[8]; +cx q[2],q[8]; +cx q[3],q[8]; +u1(4.474069366617649) q[8]; +cx q[3],q[8]; +cx q[4],q[8]; +u1(4.474490304701921) q[8]; +cx q[4],q[8]; +cx q[5],q[8]; +u1(4.474384863495856) q[8]; +cx q[5],q[8]; +cx q[6],q[8]; +u1(4.475278884464685) q[8]; +cx q[6],q[8]; +cx q[7],q[8]; +u1(4.474433586112761) q[8]; +cx q[7],q[8]; +u2(0,pi) q[9]; +u1(0.017566039451833333) q[9]; +cx q[0],q[9]; +u1(4.474334701855822) q[9]; +cx q[0],q[9]; +cx q[1],q[9]; +u1(4.474292224663665) q[9]; +cx q[1],q[9]; +cx q[2],q[9]; +u1(4.474285314874812) q[9]; +cx q[2],q[9]; +cx q[3],q[9]; +u1(4.474212281821431) q[9]; +cx q[3],q[9]; +cx q[4],q[9]; +u1(4.47438283772544) q[9]; +cx q[4],q[9]; +cx q[5],q[9]; +u1(4.474535322014177) q[9]; +cx q[5],q[9]; +cx q[6],q[9]; +u1(4.4735816162787145) q[9]; +cx q[6],q[9]; +cx q[7],q[9]; +u1(4.474166041545028) q[9]; +cx q[7],q[9]; +cx q[8],q[9]; +u1(4.4744484323205205) q[9]; +cx q[8],q[9]; +u2(0,pi) q[10]; +u1(-0.008577055508448254) q[10]; +cx q[0],q[10]; +u1(4.474285158602722) q[10]; +cx q[0],q[10]; +cx q[1],q[10]; +u1(4.474268040142053) q[10]; +cx q[1],q[10]; +cx q[2],q[10]; +u1(4.4743975230835735) q[10]; +cx q[2],q[10]; +cx q[3],q[10]; +u1(4.47434833785123) q[10]; +cx q[3],q[10]; +cx q[4],q[10]; +u1(4.474263333047679) q[10]; +cx q[4],q[10]; +cx q[5],q[10]; +u1(4.47421012421639) q[10]; +cx q[5],q[10]; +cx q[6],q[10]; +u1(4.474535557654241) q[10]; +cx q[6],q[10]; +cx q[7],q[10]; +u1(4.474363899740547) q[10]; +cx q[7],q[10]; +cx q[8],q[10]; +u1(4.474167580587069) q[10]; +cx q[8],q[10]; +cx q[9],q[10]; +u1(4.474199219746452) q[10]; +cx q[9],q[10]; +u2(0,pi) q[11]; +u1(-0.00875865139237383) q[11]; +cx q[0],q[11]; +u1(4.47428792695436) q[11]; +cx q[0],q[11]; +cx q[1],q[11]; +u1(4.474225233524224) q[11]; +cx q[1],q[11]; +cx q[2],q[11]; +u1(4.474336541932508) q[11]; +cx q[2],q[11]; +cx q[3],q[11]; +u1(4.474254349924309) q[11]; +cx q[3],q[11]; +cx q[4],q[11]; +u1(4.474179130289939) q[11]; +cx q[4],q[11]; +cx q[5],q[11]; +u1(4.474281810480662) q[11]; +cx q[5],q[11]; +cx q[6],q[11]; +u1(4.47405612352499) q[11]; +cx q[6],q[11]; +cx q[7],q[11]; +u1(4.47416315176074) q[11]; +cx q[7],q[11]; +cx q[8],q[11]; +u1(4.474139093977118) q[11]; +cx q[8],q[11]; +cx q[9],q[11]; +u1(4.474256059099691) q[11]; +cx q[9],q[11]; +cx q[10],q[11]; +u1(4.474295078324592) q[11]; +cx q[10],q[11]; +u2(0,pi) q[12]; +u1(-0.004526132202037793) q[12]; +cx q[0],q[12]; +u1(4.47423401835701) q[12]; +cx q[0],q[12]; +cx q[1],q[12]; +u1(4.474222726989733) q[12]; +cx q[1],q[12]; +cx q[2],q[12]; +u1(4.474109941174665) q[12]; +cx q[2],q[12]; +cx q[3],q[12]; +u1(4.47427183683788) q[12]; +cx q[3],q[12]; +cx q[4],q[12]; +u1(4.47424909337581) q[12]; +cx q[4],q[12]; +cx q[5],q[12]; +u1(4.474419888773874) q[12]; +cx q[5],q[12]; +cx q[6],q[12]; +u1(4.474443268977918) q[12]; +cx q[6],q[12]; +cx q[7],q[12]; +u1(4.474295684901739) q[12]; +cx q[7],q[12]; +cx q[8],q[12]; +u1(4.4742473470226765) q[12]; +cx q[8],q[12]; +cx q[9],q[12]; +u1(4.474268239656905) q[12]; +cx q[9],q[12]; +cx q[10],q[12]; +u1(4.474160060694763) q[12]; +cx q[10],q[12]; +cx q[11],q[12]; +u1(4.474222056671289) q[12]; +cx q[11],q[12]; +u2(0,pi) q[13]; +u1(0.010440703126876606) q[13]; +cx q[0],q[13]; +u1(4.474240908353081) q[13]; +cx q[0],q[13]; +cx q[1],q[13]; +u1(4.474350300309359) q[13]; +cx q[1],q[13]; +cx q[2],q[13]; +u1(4.474214544758194) q[13]; +cx q[2],q[13]; +cx q[3],q[13]; +u1(4.474269262952145) q[13]; +cx q[3],q[13]; +cx q[4],q[13]; +u1(4.474350966125173) q[13]; +cx q[4],q[13]; +cx q[5],q[13]; +u1(4.474387156994026) q[13]; +cx q[5],q[13]; +cx q[6],q[13]; +u1(4.473257343903627) q[13]; +cx q[6],q[13]; +cx q[7],q[13]; +u1(4.474305682308345) q[13]; +cx q[7],q[13]; +cx q[8],q[13]; +u1(4.474152886384632) q[13]; +cx q[8],q[13]; +cx q[9],q[13]; +u1(4.474383175892286) q[13]; +cx q[9],q[13]; +cx q[10],q[13]; +u1(4.474220330474764) q[13]; +cx q[10],q[13]; +cx q[11],q[13]; +u1(4.474270500019877) q[13]; +cx q[11],q[13]; +cx q[12],q[13]; +u1(4.474331764860441) q[13]; +cx q[12],q[13]; +u2(0,pi) q[14]; +u1(8.799376129781026e-05) q[14]; +cx q[0],q[14]; +u1(4.474217902770081) q[14]; +cx q[0],q[14]; +cx q[1],q[14]; +u1(4.474314495066065) q[14]; +cx q[1],q[14]; +cx q[2],q[14]; +u1(4.474149595087212) q[14]; +cx q[2],q[14]; +cx q[3],q[14]; +u1(4.474158338915247) q[14]; +cx q[3],q[14]; +cx q[4],q[14]; +u1(4.474278955726926) q[14]; +cx q[4],q[14]; +cx q[5],q[14]; +u1(4.474282686776025) q[14]; +cx q[5],q[14]; +cx q[6],q[14]; +u1(4.474435009445798) q[14]; +cx q[6],q[14]; +cx q[7],q[14]; +u1(4.4743468107153594) q[14]; +cx q[7],q[14]; +cx q[8],q[14]; +u1(4.474231125140102) q[14]; +cx q[8],q[14]; +cx q[9],q[14]; +u1(4.474106125010125) q[14]; +cx q[9],q[14]; +cx q[10],q[14]; +u1(4.474211851006848) q[14]; +cx q[10],q[14]; +cx q[11],q[14]; +u1(4.474208347977334) q[14]; +cx q[11],q[14]; +cx q[12],q[14]; +u1(4.474304274801067) q[14]; +cx q[12],q[14]; +cx q[13],q[14]; +u1(4.474329936522094) q[14]; +cx q[13],q[14]; +u2(0,pi) q[15]; +u1(-0.01769474791554758) q[15]; +cx q[0],q[15]; +u1(4.4742114361315055) q[15]; +cx q[0],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[0]; +u1(0.0033107259402633095) q[0]; +cx q[1],q[15]; +u1(4.474285313550187) q[15]; +cx q[1],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[1]; +u1(-0.0058513826574693555) q[1]; +cx q[0],q[1]; +u1(6.659272197621667) q[1]; +cx q[0],q[1]; +cx q[2],q[15]; +u1(4.4743070446518045) q[15]; +cx q[2],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[2]; +u1(0.06655630257839773) q[2]; +cx q[0],q[2]; +u1(6.659483412951637) q[2]; +cx q[0],q[2]; +cx q[1],q[2]; +u1(6.659418046198756) q[2]; +cx q[1],q[2]; +cx q[3],q[15]; +u1(4.474198158833179) q[15]; +cx q[3],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[3]; +u1(0.028439300340338376) q[3]; +cx q[0],q[3]; +u1(6.6592550250269715) q[3]; +cx q[0],q[3]; +cx q[1],q[3]; +u1(6.659427872902499) q[3]; +cx q[1],q[3]; +cx q[2],q[3]; +u1(6.659471687409612) q[3]; +cx q[2],q[3]; +cx q[4],q[15]; +u1(4.474302543354016) q[15]; +cx q[4],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[4]; +u1(0.001966584908200195) q[4]; +cx q[0],q[4]; +u1(6.6592386102561045) q[4]; +cx q[0],q[4]; +cx q[1],q[4]; +u1(6.659153744458164) q[4]; +cx q[1],q[4]; +cx q[2],q[4]; +u1(6.659292148993082) q[4]; +cx q[2],q[4]; +cx q[3],q[4]; +u1(6.658918074638152) q[4]; +cx q[3],q[4]; +cx q[5],q[15]; +u1(4.474164663932923) q[15]; +cx q[5],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[5]; +u1(0.009588664933797598) q[5]; +cx q[0],q[5]; +u1(6.659356770644112) q[5]; +cx q[0],q[5]; +cx q[1],q[5]; +u1(6.659391687900261) q[5]; +cx q[1],q[5]; +cx q[2],q[5]; +u1(6.659213929263676) q[5]; +cx q[2],q[5]; +cx q[3],q[5]; +u1(6.65927003022626) q[5]; +cx q[3],q[5]; +cx q[4],q[5]; +u1(6.659217351585388) q[5]; +cx q[4],q[5]; +cx q[6],q[15]; +u1(4.474655648883732) q[15]; +cx q[6],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[6]; +u1(-0.1632575049585537) q[6]; +cx q[0],q[6]; +u1(6.6589130286768885) q[6]; +cx q[0],q[6]; +cx q[1],q[6]; +u1(6.658410243853689) q[6]; +cx q[1],q[6]; +cx q[2],q[6]; +u1(6.661180964583853) q[6]; +cx q[2],q[6]; +cx q[3],q[6]; +u1(6.658416938601716) q[6]; +cx q[3],q[6]; +cx q[4],q[6]; +u1(6.659972864224524) q[6]; +cx q[4],q[6]; +cx q[5],q[6]; +u1(6.658237920006054) q[6]; +cx q[5],q[6]; +cx q[7],q[15]; +u1(4.474172206889574) q[15]; +cx q[7],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[7]; +u1(0.028268376687459667) q[7]; +cx q[0],q[7]; +u1(6.659114938008361) q[7]; +cx q[0],q[7]; +cx q[1],q[7]; +u1(6.659426091055277) q[7]; +cx q[1],q[7]; +cx q[2],q[7]; +u1(6.659319106786657) q[7]; +cx q[2],q[7]; +cx q[3],q[7]; +u1(6.659363849386837) q[7]; +cx q[3],q[7]; +cx q[4],q[7]; +u1(6.659574116291979) q[7]; +cx q[4],q[7]; +cx q[5],q[7]; +u1(6.659321933561225) q[7]; +cx q[5],q[7]; +cx q[6],q[7]; +u1(6.659443308425986) q[7]; +cx q[6],q[7]; +cx q[8],q[15]; +u1(4.474248918915285) q[15]; +cx q[8],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[8]; +u1(0.008666102135086949) q[8]; +cx q[0],q[8]; +u1(6.659033071442751) q[8]; +cx q[0],q[8]; +cx q[1],q[8]; +u1(6.659321455766384) q[8]; +cx q[1],q[8]; +cx q[2],q[8]; +u1(6.659225005831588) q[8]; +cx q[2],q[8]; +cx q[3],q[8]; +u1(6.65900878585735) q[8]; +cx q[3],q[8]; +cx q[4],q[8]; +u1(6.6596352916559365) q[8]; +cx q[4],q[8]; +cx q[5],q[8]; +u1(6.659478357585397) q[8]; +cx q[5],q[8]; +cx q[6],q[8]; +u1(6.660808979218266) q[8]; +cx q[6],q[8]; +cx q[7],q[8]; +u1(6.659550874193312) q[8]; +cx q[7],q[8]; +cx q[9],q[15]; +u1(4.474330441894672) q[15]; +cx q[9],q[15]; +cx q[10],q[15]; +u1(4.474224783905481) q[15]; +cx q[10],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[10]; +u1(-0.012765713561281065) q[10]; +cx q[11],q[15]; +u1(4.474169136353608) q[15]; +cx q[11],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[11]; +u1(-0.013035992917153036) q[11]; +cx q[12],q[15]; +u1(4.474290210219672) q[15]; +cx q[12],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[12]; +u1(-0.006736496828636954) q[12]; +cx q[13],q[15]; +u1(4.474342264180545) q[15]; +cx q[13],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[13]; +u1(0.01553948500913825) q[13]; +cx q[14],q[15]; +u1(4.474365616459108) q[15]; +cx q[14],q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[14]; +u1(0.00013096605831700058) q[14]; +u3(1.958218358019076,-pi/2,pi/2) q[15]; +u1(-0.0263360873911171) q[15]; +u3(1.958218358019076,-pi/2,pi/2) q[9]; +u1(0.02614452335389358) q[9]; +cx q[0],q[9]; +u1(6.659403699198518) q[9]; +cx q[0],q[9]; +cx q[0],q[10]; +cx q[1],q[9]; +u1(6.659329961191653) q[10]; +cx q[0],q[10]; +cx q[0],q[11]; +u1(6.659334081484918) q[11]; +cx q[0],q[11]; +cx q[0],q[12]; +u1(6.659253846290965) q[12]; +cx q[0],q[12]; +cx q[0],q[13]; +u1(6.659264101059189) q[13]; +cx q[0],q[13]; +cx q[0],q[14]; +u1(6.659229860557585) q[14]; +cx q[0],q[14]; +cx q[0],q[15]; +u1(6.659220235896107) q[15]; +cx q[0],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[0]; +u1(-0.0011254320177729214) q[0]; +u1(6.659340478007116) q[9]; +cx q[1],q[9]; +cx q[1],q[10]; +u1(6.659304482824944) q[10]; +cx q[1],q[10]; +cx q[1],q[11]; +u1(6.659240771330809) q[11]; +cx q[1],q[11]; +cx q[1],q[12]; +u1(6.659237040714711) q[12]; +cx q[1],q[12]; +cx q[1],q[13]; +u1(6.659426915253219) q[13]; +cx q[1],q[13]; +cx q[1],q[14]; +u1(6.659373624298131) q[14]; +cx q[1],q[14]; +cx q[1],q[15]; +u1(6.659330191808669) q[15]; +cx q[1],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[1]; +u1(0.0019890904622668552) q[1]; +cx q[0],q[1]; +u1(-2.263720489552938) q[1]; +cx q[0],q[1]; +cx q[2],q[9]; +u1(6.659330193780183) q[9]; +cx q[2],q[9]; +cx q[2],q[10]; +u1(6.659497199560997) q[10]; +cx q[2],q[10]; +cx q[2],q[11]; +u1(6.6594064378880224) q[11]; +cx q[2],q[11]; +cx q[2],q[12]; +u1(6.659069175249983) q[12]; +cx q[2],q[12]; +cx q[2],q[13]; +u1(6.659224862639846) q[13]; +cx q[2],q[13]; +cx q[2],q[14]; +u1(6.659128194395733) q[14]; +cx q[2],q[14]; +cx q[2],q[15]; +u1(6.6593625354280315) q[15]; +cx q[2],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[2]; +u1(-0.022624824663183666) q[2]; +cx q[0],q[2]; +u1(-2.263792289061348) q[2]; +cx q[0],q[2]; +cx q[1],q[2]; +u1(-2.2637700686064037) q[2]; +cx q[1],q[2]; +cx q[3],q[9]; +u1(6.659221494583931) q[9]; +cx q[3],q[9]; +cx q[3],q[10]; +u1(6.659423994416535) q[10]; +cx q[3],q[10]; +cx q[3],q[11]; +u1(6.659284106904779) q[11]; +cx q[3],q[11]; +cx q[3],q[12]; +u1(6.659310133660639) q[12]; +cx q[3],q[12]; +cx q[3],q[13]; +u1(6.659306302801902) q[13]; +cx q[3],q[13]; +cx q[3],q[14]; +u1(6.659141208326215) q[14]; +cx q[3],q[14]; +cx q[3],q[15]; +u1(6.659200474547105) q[15]; +cx q[3],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[3]; +u1(-0.009667516956577686) q[3]; +cx q[0],q[3]; +u1(-2.26371465198491) q[3]; +cx q[0],q[3]; +cx q[1],q[3]; +u1(-2.2637734090481136) q[3]; +cx q[1],q[3]; +cx q[2],q[3]; +u1(-2.26378830313782) q[3]; +cx q[2],q[3]; +cx q[4],q[9]; +u1(6.659475342517483) q[9]; +cx q[4],q[9]; +cx q[4],q[10]; +u1(6.6592974769919495) q[10]; +cx q[4],q[10]; +cx q[4],q[11]; +u1(6.659172153297202) q[11]; +cx q[4],q[11]; +cx q[4],q[12]; +u1(6.65927628328834) q[12]; +cx q[4],q[12]; +cx q[4],q[13]; +u1(6.659427906224299) q[13]; +cx q[4],q[13]; +cx q[4],q[14]; +u1(6.659320729103135) q[14]; +cx q[4],q[14]; +cx q[4],q[15]; +u1(6.659355835893656) q[15]; +cx q[4],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[4]; +u1(-0.0006685112755607598) q[4]; +cx q[0],q[4]; +u1(-2.2637090720278152) q[4]; +cx q[0],q[4]; +cx q[1],q[4]; +u1(-2.2636802231626603) q[4]; +cx q[1],q[4]; +cx q[2],q[4]; +u1(-2.2637272717247616) q[4]; +cx q[2],q[4]; +cx q[3],q[4]; +u1(-2.263600110714258) q[4]; +cx q[3],q[4]; +cx q[5],q[9]; +u1(6.659702293450782) q[9]; +cx q[5],q[9]; +cx q[5],q[10]; +u1(6.659218283299139) q[10]; +cx q[5],q[10]; +cx q[5],q[11]; +u1(6.6593249779934975) q[11]; +cx q[5],q[11]; +cx q[5],q[12]; +u1(6.659530487674348) q[12]; +cx q[5],q[12]; +cx q[5],q[13]; +u1(6.65948177112757) q[13]; +cx q[5],q[13]; +cx q[5],q[14]; +u1(6.659326282233115) q[14]; +cx q[5],q[14]; +cx q[5],q[15]; +u1(6.6591506222053525) q[15]; +cx q[5],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[5]; +u1(-0.003259523959066821) q[5]; +cx q[0],q[5]; +u1(-2.2637492388934195) q[5]; +cx q[0],q[5]; +cx q[1],q[5]; +u1(-2.2637611084950575) q[5]; +cx q[1],q[5]; +cx q[2],q[5]; +u1(-2.2637006820917076) q[5]; +cx q[2],q[5]; +cx q[3],q[5]; +u1(-2.2637197527791213) q[5]; +cx q[3],q[5]; +cx q[4],q[5]; +u1(-2.263701845459047) q[5]; +cx q[4],q[5]; +cx q[6],q[9]; +u1(6.65828283962672) q[9]; +cx q[6],q[9]; +cx q[6],q[10]; +u1(6.659702644167128) q[10]; +cx q[6],q[10]; +cx q[6],q[11]; +u1(6.658989075418565) q[11]; +cx q[6],q[11]; +cx q[6],q[12]; +u1(6.659565285745497) q[12]; +cx q[6],q[12]; +cx q[6],q[13]; +u1(6.657800206833668) q[13]; +cx q[6],q[13]; +cx q[6],q[14]; +u1(6.659552992619831) q[14]; +cx q[6],q[14]; +cx q[6],q[15]; +u1(6.659881382690552) q[15]; +cx q[6],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[6]; +u1(0.0554969594394953) q[6]; +cx q[0],q[6]; +u1(-2.263598395414813) q[6]; +cx q[0],q[6]; +cx q[1],q[6]; +u1(-2.263427481195911) q[6]; +cx q[1],q[6]; +cx q[2],q[6]; +u1(-2.264369346478117) q[6]; +cx q[2],q[6]; +cx q[3],q[6]; +u1(-2.263429756975881) q[6]; +cx q[3],q[6]; +cx q[4],q[6]; +u1(-2.2639586707382326) q[6]; +cx q[4],q[6]; +cx q[5],q[6]; +u1(-2.263368902268191) q[6]; +cx q[5],q[6]; +cx q[7],q[9]; +u1(6.659152672582842) q[9]; +cx q[7],q[9]; +cx q[7],q[10]; +u1(6.659447156050654) q[10]; +cx q[7],q[10]; +cx q[7],q[11]; +u1(6.659148371554541) q[11]; +cx q[7],q[11]; +cx q[7],q[12]; +u1(6.659345628073833) q[12]; +cx q[7],q[12]; +cx q[7],q[13]; +u1(6.659360507775728) q[13]; +cx q[7],q[13]; +cx q[7],q[14]; +u1(6.659421721494428) q[14]; +cx q[7],q[14]; +cx q[7],q[15]; +u1(6.6591618488114905) q[15]; +cx q[7],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[7]; +u1(-0.009609414004229688) q[7]; +cx q[0],q[7]; +u1(-2.2636670314875134) q[7]; +cx q[0],q[7]; +cx q[1],q[7]; +u1(-2.2637728033356654) q[7]; +cx q[1],q[7]; +cx q[2],q[7]; +u1(-2.2637364356255394) q[7]; +cx q[2],q[7]; +cx q[3],q[7]; +u1(-2.263751645206673) q[7]; +cx q[3],q[7]; +cx q[4],q[7]; +u1(-2.2638231223121767) q[7]; +cx q[4],q[7]; +cx q[5],q[7]; +u1(-2.2637373965454897) q[7]; +cx q[5],q[7]; +cx q[6],q[7]; +u1(-2.2637786561246327) q[7]; +cx q[6],q[7]; +cx q[8],q[9]; +u1(6.6595729706383615) q[9]; +cx q[8],q[9]; +cx q[8],q[10]; +u1(6.659154963225572) q[10]; +cx q[8],q[10]; +cx q[8],q[11]; +u1(6.659112565003641) q[11]; +cx q[8],q[11]; +cx q[8],q[12]; +u1(6.659273684092864) q[12]; +cx q[8],q[12]; +cx q[8],q[13]; +u1(6.659133093018584) q[13]; +cx q[8],q[13]; +cx q[8],q[14]; +u1(6.659249540153705) q[14]; +cx q[8],q[14]; +cx q[8],q[15]; +u1(6.659276023628941) q[15]; +cx q[8],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[8]; +u1(-0.0029459124639418023) q[8]; +cx q[0],q[8]; +u1(-2.263639202166759) q[8]; +cx q[0],q[8]; +cx q[1],q[8]; +u1(-2.263737234126243) q[8]; +cx q[1],q[8]; +cx q[2],q[8]; +u1(-2.263704447406143) q[8]; +cx q[2],q[8]; +cx q[3],q[8]; +u1(-2.263630946643386) q[8]; +cx q[3],q[8]; +cx q[4],q[8]; +u1(-2.263843917966827) q[8]; +cx q[4],q[8]; +cx q[5],q[8]; +u1(-2.263790570564822) q[8]; +cx q[5],q[8]; +cx q[6],q[8]; +u1(-2.264242895588455) q[8]; +cx q[6],q[8]; +cx q[7],q[8]; +u1(-2.2638152215065914) q[8]; +cx q[7],q[8]; +cx q[9],q[10]; +u1(6.65920205356393) q[10]; +cx q[9],q[10]; +cx q[9],q[11]; +u1(6.659286650766519) q[11]; +cx q[9],q[11]; +cx q[10],q[11]; +u1(6.659344725270989) q[11]; +cx q[10],q[11]; +cx q[9],q[12]; +u1(6.659304779774108) q[12]; +cx q[9],q[12]; +cx q[10],q[12]; +u1(6.659143770947396) q[12]; +cx q[10],q[12]; +cx q[11],q[12]; +u1(6.659236043042115) q[12]; +cx q[11],q[12]; +cx q[9],q[13]; +u1(6.659475845830197) q[13]; +cx q[9],q[13]; +cx q[10],q[13]; +u1(6.65923347384685) q[13]; +cx q[10],q[13]; +cx q[11],q[13]; +u1(6.659308143999303) q[13]; +cx q[11],q[13]; +cx q[12],q[13]; +u1(6.659399327903295) q[13]; +cx q[12],q[13]; +cx q[9],q[14]; +u1(6.659063495437911) q[14]; +cx q[9],q[14]; +cx q[10],q[14]; +u1(6.659220853378385) q[14]; +cx q[10],q[14]; +cx q[11],q[14]; +u1(6.659215639622764) q[14]; +cx q[11],q[14]; +cx q[12],q[14]; +u1(6.659358412903573) q[14]; +cx q[12],q[14]; +cx q[13],q[14]; +u1(6.65939660668462) q[14]; +cx q[13],q[14]; +cx q[9],q[15]; +u1(6.659397358859019) q[15]; +cx q[9],q[15]; +cx q[10],q[15]; +u1(6.659240102137975) q[15]; +cx q[10],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[10]; +u1(0.0043395143635601135) q[10]; +cx q[11],q[15]; +u1(6.659157278760315) q[15]; +cx q[11],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[11]; +u1(0.004431391808667263) q[11]; +cx q[12],q[15]; +u1(6.659337479796952) q[15]; +cx q[12],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[12]; +u1(0.0022899718537170133) q[12]; +cx q[13],q[15]; +u1(6.659414954631245) q[15]; +cx q[13],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[13]; +u1(-0.005282416691849647) q[13]; +cx q[14],q[15]; +u1(6.659449711139332) q[15]; +cx q[14],q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[14]; +u1(-4.4519962670104167e-05) q[14]; +u3(0.1175452497438579,-pi/2,pi/2) q[15]; +u1(0.008952561011580323) q[15]; +u3(0.1175452497438579,-pi/2,pi/2) q[9]; +u1(-0.008887441667715804) q[9]; +cx q[0],q[9]; +u1(-2.2637651915571646) q[9]; +cx q[0],q[9]; +cx q[0],q[10]; +cx q[1],q[9]; +u1(-2.2637401254189973) q[10]; +cx q[0],q[10]; +cx q[0],q[11]; +u1(-2.2637415260513802) q[11]; +cx q[0],q[11]; +cx q[0],q[12]; +u1(-2.2637142512911446) q[12]; +cx q[0],q[12]; +cx q[0],q[13]; +u1(-2.263717737247005) q[13]; +cx q[0],q[13]; +cx q[0],q[14]; +u1(-2.2637060976980043) q[14]; +cx q[0],q[14]; +cx q[0],q[15]; +u1(-2.2637028259375556) q[15]; +cx q[0],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[0]; +u1(-2.2637437004539174) q[9]; +cx q[1],q[9]; +cx q[1],q[10]; +u1(-2.2637314644273685) q[10]; +cx q[1],q[10]; +cx q[1],q[11]; +u1(-2.2637098066530026) q[11]; +cx q[1],q[11]; +cx q[1],q[12]; +u1(-2.263708538485574) q[12]; +cx q[1],q[12]; +cx q[1],q[13]; +u1(-2.263773083509491) q[13]; +cx q[1],q[13]; +cx q[1],q[14]; +u1(-2.263754968042311) q[14]; +cx q[1],q[14]; +cx q[1],q[15]; +u1(-2.2637402038138204) q[15]; +cx q[1],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[1]; +cx q[2],q[9]; +u1(-2.263740204484007) q[9]; +cx q[2],q[9]; +cx q[2],q[10]; +u1(-2.263796975614047) q[10]; +cx q[2],q[10]; +cx q[2],q[11]; +u1(-2.2637661225339083) q[11]; +cx q[2],q[11]; +cx q[2],q[12]; +u1(-2.2636514751187806) q[12]; +cx q[2],q[12]; +cx q[2],q[13]; +u1(-2.263704398730241) q[13]; +cx q[2],q[13]; +cx q[2],q[14]; +u1(-2.263671537799137) q[14]; +cx q[2],q[14]; +cx q[2],q[15]; +u1(-2.26375119854593) q[15]; +cx q[2],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[2]; +cx q[3],q[9]; +u1(-2.2637032538097515) q[9]; +cx q[3],q[9]; +cx q[3],q[10]; +u1(-2.2637720906145247) q[10]; +cx q[3],q[10]; +cx q[3],q[11]; +u1(-2.2637245379365143) q[11]; +cx q[3],q[11]; +cx q[3],q[12]; +u1(-2.263733385344875) q[12]; +cx q[3],q[12]; +cx q[3],q[13]; +u1(-2.2637320831014525) q[13]; +cx q[3],q[13]; +cx q[3],q[14]; +u1(-2.263675961691149) q[14]; +cx q[3],q[14]; +cx q[3],q[15]; +u1(-2.2636961083610236) q[15]; +cx q[3],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[3]; +cx q[4],q[9]; +u1(-2.2637895456373505) q[9]; +cx q[4],q[9]; +cx q[4],q[10]; +u1(-2.263729082898693) q[10]; +cx q[4],q[10]; +cx q[4],q[11]; +u1(-2.2636864809735564) q[11]; +cx q[4],q[11]; +cx q[4],q[12]; +u1(-2.263721878414526) q[12]; +cx q[4],q[12]; +cx q[4],q[13]; +u1(-2.2637734203753634) q[13]; +cx q[4],q[13]; +cx q[4],q[14]; +u1(-2.263736987107885) q[14]; +cx q[4],q[14]; +cx q[4],q[15]; +u1(-2.263748921138912) q[15]; +cx q[4],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[4]; +cx q[5],q[9]; +u1(-2.2638666942299577) q[9]; +cx q[5],q[9]; +cx q[5],q[10]; +u1(-2.2637021621812723) q[10]; +cx q[5],q[10]; +cx q[5],q[11]; +u1(-2.263738431454937) q[11]; +cx q[5],q[11]; +cx q[5],q[12]; +u1(-2.2638082914128335) q[12]; +cx q[5],q[12]; +cx q[5],q[13]; +u1(-2.263791730947688) q[13]; +cx q[5],q[13]; +cx q[5],q[14]; +u1(-2.2637388748117875) q[14]; +cx q[5],q[14]; +cx q[5],q[15]; +u1(-2.263679161799278) q[15]; +cx q[5],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[5]; +cx q[6],q[9]; +u1(-2.2633841720248054) q[9]; +cx q[6],q[9]; +cx q[6],q[10]; +u1(-2.2638668134507602) q[10]; +cx q[6],q[10]; +cx q[6],q[11]; +u1(-2.2636242463730243) q[11]; +cx q[6],q[11]; +cx q[6],q[12]; +u1(-2.263820120499304) q[12]; +cx q[6],q[12]; +cx q[6],q[13]; +u1(-2.2632201081886776) q[13]; +cx q[6],q[13]; +cx q[6],q[14]; +u1(-2.263815941634163) q[14]; +cx q[6],q[14]; +cx q[6],q[15]; +u1(-2.2639275729520603) q[15]; +cx q[6],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[6]; +cx q[7],q[9]; +u1(-2.2636798587945943) q[9]; +cx q[7],q[9]; +cx q[7],q[10]; +u1(-2.263779964067384) q[10]; +cx q[7],q[10]; +cx q[7],q[11]; +u1(-2.2636783967240257) q[11]; +cx q[7],q[11]; +cx q[7],q[12]; +u1(-2.2637454511424617) q[12]; +cx q[7],q[12]; +cx q[7],q[13]; +u1(-2.2637505092757015) q[13]; +cx q[7],q[13]; +cx q[7],q[14]; +u1(-2.2637713179684766) q[14]; +cx q[7],q[14]; +cx q[7],q[15]; +u1(-2.263682978116976) q[15]; +cx q[7],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[7]; +cx q[8],q[9]; +u1(-2.2638227328642775) q[9]; +cx q[8],q[9]; +cx q[8],q[10]; +u1(-2.2636806374645047) q[10]; +cx q[8],q[10]; +cx q[8],q[11]; +u1(-2.2636662248198705) q[11]; +cx q[8],q[11]; +cx q[8],q[12]; +u1(-2.2637209948567016) q[12]; +cx q[8],q[12]; +cx q[8],q[13]; +u1(-2.263673203013081) q[13]; +cx q[8],q[13]; +cx q[8],q[14]; +u1(-2.263712787483861) q[14]; +cx q[8],q[14]; +cx q[8],q[15]; +u1(-2.2637217901471773) q[15]; +cx q[8],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[8]; +cx q[9],q[10]; +u1(-2.2636966451242966) q[10]; +cx q[9],q[10]; +cx q[9],q[11]; +u1(-2.2637254026844587) q[11]; +cx q[9],q[11]; +cx q[10],q[11]; +u1(-2.263745144248069) q[11]; +cx q[10],q[11]; +cx q[9],q[12]; +u1(-2.2637315653708177) q[12]; +cx q[9],q[12]; +cx q[10],q[12]; +u1(-2.2636768328160866) q[12]; +cx q[10],q[12]; +cx q[11],q[12]; +u1(-2.2637081993416213) q[12]; +cx q[11],q[12]; +cx q[9],q[13]; +u1(-2.263789716731018) q[13]; +cx q[9],q[13]; +cx q[10],q[13]; +u1(-2.263707325981922) q[13]; +cx q[10],q[13]; +cx q[11],q[13]; +u1(-2.263732708989111) q[13]; +cx q[11],q[13]; +cx q[12],q[13]; +u1(-2.263763705600401) q[13]; +cx q[12],q[13]; +cx q[9],q[14]; +u1(-2.2636495443511855) q[14]; +cx q[9],q[14]; +cx q[10],q[14]; +u1(-2.263703035841468) q[14]; +cx q[10],q[14]; +cx q[11],q[14]; +u1(-2.263701263502828) q[14]; +cx q[11],q[14]; +cx q[12],q[14]; +u1(-2.2637497971550857) q[14]; +cx q[12],q[14]; +cx q[13],q[14]; +u1(-2.263762780562606) q[14]; +cx q[13],q[14]; +cx q[9],q[15]; +u1(-2.2637630362531) q[15]; +cx q[9],q[15]; +cx q[10],q[15]; +u1(-2.263709579170857) q[15]; +cx q[10],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[10]; +cx q[11],q[15]; +u1(-2.2636814245960837) q[15]; +cx q[11],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[11]; +cx q[12],q[15]; +u1(-2.2637426812569874) q[15]; +cx q[12],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[12]; +cx q[13],q[15]; +u1(-2.2637690176740324) q[15]; +cx q[13],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[13]; +cx q[14],q[15]; +u1(-2.2637808326317588) q[15]; +cx q[14],q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[14]; +u3(2.0010668389021116,-pi/2,pi/2) q[15]; +u3(2.0010668389021116,-pi/2,pi/2) q[9]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15]; +measure q[0] -> meas[0]; +measure q[1] -> meas[1]; +measure q[2] -> meas[2]; +measure q[3] -> meas[3]; +measure q[4] -> meas[4]; +measure q[5] -> meas[5]; +measure q[6] -> meas[6]; +measure q[7] -> meas[7]; +measure q[8] -> meas[8]; +measure q[9] -> meas[9]; +measure q[10] -> meas[10]; +measure q[11] -> meas[11]; +measure q[12] -> meas[12]; +measure q[13] -> meas[13]; +measure q[14] -> meas[14]; +measure q[15] -> meas[15]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15]; +measure q[0] -> meas0[0]; +measure q[1] -> meas0[1]; +measure q[2] -> meas0[2]; +measure q[3] -> meas0[3]; +measure q[4] -> meas0[4]; +measure q[5] -> meas0[5]; +measure q[6] -> meas0[6]; +measure q[7] -> meas0[7]; +measure q[8] -> meas0[8]; +measure q[9] -> meas0[9]; +measure q[10] -> meas0[10]; +measure q[11] -> meas0[11]; +measure q[12] -> meas0[12]; +measure q[13] -> meas0[13]; +measure q[14] -> meas0[14]; +measure q[15] -> meas0[15]; diff --git a/src/transpile_benchy/interfaces/hardcoded/qaoa_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/qaoa_n8.qasm new file mode 100644 index 0000000..12c4231 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/qaoa_n8.qasm @@ -0,0 +1,85 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; +creg meas[8]; +u(pi/2,0,pi) q[0]; +u(pi/2,0,pi) q[1]; +u(pi/2,0,pi) q[2]; +cx q[0],q[2]; +u(0,0,-6.872934164407839) q[2]; +cx q[0],q[2]; +u(pi/2,0,pi) q[3]; +cx q[2],q[3]; +u(0,0,-6.872934164407839) q[3]; +cx q[2],q[3]; +u(-8.29021729722295,-pi/2,pi/2) q[2]; +u(pi/2,0,pi) q[4]; +u(pi/2,0,pi) q[5]; +cx q[1],q[5]; +u(0,0,-6.872934164407839) q[5]; +cx q[1],q[5]; +cx q[4],q[5]; +u(0,0,-6.872934164407839) q[5]; +cx q[4],q[5]; +u(-8.29021729722295,-pi/2,pi/2) q[5]; +u(pi/2,0,pi) q[6]; +cx q[0],q[6]; +u(0,0,-6.872934164407839) q[6]; +cx q[0],q[6]; +u(-8.29021729722295,-pi/2,pi/2) q[0]; +cx q[0],q[2]; +u(0,0,3.6159499392651657) q[2]; +cx q[0],q[2]; +cx q[4],q[6]; +u(0,0,-6.872934164407839) q[6]; +cx q[4],q[6]; +u(-8.29021729722295,-pi/2,pi/2) q[4]; +u(-8.29021729722295,-pi/2,pi/2) q[6]; +cx q[0],q[6]; +u(0,0,3.6159499392651657) q[6]; +cx q[0],q[6]; +u(5.89208486777194,-pi/2,pi/2) q[0]; +u(pi/2,0,pi) q[7]; +cx q[1],q[7]; +u(0,0,-6.872934164407839) q[7]; +cx q[1],q[7]; +u(-8.29021729722295,-pi/2,pi/2) q[1]; +cx q[1],q[5]; +cx q[3],q[7]; +u(0,0,3.6159499392651657) q[5]; +cx q[1],q[5]; +cx q[4],q[5]; +u(0,0,3.6159499392651657) q[5]; +cx q[4],q[5]; +cx q[4],q[6]; +u(5.89208486777194,-pi/2,pi/2) q[5]; +u(0,0,3.6159499392651657) q[6]; +cx q[4],q[6]; +u(5.89208486777194,-pi/2,pi/2) q[4]; +u(5.89208486777194,-pi/2,pi/2) q[6]; +u(0,0,-6.872934164407839) q[7]; +cx q[3],q[7]; +u(-8.29021729722295,-pi/2,pi/2) q[3]; +cx q[2],q[3]; +u(0,0,3.6159499392651657) q[3]; +cx q[2],q[3]; +u(5.89208486777194,-pi/2,pi/2) q[2]; +u(-8.29021729722295,-pi/2,pi/2) q[7]; +cx q[1],q[7]; +u(0,0,3.6159499392651657) q[7]; +cx q[1],q[7]; +u(5.89208486777194,-pi/2,pi/2) q[1]; +cx q[3],q[7]; +u(0,0,3.6159499392651657) q[7]; +cx q[3],q[7]; +u(5.89208486777194,-pi/2,pi/2) q[3]; +u(5.89208486777194,-pi/2,pi/2) q[7]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]; +measure q[0] -> meas[0]; +measure q[1] -> meas[1]; +measure q[2] -> meas[2]; +measure q[3] -> meas[3]; +measure q[4] -> meas[4]; +measure q[5] -> meas[5]; +measure q[6] -> meas[6]; +measure q[7] -> meas[7]; diff --git a/src/transpile_benchy/interfaces/hardcoded/qft_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/qft_n8.qasm new file mode 100644 index 0000000..f6d10b5 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/qft_n8.qasm @@ -0,0 +1,174 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; +creg c[8]; +creg meas[8]; +u(pi/2,0,pi) q[7]; +u(0,0,pi/4) q[7]; +cx q[7],q[6]; +u(0,0,-pi/4) q[6]; +cx q[7],q[6]; +u(0,0,pi/4) q[6]; +u(pi/2,0,pi) q[6]; +u(0,0,pi/4) q[6]; +u(0,0,pi/8) q[7]; +cx q[7],q[5]; +u(0,0,-pi/8) q[5]; +cx q[7],q[5]; +u(0,0,pi/8) q[5]; +cx q[6],q[5]; +u(0,0,-pi/4) q[5]; +cx q[6],q[5]; +u(0,0,pi/4) q[5]; +u(pi/2,0,pi) q[5]; +u(0,0,pi/4) q[5]; +u(0,0,pi/8) q[6]; +u(0,0,pi/16) q[7]; +cx q[7],q[4]; +u(0,0,-pi/16) q[4]; +cx q[7],q[4]; +u(0,0,pi/16) q[4]; +cx q[6],q[4]; +u(0,0,-pi/8) q[4]; +cx q[6],q[4]; +u(0,0,pi/8) q[4]; +cx q[5],q[4]; +u(0,0,-pi/4) q[4]; +cx q[5],q[4]; +u(0,0,pi/4) q[4]; +u(pi/2,0,pi) q[4]; +u(0,0,pi/4) q[4]; +u(0,0,pi/8) q[5]; +u(0,0,pi/16) q[6]; +u(0,0,pi/32) q[7]; +cx q[7],q[3]; +u(0,0,-pi/32) q[3]; +cx q[7],q[3]; +u(0,0,pi/32) q[3]; +cx q[6],q[3]; +u(0,0,-pi/16) q[3]; +cx q[6],q[3]; +u(0,0,pi/16) q[3]; +cx q[5],q[3]; +u(0,0,-pi/8) q[3]; +cx q[5],q[3]; +u(0,0,pi/8) q[3]; +cx q[4],q[3]; +u(0,0,-pi/4) q[3]; +cx q[4],q[3]; +u(0,0,pi/4) q[3]; +u(pi/2,0,pi) q[3]; +u(0,0,pi/4) q[3]; +u(0,0,pi/8) q[4]; +u(0,0,pi/16) q[5]; +u(0,0,pi/32) q[6]; +u(0,0,pi/64) q[7]; +cx q[7],q[2]; +u(0,0,-pi/64) q[2]; +cx q[7],q[2]; +u(0,0,pi/64) q[2]; +cx q[6],q[2]; +u(0,0,-pi/32) q[2]; +cx q[6],q[2]; +u(0,0,pi/32) q[2]; +cx q[5],q[2]; +u(0,0,-pi/16) q[2]; +cx q[5],q[2]; +u(0,0,pi/16) q[2]; +cx q[4],q[2]; +u(0,0,-pi/8) q[2]; +cx q[4],q[2]; +u(0,0,pi/8) q[2]; +cx q[3],q[2]; +u(0,0,-pi/4) q[2]; +cx q[3],q[2]; +u(0,0,pi/4) q[2]; +u(pi/2,0,pi) q[2]; +u(0,0,pi/4) q[2]; +u(0,0,pi/8) q[3]; +u(0,0,pi/16) q[4]; +u(0,0,pi/32) q[5]; +u(0,0,pi/64) q[6]; +u(0,0,pi/128) q[7]; +cx q[7],q[1]; +u(0,0,-pi/128) q[1]; +cx q[7],q[1]; +u(0,0,pi/128) q[1]; +cx q[6],q[1]; +u(0,0,-pi/64) q[1]; +cx q[6],q[1]; +u(0,0,pi/64) q[1]; +cx q[5],q[1]; +u(0,0,-pi/32) q[1]; +cx q[5],q[1]; +u(0,0,pi/32) q[1]; +cx q[4],q[1]; +u(0,0,-pi/16) q[1]; +cx q[4],q[1]; +u(0,0,pi/16) q[1]; +cx q[3],q[1]; +u(0,0,-pi/8) q[1]; +cx q[3],q[1]; +u(0,0,pi/8) q[1]; +cx q[2],q[1]; +u(0,0,-pi/4) q[1]; +cx q[2],q[1]; +u(0,0,pi/4) q[1]; +u(pi/2,0,pi) q[1]; +u(0,0,pi/4) q[1]; +u(0,0,pi/8) q[2]; +u(0,0,pi/16) q[3]; +u(0,0,pi/32) q[4]; +u(0,0,pi/64) q[5]; +u(0,0,pi/128) q[6]; +u(0,0,pi/256) q[7]; +cx q[7],q[0]; +u(0,0,-pi/256) q[0]; +cx q[7],q[0]; +u(0,0,pi/256) q[0]; +cx q[6],q[0]; +u(0,0,-pi/128) q[0]; +cx q[6],q[0]; +u(0,0,pi/128) q[0]; +cx q[5],q[0]; +u(0,0,-pi/64) q[0]; +cx q[5],q[0]; +u(0,0,pi/64) q[0]; +cx q[4],q[0]; +u(0,0,-pi/32) q[0]; +cx q[4],q[0]; +u(0,0,pi/32) q[0]; +cx q[3],q[0]; +u(0,0,-pi/16) q[0]; +cx q[3],q[0]; +u(0,0,pi/16) q[0]; +cx q[2],q[0]; +u(0,0,-pi/8) q[0]; +cx q[2],q[0]; +u(0,0,pi/8) q[0]; +cx q[1],q[0]; +u(0,0,-pi/4) q[0]; +cx q[1],q[0]; +u(0,0,pi/4) q[0]; +u(pi/2,0,pi) q[0]; +cx q[0],q[7]; +cx q[1],q[6]; +cx q[2],q[5]; +cx q[3],q[4]; +cx q[4],q[3]; +cx q[3],q[4]; +cx q[5],q[2]; +cx q[2],q[5]; +cx q[6],q[1]; +cx q[1],q[6]; +cx q[7],q[0]; +cx q[0],q[7]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]; +measure q[0] -> meas[0]; +measure q[1] -> meas[1]; +measure q[2] -> meas[2]; +measure q[3] -> meas[3]; +measure q[4] -> meas[4]; +measure q[5] -> meas[5]; +measure q[6] -> meas[6]; +measure q[7] -> meas[7]; diff --git a/src/transpile_benchy/interfaces/hardcoded/qftentangled_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/qftentangled_n8.qasm new file mode 100644 index 0000000..0250951 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/qftentangled_n8.qasm @@ -0,0 +1,181 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; +creg meas[8]; +u(pi/2,0,pi) q[7]; +cx q[7],q[6]; +cx q[6],q[5]; +cx q[5],q[4]; +cx q[4],q[3]; +cx q[3],q[2]; +cx q[2],q[1]; +cx q[1],q[0]; +u(pi/2,0,pi) q[7]; +u(0,0,pi/4) q[7]; +cx q[7],q[6]; +u(0,0,-pi/4) q[6]; +cx q[7],q[6]; +u(0,0,pi/4) q[6]; +u(pi/2,0,pi) q[6]; +u(0,0,pi/4) q[6]; +u(0,0,pi/8) q[7]; +cx q[7],q[5]; +u(0,0,-pi/8) q[5]; +cx q[7],q[5]; +u(0,0,pi/8) q[5]; +cx q[6],q[5]; +u(0,0,-pi/4) q[5]; +cx q[6],q[5]; +u(0,0,pi/4) q[5]; +u(pi/2,0,pi) q[5]; +u(0,0,pi/4) q[5]; +u(0,0,pi/8) q[6]; +u(0,0,pi/16) q[7]; +cx q[7],q[4]; +u(0,0,-pi/16) q[4]; +cx q[7],q[4]; +u(0,0,pi/16) q[4]; +cx q[6],q[4]; +u(0,0,-pi/8) q[4]; +cx q[6],q[4]; +u(0,0,pi/8) q[4]; +cx q[5],q[4]; +u(0,0,-pi/4) q[4]; +cx q[5],q[4]; +u(0,0,pi/4) q[4]; +u(pi/2,0,pi) q[4]; +u(0,0,pi/4) q[4]; +u(0,0,pi/8) q[5]; +u(0,0,pi/16) q[6]; +u(0,0,pi/32) q[7]; +cx q[7],q[3]; +u(0,0,-pi/32) q[3]; +cx q[7],q[3]; +u(0,0,pi/32) q[3]; +cx q[6],q[3]; +u(0,0,-pi/16) q[3]; +cx q[6],q[3]; +u(0,0,pi/16) q[3]; +cx q[5],q[3]; +u(0,0,-pi/8) q[3]; +cx q[5],q[3]; +u(0,0,pi/8) q[3]; +cx q[4],q[3]; +u(0,0,-pi/4) q[3]; +cx q[4],q[3]; +u(0,0,pi/4) q[3]; +u(pi/2,0,pi) q[3]; +u(0,0,pi/4) q[3]; +u(0,0,pi/8) q[4]; +u(0,0,pi/16) q[5]; +u(0,0,pi/32) q[6]; +u(0,0,pi/64) q[7]; +cx q[7],q[2]; +u(0,0,-pi/64) q[2]; +cx q[7],q[2]; +u(0,0,pi/64) q[2]; +cx q[6],q[2]; +u(0,0,-pi/32) q[2]; +cx q[6],q[2]; +u(0,0,pi/32) q[2]; +cx q[5],q[2]; +u(0,0,-pi/16) q[2]; +cx q[5],q[2]; +u(0,0,pi/16) q[2]; +cx q[4],q[2]; +u(0,0,-pi/8) q[2]; +cx q[4],q[2]; +u(0,0,pi/8) q[2]; +cx q[3],q[2]; +u(0,0,-pi/4) q[2]; +cx q[3],q[2]; +u(0,0,pi/4) q[2]; +u(pi/2,0,pi) q[2]; +u(0,0,pi/4) q[2]; +u(0,0,pi/8) q[3]; +u(0,0,pi/16) q[4]; +u(0,0,pi/32) q[5]; +u(0,0,pi/64) q[6]; +u(0,0,pi/128) q[7]; +cx q[7],q[1]; +u(0,0,-pi/128) q[1]; +cx q[7],q[1]; +u(0,0,pi/128) q[1]; +cx q[6],q[1]; +u(0,0,-pi/64) q[1]; +cx q[6],q[1]; +u(0,0,pi/64) q[1]; +cx q[5],q[1]; +u(0,0,-pi/32) q[1]; +cx q[5],q[1]; +u(0,0,pi/32) q[1]; +cx q[4],q[1]; +u(0,0,-pi/16) q[1]; +cx q[4],q[1]; +u(0,0,pi/16) q[1]; +cx q[3],q[1]; +u(0,0,-pi/8) q[1]; +cx q[3],q[1]; +u(0,0,pi/8) q[1]; +cx q[2],q[1]; +u(0,0,-pi/4) q[1]; +cx q[2],q[1]; +u(0,0,pi/4) q[1]; +u(pi/2,0,pi) q[1]; +u(0,0,pi/4) q[1]; +u(0,0,pi/8) q[2]; +u(0,0,pi/16) q[3]; +u(0,0,pi/32) q[4]; +u(0,0,pi/64) q[5]; +u(0,0,pi/128) q[6]; +u(0,0,pi/256) q[7]; +cx q[7],q[0]; +u(0,0,-pi/256) q[0]; +cx q[7],q[0]; +u(0,0,pi/256) q[0]; +cx q[6],q[0]; +u(0,0,-pi/128) q[0]; +cx q[6],q[0]; +u(0,0,pi/128) q[0]; +cx q[5],q[0]; +u(0,0,-pi/64) q[0]; +cx q[5],q[0]; +u(0,0,pi/64) q[0]; +cx q[4],q[0]; +u(0,0,-pi/32) q[0]; +cx q[4],q[0]; +u(0,0,pi/32) q[0]; +cx q[3],q[0]; +u(0,0,-pi/16) q[0]; +cx q[3],q[0]; +u(0,0,pi/16) q[0]; +cx q[2],q[0]; +u(0,0,-pi/8) q[0]; +cx q[2],q[0]; +u(0,0,pi/8) q[0]; +cx q[1],q[0]; +u(0,0,-pi/4) q[0]; +cx q[1],q[0]; +u(0,0,pi/4) q[0]; +u(pi/2,0,pi) q[0]; +cx q[0],q[7]; +cx q[1],q[6]; +cx q[2],q[5]; +cx q[3],q[4]; +cx q[4],q[3]; +cx q[3],q[4]; +cx q[5],q[2]; +cx q[2],q[5]; +cx q[6],q[1]; +cx q[1],q[6]; +cx q[7],q[0]; +cx q[0],q[7]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]; +measure q[0] -> meas[0]; +measure q[1] -> meas[1]; +measure q[2] -> meas[2]; +measure q[3] -> meas[3]; +measure q[4] -> meas[4]; +measure q[5] -> meas[5]; +measure q[6] -> meas[6]; +measure q[7] -> meas[7]; diff --git a/src/transpile_benchy/interfaces/hardcoded/qpeexact_n8.qasm b/src/transpile_benchy/interfaces/hardcoded/qpeexact_n8.qasm new file mode 100644 index 0000000..cf05154 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/qpeexact_n8.qasm @@ -0,0 +1,177 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[7]; +qreg psi[1]; +creg c[7]; +u(pi/2,0,pi) q[0]; +u(pi/2,0,pi) q[1]; +u(pi/2,0,pi) q[2]; +u(pi/2,0,pi) q[3]; +u(pi/2,0,pi) q[4]; +u(pi/2,0,pi) q[5]; +u(pi/2,0,pi) q[6]; +u(pi,0,pi) psi[0]; +u(0,0,-1.3499030933393643) psi[0]; +cx psi[0],q[0]; +u(0,0,1.3499030933393643) q[0]; +cx psi[0],q[0]; +u(0,0,0.44178646691106466) psi[0]; +cx psi[0],q[1]; +u(0,0,-1.3499030933393643) q[0]; +u(0,0,-0.44178646691106466) q[1]; +cx psi[0],q[1]; +u(0,0,0.8835729338221293) psi[0]; +cx psi[0],q[2]; +u(0,0,0.44178646691106466) q[1]; +u(0,0,-0.8835729338221293) q[2]; +cx psi[0],q[2]; +u(0,0,-7*pi/16) psi[0]; +cx psi[0],q[3]; +u(0,0,0.8835729338221293) q[2]; +u(0,0,7*pi/16) q[3]; +cx psi[0],q[3]; +u(0,0,pi/8) psi[0]; +cx psi[0],q[4]; +u(0,0,-7*pi/16) q[3]; +u(0,0,-pi/16) q[3]; +u(0,0,-pi/8) q[4]; +cx psi[0],q[4]; +u(0,0,pi/4) psi[0]; +cx psi[0],q[5]; +u(0,0,pi/8) q[4]; +cx q[2],q[4]; +cx q[4],q[2]; +cx q[2],q[4]; +u(0,0,-pi/8) q[2]; +u(0,0,-pi/32) q[4]; +u(0,0,-pi/4) q[5]; +cx psi[0],q[5]; +u(0,0,pi/2) psi[0]; +cx psi[0],q[6]; +u(0,0,pi/4) q[5]; +cx q[1],q[5]; +cx q[5],q[1]; +cx q[1],q[5]; +u(0,0,-pi/4) q[1]; +u(0,0,-pi/64) q[5]; +u(0,0,-pi/2) q[6]; +cx psi[0],q[6]; +u(0,0,pi/2) q[6]; +cx q[0],q[6]; +cx q[6],q[0]; +cx q[0],q[6]; +u(pi/2,0,pi) q[0]; +cx q[1],q[0]; +u(0,0,pi/4) q[0]; +cx q[1],q[0]; +u(0,0,-pi/4) q[0]; +u(pi/2,0,pi) q[1]; +cx q[2],q[0]; +u(0,0,pi/8) q[0]; +cx q[2],q[0]; +u(0,0,-pi/8) q[0]; +u(0,0,-pi/4) q[2]; +cx q[2],q[1]; +u(0,0,pi/4) q[1]; +cx q[2],q[1]; +u(0,0,-pi/4) q[1]; +u(pi/2,0,pi) q[2]; +cx q[3],q[0]; +u(0,0,pi/16) q[0]; +cx q[3],q[0]; +u(0,0,-pi/16) q[0]; +u(0,0,-pi/8) q[3]; +cx q[3],q[1]; +u(0,0,pi/8) q[1]; +cx q[3],q[1]; +u(0,0,-pi/8) q[1]; +u(0,0,-pi/4) q[3]; +cx q[3],q[2]; +u(0,0,pi/4) q[2]; +cx q[3],q[2]; +u(0,0,-pi/4) q[2]; +u(pi/2,0,pi) q[3]; +cx q[4],q[0]; +u(0,0,pi/32) q[0]; +cx q[4],q[0]; +u(0,0,-pi/32) q[0]; +u(0,0,-pi/16) q[4]; +cx q[4],q[1]; +u(0,0,pi/16) q[1]; +cx q[4],q[1]; +u(0,0,-pi/16) q[1]; +u(0,0,-pi/8) q[4]; +cx q[4],q[2]; +u(0,0,pi/8) q[2]; +cx q[4],q[2]; +u(0,0,-pi/8) q[2]; +u(0,0,-pi/4) q[4]; +cx q[4],q[3]; +u(0,0,pi/4) q[3]; +cx q[4],q[3]; +u(0,0,-pi/4) q[3]; +u(pi/2,0,pi) q[4]; +cx q[5],q[0]; +u(0,0,pi/64) q[0]; +cx q[5],q[0]; +u(0,0,-pi/64) q[0]; +u(0,0,-pi/32) q[5]; +cx q[5],q[1]; +u(0,0,pi/32) q[1]; +cx q[5],q[1]; +u(0,0,-pi/32) q[1]; +u(0,0,-pi/16) q[5]; +cx q[5],q[2]; +u(0,0,pi/16) q[2]; +cx q[5],q[2]; +u(0,0,-pi/16) q[2]; +u(0,0,-pi/8) q[5]; +cx q[5],q[3]; +u(0,0,pi/8) q[3]; +cx q[5],q[3]; +u(0,0,-pi/8) q[3]; +u(0,0,-pi/4) q[5]; +cx q[5],q[4]; +u(0,0,pi/4) q[4]; +cx q[5],q[4]; +u(0,0,-pi/4) q[4]; +u(pi/2,0,pi) q[5]; +u(0,0,-pi/128) q[6]; +cx q[6],q[0]; +u(0,0,pi/128) q[0]; +cx q[6],q[0]; +u(0,0,-pi/128) q[0]; +u(0,0,-pi/64) q[6]; +cx q[6],q[1]; +u(0,0,pi/64) q[1]; +cx q[6],q[1]; +u(0,0,-pi/64) q[1]; +u(0,0,-pi/32) q[6]; +cx q[6],q[2]; +u(0,0,pi/32) q[2]; +cx q[6],q[2]; +u(0,0,-pi/32) q[2]; +u(0,0,-pi/16) q[6]; +cx q[6],q[3]; +u(0,0,pi/16) q[3]; +cx q[6],q[3]; +u(0,0,-pi/16) q[3]; +u(0,0,-pi/8) q[6]; +cx q[6],q[4]; +u(0,0,pi/8) q[4]; +cx q[6],q[4]; +u(0,0,-pi/8) q[4]; +u(0,0,-pi/4) q[6]; +cx q[6],q[5]; +u(0,0,pi/4) q[5]; +cx q[6],q[5]; +u(0,0,-pi/4) q[5]; +u(pi/2,0,pi) q[6]; +barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],psi[0]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +measure q[2] -> c[2]; +measure q[3] -> c[3]; +measure q[4] -> c[4]; +measure q[5] -> c[5]; +measure q[6] -> c[6]; diff --git a/src/transpile_benchy/interfaces/hardcoded/toffoli_n3.qasm b/src/transpile_benchy/interfaces/hardcoded/toffoli_n3.qasm new file mode 100644 index 0000000..ec72d80 --- /dev/null +++ b/src/transpile_benchy/interfaces/hardcoded/toffoli_n3.qasm @@ -0,0 +1,25 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg a[3]; +creg c[3]; +u(pi,0,pi) a[0]; +u(pi,0,pi) a[1]; +u(pi/2,0,pi) a[2]; +cx a[1],a[2]; +u(0,0,-pi/4) a[2]; +cx a[0],a[2]; +u(0,0,pi/4) a[2]; +cx a[1],a[2]; +u(0,0,-pi/4) a[1]; +u(0,0,-pi/4) a[2]; +cx a[0],a[2]; +cx a[0],a[1]; +u(0,0,-pi/4) a[1]; +cx a[0],a[1]; +u(0,0,pi/4) a[0]; +u(0,0,pi/2) a[1]; +u(0,0,pi/4) a[2]; +u(pi/2,0,pi) a[2]; +measure a[0] -> c[0]; +measure a[1] -> c[1]; +measure a[2] -> c[2]; diff --git a/src/transpile_benchy/interfaces/mqt_interface.py b/src/transpile_benchy/interfaces/mqt_interface.py index ba69883..ca2e0ec 100644 --- a/src/transpile_benchy/interfaces/mqt_interface.py +++ b/src/transpile_benchy/interfaces/mqt_interface.py @@ -1,6 +1,6 @@ """MQTBench submodule interface.""" from typing import Dict, List, Optional - +from pathlib import Path from mqt.bench.benchmark_generator import get_benchmark from mqt.bench.utils import get_supported_benchmarks from qiskit import QuantumCircuit @@ -13,7 +13,9 @@ class MQTBench(SubmoduleInterface): """Submodule for MQTBench circuits.""" def __init__( - self, num_qubits: int, filter_config: Optional[Dict[str, List[str]]] = None + self, + num_qubits: int, + filter_config: Optional[Dict[str, List[str]]] = None, ) -> None: """Initialize MQTBench submodule.""" self.num_qubits = num_qubits @@ -30,7 +32,9 @@ def _get_all_circuits(self) -> List[str]: """ return get_supported_benchmarks() - def _load_circuit(self, circuit_str: str, num_qubits=None) -> QuantumCircuit: + def _load_circuit( + self, circuit_str: str, num_qubits=None + ) -> QuantumCircuit: """Load a QuantumCircuit from a string.""" try: n = num_qubits or self.num_qubits diff --git a/src/transpile_benchy/interfaces/qasm_interface.py b/src/transpile_benchy/interfaces/qasm_interface.py index 59eed33..5ba30b1 100644 --- a/src/transpile_benchy/interfaces/qasm_interface.py +++ b/src/transpile_benchy/interfaces/qasm_interface.py @@ -14,7 +14,9 @@ class QASMInterface(SubmoduleInterface, ABC): """Abstract class for a submodule that has QASM files.""" - def __init__(self, filter_config: Optional[Dict[str, List[str]]] = None) -> None: + def __init__( + self, filter_config: Optional[Dict[str, List[str]]] = None + ) -> None: """Initialize QASM submodule.""" self.path_dict = self._get_path_dict() super().__init__(filter_config) @@ -43,11 +45,23 @@ def _get_path_dict(self) -> Dict[str, Path]: raise NotImplementedError +class Hardcoded(QASMInterface): + """Submodule for QASM files I manually loaded into interfaces/hardcoded/.""" + + def _get_path_dict(self) -> Dict[str, str]: + """Return a list of all possible circuits.""" + prepath = Path(__file__).resolve().parent + qasm_files = prepath.glob("hardcoded/*.qasm") + return {file.stem: str(file) for file in qasm_files} + + class QASMBench(QASMInterface): """Submodule for QASMBench circuits.""" def __init__( - self, size: str = None, filter_config: Optional[Dict[str, List[str]]] = None + self, + size: str = None, + filter_config: Optional[Dict[str, List[str]]] = None, ): """Initialize QASMBench submodule. @@ -70,9 +84,13 @@ def __init__( def _get_path_dict(self) -> Dict[str, str]: """Return a dictionary mapping circuit names to their file paths.""" prepath = Path(__file__).resolve().parent.parent.parent.parent - qasm_files = prepath.glob(f"submodules/QASMBench/{self.size}/**/*.qasm") + qasm_files = prepath.glob( + f"submodules/QASMBench/{self.size}/**/*.qasm" + ) # specific to this interface - filter out the transpiled files - qasm_files = filter(lambda file: "_transpiled" not in str(file), qasm_files) + qasm_files = filter( + lambda file: "_transpiled" not in str(file), qasm_files + ) return {file.stem: str(file) for file in qasm_files} @@ -82,7 +100,9 @@ class RedQueen(QASMInterface): def _get_path_dict(self) -> Dict[str, str]: """Return a list of all possible circuits.""" prepath = Path(__file__).resolve().parent.parent.parent.parent - qasm_files = prepath.glob("submodules/red-queen/red_queen/games/**/*.qasm") + qasm_files = prepath.glob( + "submodules/red-queen/red_queen/games/**/*.qasm" + ) # exclude red_queen/games/mapping/benchmarks/queko qasm_files = filter(lambda file: "queko" not in str(file), qasm_files) @@ -101,7 +121,9 @@ def conventional_filename(stem): # Insert _n between the last two parts return "_n".join(parts) - return {conventional_filename(file.stem): str(file) for file in qasm_files} + return { + conventional_filename(file.stem): str(file) for file in qasm_files + } class Queko(QASMInterface): @@ -125,8 +147,8 @@ def _get_path_dict(self) -> Dict[str, str]: ) def conventional_filename(stem): - return ( - f"{re.findall('[a-zA-Z]+', stem)[0]}_n{re.findall('[0-9]+$', stem)[0]}" - ) + return f"{re.findall('[a-zA-Z]+', stem)[0]}_n{re.findall('[0-9]+$', stem)[0]}" - return {conventional_filename(file.stem): str(file) for file in qasm_files} + return { + conventional_filename(file.stem): str(file) for file in qasm_files + } diff --git a/src/transpile_benchy/interfaces/qiskit_circuits.py b/src/transpile_benchy/interfaces/qiskit_circuits.py index 3544371..f159974 100644 --- a/src/transpile_benchy/interfaces/qiskit_circuits.py +++ b/src/transpile_benchy/interfaces/qiskit_circuits.py @@ -18,6 +18,7 @@ ) from qiskit.circuit.library.arithmetic.multipliers import RGQFTMultiplier from qiskit.circuit.library.basis_change import QFT +from qiskit.circuit.library import TwoLocal depth = 4 # arbitary idk what to set this to @@ -32,7 +33,9 @@ def vqe_linear(q): num_qubits=q, entanglement="linear", reps=depth * 2 ) for param in vqe_circuit_linear.parameters: - vqe_circuit_linear.assign_parameters({param: np.random.rand()}, inplace=1) + vqe_circuit_linear.assign_parameters( + {param: np.random.rand()}, inplace=1 + ) return vqe_circuit_linear @@ -40,9 +43,13 @@ def vqe_full(q): """Return a VQE circuit with full entanglement.""" # set np random seed # np.random.seed(42) - vqe_circuit_full = EfficientSU2(num_qubits=q, entanglement="full", reps=depth * 2) + vqe_circuit_full = EfficientSU2( + num_qubits=q, entanglement="full", reps=depth * 2 + ) for param in vqe_circuit_full.parameters: - vqe_circuit_full.assign_parameters({param: np.random.rand()}, inplace=1) + vqe_circuit_full.assign_parameters( + {param: np.random.rand()}, inplace=1 + ) return vqe_circuit_full @@ -73,7 +80,10 @@ def qaoa(q): qc_p.rzz(2 * np.random.rand(), pair[0], pair[1]) qc_p.barrier() qaoa_qc = QAOAAnsatz( - cost_operator=qc_p, reps=depth, initial_state=None, mixer_operator=qc_mix + cost_operator=qc_p, + reps=depth, + initial_state=None, + mixer_operator=qc_mix, ) return qaoa_qc @@ -126,7 +136,9 @@ def hlf(q): # Grover def grover(q): """Return a Grover circuit.""" - q = int(q / 2) # Grover's take so long because of the MCMT, do a smaller circuit + q = int( + q / 2 + ) # Grover's take so long because of the MCMT, do a smaller circuit # set numpy seed np.random.seed(42) # integer iteration @@ -141,6 +153,43 @@ def grover(q): return grover_qc +# TwoLocal +# CX, iSWAP, sqrt(iSWAP), ECP +# twolocalcnot_n16 +# twolocaliswap_n16 +# twolocalsqrtiswap_n16 +# twolocalecp_n16 +from qiskit.circuit.library import TwoLocal, CXGate, iSwapGate +from qiskit.quantum_info.operators import Operator + +ecp = QuantumCircuit(2) +ecp.append(iSwapGate().power(1 / 2), [0, 1]) +ecp.swap(0, 1) +ecp = ecp.to_gate() + + +def two_local_function_generator(entanglement_gate, func_name): + def twolocal(q): + return TwoLocal( + num_qubits=q, + reps=depth, + rotation_blocks=["rx", "ry"], + entanglement_blocks=entanglement_gate, + ) + + twolocal.__name__ = func_name + return twolocal + + +# Create functions using the generator: +twolocalcnot = two_local_function_generator(CXGate(), "twolocalcnot") +twolocaliswap = two_local_function_generator(iSwapGate(), "twolocaliswap") +twolocalsqrtiswap = two_local_function_generator( + iSwapGate().power(1 / 2), "twolocalsqrtiswap" +) +twolocalecp = two_local_function_generator(ecp, "twolocalecp") + + # List of all available circuits available_circuits = [ vqe_full, @@ -153,4 +202,8 @@ def grover(q): ghz, hlf, grover, + twolocalcnot, + twolocaliswap, + twolocalsqrtiswap, + twolocalecp, ] diff --git a/src/transpile_benchy/library.py b/src/transpile_benchy/library.py index e139ceb..2576032 100644 --- a/src/transpile_benchy/library.py +++ b/src/transpile_benchy/library.py @@ -9,6 +9,7 @@ BQSKitInterface, QASMBench, RedQueen, + Hardcoded, ) from transpile_benchy.interfaces.qiskit_interface import QiskitCircuitInterface @@ -26,6 +27,8 @@ def __init__( self.interfaces = interfaces else: # add all interfaces self.interfaces = [] + # hardcoded goes first so it will skip loading from others + self.interfaces.append(Hardcoded()) self.interfaces.append(QASMBench()) self.interfaces.append(RedQueen()) # self.interfaces.append(MQTBench(num_qubits=0))