Skip to content

Commit

Permalink
Update docstring to define Paulivector
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryoris committed Aug 15, 2023
1 parent cfbba46 commit bdfd094
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions qiskit/visualization/state_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,17 @@ def plot_state_city(
def plot_state_paulivec(
state, title="", figsize=None, color=None, ax=None, *, rho=None, filename=None
):
r"""Plot the paulivec representation of a quantum state.
r"""Plot the Pauli-vector representation of a quantum state as bar graph.
Plot a bargraph of the density matrix of a quantum state using as a basis all
possible tensor products of Pauli operators and identities, that is,
:math:`\{\bigotimes_{i=0}^{N-1}P_i\}_{P_i\in \{I,X,Y,Z\}}`, where
:math:`N` is the number of qubits.
The Pauli-vector of a density matrix :math:`\rho` is defined by the expectation of each
possible tensor product of single-qubit Pauli operators (including the identity), that is
.. math ::
\rho = \frac{1}{2^n} \sum_{\sigma \in \{I, X, Y, Z\}^{\otimes n}}
\mathrm{Tr}(\sigma \rho) \sigma.
This function plots the coefficients :math:`\mathrm{Tr}(\sigma\rho)` as bar graph.
Args:
state (Statevector or DensityMatrix or ndarray): an N-qubit quantum state.
Expand Down

0 comments on commit bdfd094

Please sign in to comment.