def _get_circuits_to_compile(slice_circuits_list): circuits_to_compile = [] for slice_circuits, blocking in slice_circuits_list: for slice_circuit, block, connected_qubit_pairs in zip( slice_circuits, blocking.blocks, blocking.connected_qubit_pairs_list): for index in block: assert len(slice_circuit.qregs) == 1 slice_circuit.iden(slice_circuit.qregs[0][index]) slice_circuit = squash_circuit(slice_circuit) for subslice in get_uccsd_slices(slice_circuit, granularity=2, dependence_grouping=True): circuits_to_compile.append( (subslice.circuit, connected_qubit_pairs)) return circuits_to_compile
slice_circuits_list.append((slice_circuits, blocking)) gates = remaining_gates blockings_index = (blockings_index + 1) % len(blockings) #print('Num slices for N=%d, p=%d: %d' % (graph_N, graph_p, len(slice_circuits_list))) slice_circuits, blocking = slice_circuits_list[int(slice_id)] # HACK ALERT: to preserve all qubits, I add a dummy identity on each qubit, then squash times = [] for slice_circuit, block, connected_qubit_pairs in zip( slice_circuits, blocking.blocks, blocking.connected_qubit_pairs_list): for index in block: assert len(slice_circuit.qregs) == 1 slice_circuit.iden(slice_circuit.qregs[0][index]) slice_circuit = util.squash_circuit(slice_circuit) N = slice_circuit.width() H0 = hamiltonian.get_H0(N, d) Hops, Hnames = hamiltonian.get_Hops_and_Hnames(N, d, connected_qubit_pairs) states_concerned_list = hamiltonian.get_full_states_concerned_list(N, d) maxA = hamiltonian.get_maxA(N, d, connected_qubit_pairs) max_time = (3 * N) * 5.0 * graph_p time = 0.0 for subslice in uccsd.get_uccsd_slices(slice_circuit, granularity=1): if subslice.parameterized: time += util.circuitutil.get_max_pulse_time(subslice.circuit) else: U = util.get_unitary(subslice.circuit) time += binary_search_for_shortest_pulse_time(0.0, max_time,