How to exactly compute observable of 1 qubit in Braket TN1 and don't measure the rest?

2

I am aware that exact simulation (on the local simulator) to get the state vector can be done by setting shots=0. However, TN1 only allows shots range of [1, 1000]. I tried to reduce the computation cost of my QFT circuit by doing

qft = make_qft_circuit(10)
qft.expectation(observable=Observable.Z(), target=0)
result = device.run(qc, shots=100).result()

However, upon checking the result, I found that all the 10 qubits are being measured, with the counts stats, whereas I only need the expectation of the Pauli Z on the 0th qubit. Is there a way to prevent the wasteful computation of the remainder 9 qubits (since this is tensor network simulation after all)? Even better if it is possible to do an exact simulation along the line of shots=0 for the statevector.

rht
asked a year ago310 views
1 Answer
2
Accepted Answer

For the first question, despite all the qubits are measured, we can extract the expectation value for a subset of qubits via result.values. Suppose we want to measure the expectation of the Pauli Z on the 0th qubit, then we can do the following [In the given example, qc is not defined, and I changed that]

qc = make_qft_circuit(10)
qc.expectation(observable=Observable.Z(), target=0)
result = device.run(qc, shots=100).result()
Z_0 = result.values[0] # This is the expectation value desired.

For the second question, no, TN1 does not support shots=0 result type.

AWS
Mao Lin
answered a year ago
  • Thank you for the answer. Yes, I am aware that I can extract the expectation value, but I want to prevent the wasteful measurement of all of the qubits.

    For the second question, no, TN1 does not support shots=0 result type.

    Does that mean it is impossible to get exact computation from TN1?

  • No, we currently don't have a way to measure only a subset of qubits, or do shots=0. Because we have to sample the result at the end of the computation for TN1, yes, there will always be shot noise in the sampled result.

  • OK, thank you for the clarification!

  • @rht, we would love to hear more about your use case and understand better how measuring subsets of qubits or shots=0 would help you. Would you be open to share some details here or, if you prefer, via email at braket-feedback@amazon.com?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions