UniformDistribution#
- class UniformDistribution(num_qubits, name='P(X)')[source]#
Bases:
QuantumCircuit
A circuit to encode a discretized uniform distribution in qubit amplitudes.
This simply corresponds to applying Hadamard gates on all qubits.
The probability density function of the discretized uniform distribution on \(N\) values is
\[\mathbb{P}(X = x) = \frac{1}{N}.\]This circuit considers \(N = 2^n\), where \(n =\)
num_qubits
and prepares the state\[\mathcal{P}_X |0\rangle^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{x=0}^{2^n - 1} |x\rangle\]Examples
>>> from qiskit_finance.circuit.library.probability_distributions import UniformDistribution >>> circuit = UniformDistribution(3) >>> circuit.decompose().draw() ┌───┐ q_0: ┤ H ├ ├───┤ q_1: ┤ H ├ ├───┤ q_2: ┤ H ├ └───┘
- Parameters:
Attributes
Methods