Skip to content

Commit

Permalink
Put description and arguments in init
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirmay authored Apr 9, 2024
1 parent f32f01d commit 448bb58
Showing 1 changed file with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions qiskit/circuit/library/data_preparation/state_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,30 +443,7 @@ def _multiplex(self, target_gate, list_of_angles, last_cnot=True):

class Generalized_Uniform_Superposition_Gate(Gate):
"""
Generates a generalized uniform superposition state, $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $ (where 1< M <= 2^n),
using n qubits, following the Shukla-Vedula algorithm [SV24].
Note: The Shukla-Vedula algorithm [SV24] provides an efficient approach for creation of a generalized uniform superposition
state of the form, $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $. It needs only $O(\log_2 (M))$ qubits and $O(\log_2 (M))$
gates, hence providing an exponential improvement, in terms of reduced resources and complexity, compared to alternative methods
in existing literature.
Args:
M (int):
A positive integer M (> 1) representing the number of computational basis states with an amplitude of 1/sqrt(M)
in the uniform superposition state ($\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $). Note that the remaining
(2^n - M) computational basis states have zero amplitudes. Here M need not be an integer power of 2.
num_qubits (int):
A positive integer representing the number of qubits used.
Returns:
cirq.Circuit: A quantum circuit that creates the uniform superposition state: $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $.
References:
[SV24]
A. Shukla and P. Vedula, "An efficient quantum algorithm for preparation of uniform quantum superposition states,"
Quantum Information Processing, 23(38): pp. 1-32 (2024).
Class that implements a generalized uniform superposition state, using n qubits, following the Shukla-Vedula algorithm [SV24].
"""

def __init__(
Expand All @@ -477,10 +454,29 @@ def __init__(
):
"""
Initializes Generalized_Uniform_Superposition_Gate.
Args:
M (int): The number of computational basis states with amplitude 1/sqrt(M).
num_qubits (int): The number of qubits used.
M (int):
A positive integer M (> 1) representing the number of computational basis states with an amplitude of 1/sqrt(M)
in the uniform superposition state ($\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $, where $1< M <= 2^n$). Note that the remaining
(2^n - M) computational basis states have zero amplitudes. Here M need not be an integer power of 2.
num_qubits (int):
A positive integer representing the number of qubits used.
Returns:
cirq.Circuit: A quantum circuit that creates the uniform superposition state: $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $.
**References:**
[SV24]
A. Shukla and P. Vedula, "An efficient quantum algorithm for preparation of uniform quantum superposition states,"
Quantum Information Processing, 23(38): pp. 1-32 (2024).
Note:
The Shukla-Vedula algorithm [SV24] provides an efficient approach for creation of a generalized uniform superposition
state of the form, $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $. It needs only $O(\log_2 (M))$ qubits and $O(\log_2 (M))$
gates, hence providing an exponential improvement, in terms of reduced resources and complexity, compared to alternative methods
in existing literature.
"""
super().__init__("USup", num_qubits, [])
assert (
Expand Down

0 comments on commit 448bb58

Please sign in to comment.