2
$\begingroup$

Is there a way to do partial Measurement in AWS Braket? Basically, if I have a circuit with $N$ qubits, can I measure only $n$ qubits out of them with the result type "expectation"?

$\endgroup$

1 Answer 1

2
$\begingroup$

EDIT 24/04/16: The Amazon Braket SDK now supports partial measurement via the measure instruction:

from braket.circuits import Circuit
from braket.devices import LocalSimulator

dev = LocalSimulator()
circ = Circuit().h(0).cnot(0, 1).cnot(1, 2).measure([0])
dev.run(circ, shots=1000).result().measurement_counts
Counter({'0': 507, '1': 493})

Physically, there is currently no way to perform a partial measurement (on hardware in particular, all qubits are measured); you'll have to slice out the unwanted qubits if you're using raw measurements directly. As for result types, you can definitely measure the expectation of an observable on only a subset of qubits:

from braket.circuits import Circuit, observables
from braket.devices import LocalSimulator

dev = LocalSimulator()
circ = Circuit().h(0).cnot(0, 1).cnot(1, 2).expectation(observables.Z() @ observables.Z(), [0, 2])
dev.run(circ).result().values
[1.0]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.