Skip to content

Commit

Permalink
rename get state vector for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRenaud committed May 21, 2024
1 parent 38b65bd commit fc6a700
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions qiskit_tomography_toolbox/base_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BaseTomography(ABC):
"""Abstract base class for the tomography."""

@abstractmethod
def get_statevector(self, parameters: np.ndarray) -> np.ndarray:
def get_state_vector(self, parameters: np.ndarray) -> np.ndarray:
"""Get the statevector of the circuit
Args:
Expand All @@ -15,7 +15,7 @@ def get_statevector(self, parameters: np.ndarray) -> np.ndarray:
Returns:
np.ndarray: state vector
"""
raise NotImplementedError("Implmenent a get_statevector method")
raise NotImplementedError("Implmenent a get_state_vector method")

@abstractmethod
def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray:
Expand Down
4 changes: 2 additions & 2 deletions qiskit_tomography_toolbox/htree_qst.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def get_relative_amplitude_sign(self, parameters: np.ndarray) -> np.ndarray:
weights = self.get_weight(samples)
return self.get_signs(weights)

def get_statevector(self, parameters: np.ndarray) -> np.ndarray:
def get_state_vector(self, parameters: np.ndarray) -> np.ndarray:
"""Get the statevector of the circuit
Args:
Expand All @@ -236,5 +236,5 @@ def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray:
Returns:
np.ndarray: density matrix
"""
vector = self.get_statevector(parameters)
vector = self.get_state_vector(parameters)
return np.outer(vector, vector)
2 changes: 1 addition & 1 deletion qiskit_tomography_toolbox/qst.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_density_matrix(self, parameters: np.ndarray):
qstdata1 = qstexp1.run(self.backend, shots=self.shots).block_for_results()
return qstdata1.analysis_results("state").value.data.real

def get_statevector(self, parameters: np.ndarray) -> np.ndarray:
def get_state_vector(self, parameters: np.ndarray) -> np.ndarray:
"""Get the statevector.
Args:
Expand Down
2 changes: 1 addition & 1 deletion qiskit_tomography_toolbox/shadow_qst.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def get_amplitudes(self, parameters: np.ndarray) -> np.ndarray:
samples.append(proba)
return np.sqrt(samples[0])

def get_statevector(
def get_state_vector(
self,
parameters: np.ndarray,
samples: Optional[Union[List, None]] = None,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_tomography_toolbox/simulator_qst.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_relative_amplitude_sign(self, parameters: np.ndarray):
).data.real
return np.sign(state_vector)

def get_statevector(
def get_state_vector(
self, parameters: np.ndarray, **kwargs
): # pylint: disable=unused-argument
"""Get the state vector of the circuit.
Expand All @@ -49,5 +49,5 @@ def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray:
Returns:
np.ndarray: density matrix
"""
vector = self.get_statevector(parameters)
vector = self.get_state_vector(parameters)
return np.outer(vector, vector)

0 comments on commit fc6a700

Please sign in to comment.