-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from raunakkumarsingh/Sphinx-documentation
Update comments to Sphinx documentation format close #10
- Loading branch information
Showing
15 changed files
with
542 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,58 @@ | ||
"""Converters that convert np.array to statevector objects of other frameworks""" | ||
""" | ||
Converters that convert np.array to statevector objects of other frameworks. | ||
Classes: | ||
BaseConverter: Abstract base class for statevector converters. | ||
QiskitConverter: Converts np.ndarray to Qiskit Statevector. | ||
""" | ||
|
||
import numpy as np | ||
from qiskit.quantum_info.states import Statevector | ||
|
||
|
||
class BaseConverter: | ||
""" | ||
Base class for statevector converters. | ||
""" | ||
|
||
def __init__(self) -> None: | ||
""" | ||
Initializes the BaseConverter. | ||
""" | ||
pass | ||
|
||
def convert(self): | ||
""" | ||
Abstract method to convert statevectors. | ||
This method should be implemented by subclasses. | ||
""" | ||
pass | ||
|
||
|
||
class QiskitConverter(BaseConverter): | ||
""" | ||
Converts np.ndarray to Qiskit Statevector. | ||
Attributes: | ||
sv (np.ndarray): The numpy array representing the statevector. | ||
""" | ||
|
||
def __init__(self, sv: np.ndarray) -> None: | ||
""" | ||
Initializes the QiskitConverter with a statevector. | ||
Args: | ||
sv (np.ndarray): The numpy array representing the statevector. | ||
""" | ||
super().__init__() | ||
self._sv = sv | ||
|
||
def convert(self): | ||
def convert(self) -> Statevector: | ||
""" | ||
Converts the numpy array to a Qiskit Statevector. | ||
Returns: | ||
Statevector: The Qiskit Statevector object. | ||
""" | ||
return Statevector(self._sv) |
Oops, something went wrong.