Skip to content

Commit

Permalink
fix: remove dead codes
Browse files Browse the repository at this point in the history
  • Loading branch information
changsookim committed Oct 24, 2024
1 parent 01b667d commit 4e21132
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
1 change: 0 additions & 1 deletion src/qibo/models/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def wire_names(self, wire_names: Union[list, dict]):
)

self._wire_names = wire_names.copy()
# self._wire_names = wire_names
elif isinstance(wire_names, dict):
if len(wire_names.keys()) > self.nqubits:
raise_error(
Expand Down
10 changes: 0 additions & 10 deletions src/qibo/transpiler/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,13 @@ def assert_circuit_equivalence(
for _ in range(ntests)
]

# original: list = original_circuit.wire_names
# transpiled: list = transpiled_circuit.wire_names
# initial_map = [0, 1, 2, 3, 4]
# initial_map = [original.index(qubit) for qubit in transpiled]
# reordered_test_states = []
# reordered_test_states = [
# _transpose_qubits(initial_state, initial_map) for initial_state in test_states
# ]

ordering = list(final_map.values())

for i, state in enumerate(test_states):
target_state = backend.execute_circuit(
original_circuit, initial_state=state
).state()
final_state = backend.execute_circuit(
# transpiled_circuit, initial_state=reordered_test_states[i]
transpiled_circuit,
initial_state=state,
).state()
Expand Down
15 changes: 1 addition & 14 deletions src/qibo/transpiler/placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ def __call__(self, circuit: Circuit):
Args:
circuit (:class:`qibo.models.circuit.Circuit`): circuit to be transpiled.
Returns:
(dict): physical to logical qubit mapping.
"""
gates_qubits_pairs = _find_gates_qubits_pairs(circuit)
if len(gates_qubits_pairs) < 3:
Expand Down Expand Up @@ -236,8 +233,6 @@ def __call__(self, circuit: Circuit):
break

circuit.wire_names = sorted(result.mapping, key=lambda k: result.mapping[k])
# sorted_result = dict(sorted(result.mapping.items()))
# circuit.wire_names = sorted(sorted_result, key=sorted_result.get)


class Random(Placer):
Expand All @@ -264,9 +259,6 @@ def __call__(self, circuit):
Args:
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be transpiled.
Returns:
(dict): physical-to-logical qubit mapping.
"""
_, local_state = _check_backend_and_local_state(self.seed, backend=None)
gates_qubits_pairs = _find_gates_qubits_pairs(circuit)
Expand Down Expand Up @@ -352,15 +344,10 @@ def __call__(self, circuit: Circuit):
Args:
circuit (:class:`qibo.models.circuit.Circuit`): circuit to be transpiled.
Returns:
(dict): physical to logical qubit mapping.
"""
self.routing_algorithm.connectivity = self.connectivity
new_circuit = self._assemble_circuit(circuit)
final_placement = self._routing_step(new_circuit)

# return final_placement
self._routing_step(new_circuit)

def _assemble_circuit(self, circuit: Circuit):
"""Assemble a single circuit to apply Reverse Traversal placement based on depth.
Expand Down

0 comments on commit 4e21132

Please sign in to comment.