File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
cirq-core/cirq/transformers/routing Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,12 @@ class AbstractInitialMapper(metaclass=abc.ABCMeta):
3737 """
3838
3939 @abc .abstractmethod
40- def initial_mapping (self ) -> Dict ['cirq.Qid' , 'cirq.Qid' ]:
40+ def initial_mapping (self , circuit : 'cirq.AbstractCircuit' ) -> Dict ['cirq.Qid' , 'cirq.Qid' ]:
4141 """Maps the logical qubits of a circuit onto physical qubits on a device.
4242
43+ Args:
44+ circuit: the input circuit with logical qubits.
45+
4346 Returns:
4447 qubit_map: the initial mapping of logical qubits to physical qubits.
4548 """
@@ -52,9 +55,12 @@ class HardCodedInitialMapper(AbstractInitialMapper):
5255 def __init__ (self , _map : Dict ['cirq.Qid' , 'cirq.Qid' ]) -> None :
5356 self ._map = _map
5457
55- def initial_mapping (self ) -> Dict ['cirq.Qid' , 'cirq.Qid' ]:
58+ def initial_mapping (self , circuit : 'cirq.AbstractCircuit' ) -> Dict ['cirq.Qid' , 'cirq.Qid' ]:
5659 """Returns the hard-coded initial mapping.
5760
61+ Args:
62+ circuit: the input circuit with logical qubits.
63+
5864 Returns:
5965 the hard-codded initial mapping.
6066 """
Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ def test_identity_initial_mapper():
1919 input_map = {cirq .NamedQubit (str (i )): cirq .NamedQubit (str (- i )) for i in range (1 , 6 )}
2020 initial_mapper = cirq .HardCodedInitialMapper (input_map )
2121
22- assert input_map == initial_mapper .initial_mapping ()
22+ assert input_map == initial_mapper .initial_mapping (cirq . Circuit () )
2323 assert str (initial_mapper ) == f'{ input_map } '
2424 cirq .testing .assert_equivalent_repr (initial_mapper )
You can’t perform that action at this time.
0 commit comments