Other averaging protocols

Here, we detail additional shot-based protocols available in InQuanto.

ProjectiveMeasurements

A state \(|\Psi\rangle\) prepared on a digital quantum computer may be written as a linear combination of computational basis states:

(58)\[|\Psi\rangle = \sum_i c_i |i\rangle\]

where \(i\) is a bit string. For example, a 2-qubit state is given by:

(59)\[|\Psi\rangle = c_{00}|00\rangle + c_{10}|10\rangle + c_{01}|01\rangle + c_{11}|11\rangle.\]

The ProjectiveMeasurements protocol measures the magnitude squared of the expansion coefficients, \(|c_i|^2\), by preparing the state and measuring the register in the Z basis. The probability of measuring the bitstring \(i\) is precisely \(|c_i|^2\). See below for a simple example:

from pytket.extensions.qiskit import AerBackend
from inquanto.express import get_system
from inquanto.ansatzes import FermionSpaceAnsatzUCCSD
from inquanto.protocols import ProjectiveMeasurements

_, space, state = get_system("h2_sto3g.h5")

ansatz = FermionSpaceAnsatzUCCSD(space, state)
params = ansatz.state_symbols.construct_random()

protocol = ProjectiveMeasurements(
    backend=AerBackend(),
    shots_per_circuit=1000,
)
protocol.build(params, ansatz).run(seed=0)

print(protocol.get_dataframe_basis_states(4))
  Basis State  Probability  Uncertainty  Count
0        0110        0.600     0.015492    600
1        0011        0.224     0.013184    224
2        1100        0.164     0.011709    164
3        1001        0.012     0.003443     12