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

Incorrect final map from compilation unit #1710

Open
daniel-mills-cqc opened this issue Dec 4, 2024 · 0 comments
Open

Incorrect final map from compilation unit #1710

daniel-mills-cqc opened this issue Dec 4, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@daniel-mills-cqc
Copy link
Contributor

daniel-mills-cqc commented Dec 4, 2024

from pytket.extensions.qiskit import AerBackend
from pytket import Circuit, Qubit
from pytket.predicates import CompilationUnit
import qiskit_aer.noise as noise

def spam_noise_model(n_qubits, prob_ro):

    noise_model = noise.NoiseModel()
        
    probabilities = [[1-prob_ro, prob_ro],[prob_ro, 1-prob_ro]]
    error_ro = noise.ReadoutError(probabilities)
    for i in range(n_qubits):
        noise_model.add_readout_error(error_ro, [i])
        
    return noise_model

backend = AerBackend(
    noise_model=spam_noise_model(n_qubits=4, prob_ro=0.1)
)

qubit = Qubit(name='my_qubit', index=0)
circuit = Circuit()
circuit.add_qubit(qubit)
circuit.X(qubit)

cu = CompilationUnit(circuit)
backend.default_compilation_pass(
    optimisation_level=1
).apply(cu)
print(cu.circuit.get_commands())
print(cu.final_map)

gives

[TK1(0, 1, 0) node[2];]
{my_qubit[0]: my_qubit[0]}

whereas the final map should be (or with the key value reversed)

{my_qubit[0]: node[2]}
@daniel-mills-cqc daniel-mills-cqc added the bug Something isn't working label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants