# qml.templates.subroutines.qmc.make_Q¶

make_Q(A, R)[source]

Calculates the $$\mathcal{Q}$$ matrix that encodes the expectation value according to the probability unitary $$\mathcal{A}$$ and the function-encoding unitary $$\mathcal{R}$$.

Following this paper, the expectation value is encoded as the phase of an eigenvalue of $$\mathcal{Q}$$. This phase can be estimated using quantum phase estimation using the QuantumPhaseEstimation() template. See QuantumMonteCarlo() for more details, which loads make_Q() internally and applies phase estimation.

Parameters
• A (array) – The unitary matrix of $$\mathcal{A}$$ which encodes the probability distribution

• R (array) – The unitary matrix of $$\mathcal{R}$$ which encodes the function

Returns

the $$\mathcal{Q}$$ unitary

Return type

array