Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of wire_names #1073

Open
csookim opened this issue Oct 16, 2024 · 3 comments
Open

Use of wire_names #1073

csookim opened this issue Oct 16, 2024 · 3 comments
Labels

Comments

@csookim
Copy link
Member

csookim commented Oct 16, 2024

qibolab already allows selecting target qubits using qubit names str. Circuit.wire_names: list[str] contains these qubit names in qibo. The method for accessing them needs to be updated.

qiboteam/qibo#1493

@csookim
Copy link
Member Author

csookim commented Oct 23, 2024

gate_seq = self._compile_gate(gate, platform, channel_clock)

gate_seq = self.get_sequence(gate, platform)

qubits = [natives.single_qubit[platform.qubit(q)[0]] for q in gate.qubits]

def _element(self, qubit: QubitId, coupler=False) -> tuple[QubitId, Qubit]:
elements = self.qubits if not coupler else self.couplers
try:
return qubit, elements[qubit]
except KeyError:
assert isinstance(qubit, int)
return list(self.qubits.items())[qubit]
def qubit(self, qubit: QubitId) -> tuple[QubitId, Qubit]:
"""Retrieve physical qubit name and object.
Temporary fix for the compiler to work for platforms where the
qubits are not named as 0, 1, 2, ...
"""
return self._element(qubit)
def coupler(self, coupler: QubitId) -> tuple[QubitId, Qubit]:
"""Retrieve physical coupler name and object.
Temporary fix for the compiler to work for platforms where the
couplers are not named as 0, 1, 2, ...
"""
return self._element(coupler, coupler=True)

@alecandido
Copy link
Member

Yes, as you noticed, the str names are already supported at the Platform level.

I confirm that you should just make use of them in the compiler, where you are receiving the Circuit directly from the backend.

sequence, measurement_map = self.compiler.compile(circuit, self.platform)

@csookim csookim mentioned this issue Oct 25, 2024
4 tasks
@csookim
Copy link
Member Author

csookim commented Oct 29, 2024

Once qiboteam/qibo#1500 is merged, all code using _wire_names should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants