Skip to content

Commit

Permalink
Merge pull request #634 from qulacs/632-optimize-light-parametric
Browse files Browse the repository at this point in the history
do not merge parametric gate in optimize_light
  • Loading branch information
KowerKoint committed Apr 26, 2024
2 parents 725c4a7 + 87e87ff commit b2ad590
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cppsim/circuit_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,16 @@ void QuantumCircuitOptimizer::optimize_light(
target_qubits.begin(), target_qubits.end())) {
// we merge gates only when it does not interfere swap insertion
if (can_merge_with_swap_insertion(pos, ind1, swap_level)) {
// parametric gate cannot be merged
if (circuit->gate_list[pos]->is_parametric() ||
gate->is_parametric())
continue;
auto merged_gate = gate::merge(circuit->gate_list[pos], gate);
circuit->remove_gate(ind1);
circuit->add_gate(merged_gate, pos + 1);
circuit->remove_gate(pos);
ind1--;
}

// std::cout << "merge ";
// for (auto val : target_qubits) std::cout << val << " ";
// std::cout << " into ";
// for (auto val : parent_qubits) std::cout << val << " ";
// std::cout << std::endl;
} else {
for (auto target_qubit : target_qubits) {
current_step[target_qubit] = make_pair(ind1, target_qubits);
Expand Down

0 comments on commit b2ad590

Please sign in to comment.