From bdfd0940c694ed40d33f13d7561085f0fa8dc202 Mon Sep 17 00:00:00 2001 From: Julien Gacon Date: Tue, 15 Aug 2023 13:45:34 +0200 Subject: [PATCH] Update docstring to define Paulivector --- qiskit/visualization/state_visualization.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qiskit/visualization/state_visualization.py b/qiskit/visualization/state_visualization.py index d8cc7006ae80..25c6b8f3d2c0 100644 --- a/qiskit/visualization/state_visualization.py +++ b/qiskit/visualization/state_visualization.py @@ -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.