Skip to content

Commit

Permalink
Issue #51 | multiple registers (#56)
Browse files Browse the repository at this point in the history
* adding registers mapping for correct execution
* using find_bit function instead of direct variable access
  • Loading branch information
Morcu committed Jul 19, 2022
1 parent 1f64aae commit 440911a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions qiskit_braket_provider/providers/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,15 @@ def convert_qiskit_to_braket_circuit(circuit: QuantumCircuit) -> Circuit:
for qiskit_gates in circuit.data:
name = qiskit_gates[0].name
if name == "measure":
# TODO: change Probability result type for Sample for proper functioning # pylint:disable=fixme
# Getting the index from the bit mapping
quantum_circuit.add_result_type(
result_types.Probability([qiskit_gates[1][0].index])
result_types.Probability(
target=[
circuit.find_bit(qiskit_gates[1][0]).index,
circuit.find_bit(qiskit_gates[2][0]).index,
]
)
)
elif name == "barrier":
# This does not exist
Expand All @@ -335,7 +342,9 @@ def convert_qiskit_to_braket_circuit(circuit: QuantumCircuit) -> Circuit:

for gate in qiskit_gate_names_to_braket_gates[name](*params):
instruction = Instruction(
operator=gate, target=[i.index for i in qiskit_gates[1]]
# Getting the index from the bit mapping
operator=gate,
target=[circuit.find_bit(i).index for i in qiskit_gates[1]],
)
quantum_circuit += instruction
return quantum_circuit
Expand Down

0 comments on commit 440911a

Please sign in to comment.