Single qubit measurementsΒΆ

Measurement-based quantum computation (MBQC) is a paradigm of quantum computing where the computation is performed by performing single-qubit measurements on a large entangled state known as a resource state. In MentPy, measurements are represented by the mp.Ment class.

In [1]: m1 = mp.Ment('X')

In [2]: m1.matrix()
array([[0, 1],
       [1, 0]])

The mp.Ment class can be initialized with a string representing a pauli operator, or with an optional angle and a string representing the plane of rotation. The default angle is None which represents a trainable parameter. The default plane of rotation is XY.

In [3]: m2 = mp.Ment(np.pi/2, 'XY')

In [4]: m2.matrix()
array([[0.000000e+00+0.j, 6.123234e-17-1.j],
       [6.123234e-17+1.j, 0.000000e+00+0.j]])

We can get the POVM elements of a measurement with the get_povm() method

In [5]: p0, p1 = m2.get_povm()

In [6]: print(p0)
[[5.000000e-01+0.j  3.061617e-17-0.5j]
 [3.061617e-17+0.5j 5.000000e-01+0.j ]]

In [7]: print(p1)
[[ 5.000000e-01+0.j  -3.061617e-17+0.5j]
 [-3.061617e-17-0.5j  5.000000e-01+0.j ]]

This object will be used as the basic building block for MBQC circuits.