Skip to content

Commit

Permalink
shorterned max line length
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirmay authored Apr 11, 2024
1 parent 2754345 commit 50c4abf
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions qiskit/circuit/library/data_preparation/state_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ def _multiplex(self, target_gate, list_of_angles, last_cnot=True):

class Generalized_Uniform_Superposition_Gate(Gate):
"""
Class that implements a generalized uniform superposition state, using n qubits, following the Shukla-Vedula algorithm [SV24].
Class that implements a generalized uniform superposition state, using n qubits,
following the Shukla-Vedula algorithm [SV24].
"""

def __init__(
Expand All @@ -456,29 +457,35 @@ def __init__(
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} $, 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.
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:
A quantum circuit that creates the uniform superposition state: $\frac{1}{\sqrt{M}} \sum_{j=0}^{M-1} \ket{j} $.
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).
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).
Raises:
QiskitError: ``num_qubits`` parameter used when ``params`` is not an integer
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.
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.
"""
if not (isinstance(M, int) and (M > 1)):
raise ValueError("M must be a positive integer greater than 1.")
Expand Down

0 comments on commit 50c4abf

Please sign in to comment.