Skip to content

Commit

Permalink
Additional cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Sep 18, 2024
1 parent 3d8891c commit 607aa1f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions crates/accelerate/src/sabre/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
mod heuristic;
mod layer;
mod layout;
pub mod neighbor_table;
pub mod route;
mod neighbor_table;
mod route;
pub mod sabre_dag;
pub mod swap_map;

Expand Down
2 changes: 1 addition & 1 deletion crates/accelerate/src/two_qubit_decompose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ impl Default for TwoQubitGateSequence {
#[allow(non_snake_case)]
#[pyclass(module = "qiskit._accelerate.two_qubit_decompose", subclass)]
pub struct TwoQubitBasisDecomposer {
pub gate: String,
gate: String,
basis_fidelity: f64,
euler_basis: EulerBasis,
pulse_optimize: Option<bool>,
Expand Down
2 changes: 1 addition & 1 deletion crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ impl DAGCircuit {
/// Args:
/// angle (float, :class:`.ParameterExpression`): The phase angle.
#[setter]
pub fn set_global_phase(&mut self, angle: Param) -> PyResult<()> {
fn set_global_phase(&mut self, angle: Param) -> PyResult<()> {
match angle {
Param::Float(angle) => {
self.global_phase = Param::Float(angle.rem_euclid(2. * PI));
Expand Down
8 changes: 0 additions & 8 deletions qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from itertools import product
from functools import partial
import numpy as np
import rustworkx

from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES
from qiskit.circuit import Gate, Parameter, CircuitInstruction
Expand Down Expand Up @@ -74,7 +73,6 @@
from qiskit.transpiler.passes.synthesis import plugin
from qiskit.transpiler.target import Target

from qiskit._accelerate.sabre import NeighborTable
from qiskit._accelerate.unitary_synthesis import run_default_main_loop

GATE_NAME_MAP = {
Expand Down Expand Up @@ -258,10 +256,8 @@ def _preferred_direction(
if coupling_map is not None:
neighbors0 = coupling_map.neighbors(qubits[0])
zero_one = qubits[1] in neighbors0

neighbors1 = coupling_map.neighbors(qubits[1])
one_zero = qubits[0] in neighbors1

if zero_one and not one_zero:
preferred_direction = [0, 1]
if one_zero and not zero_one:
Expand Down Expand Up @@ -307,7 +303,6 @@ def _preferred_direction(
preferred_direction = [0, 1]
elif cost_1_0 < cost_0_1:
preferred_direction = [1, 0]

if natural_direction is True and preferred_direction is None:
raise TranspilerError(
f"No preferred direction of gate on qubits {qubits} "
Expand Down Expand Up @@ -903,7 +898,6 @@ def is_controlled(gate):
if error is None:
error = 0.0
basis_2q_fidelity[strength] = 1 - error

# rewrite XX of the same strength in terms of it
embodiment = XXEmbodiments[v.base_class]
if len(embodiment.parameters) == 1:
Expand Down Expand Up @@ -1066,14 +1060,12 @@ def _reversed_synth_su4(self, su4_mat, decomposer2q, approximation_degree):
su4_mat_mm[[1, 2]] = su4_mat_mm[[2, 1]]
su4_mat_mm[:, [1, 2]] = su4_mat_mm[:, [2, 1]]
synth_circ = decomposer2q(su4_mat_mm, approximate=approximate, use_dag=True)

out_dag = DAGCircuit()
out_dag.global_phase = synth_circ.global_phase
out_dag.add_qubits(list(reversed(synth_circ.qubits)))
flip_bits = out_dag.qubits[::-1]
for node in synth_circ.topological_op_nodes():
qubits = tuple(flip_bits[synth_circ.find_bit(x).index] for x in node.qargs)

node = DAGOpNode.from_instruction(
node._to_circuit_instruction().replace(qubits=qubits, params=node.params)
)
Expand Down

0 comments on commit 607aa1f

Please sign in to comment.