MultiQubitPOVM¶
- class MultiQubitPOVM(list_operators: list[Operator])[source]¶
Bases:
MultiQubitFrame
,BasePOVM
Class that collects all information that any POVM over multiple qubits should specify.
This is a representation of a positive operator-valued measure (POVM). The effects are specified as a list of
Operator
.Below is a simple example showing how you define some 2-qubit POVM:
>>> from qiskit.quantum_info import Operator >>> from povm_toolbox.quantum_info import MultiQubitPOVM >>> povm = MultiQubitPOVM( ... [ ... Operator.from_label("00"), ... Operator.from_label("01"), ... Operator.from_label("10"), ... Operator.from_label("11"), ... ] ... ) >>> print(povm) MultiQubitPOVM(num_qubits=2)<4> at 0x...
Initialize from explicit operators.
- Parameters:
list_operators (list[Operator]) – list that contains the explicit frame operators. The length of the list is the number of operators of the frame.
- Raises:
ValueError – if the frame operators do not have a correct shape. They should all be hermitian and of the same dimension.
Inherited Attributes
- dimension¶
The dimension of the Hilbert space on which the effects act.
- informationally_complete¶
If the frame spans the entire Hilbert space.
- num_operators¶
The number of effects of the frame.
- num_outcomes¶
The number of outcomes of the POVM.
- num_subsystems¶
The number of subsystems which the frame operators act on.
For qubits, this is always \(\log_2(\)
dimension
\()\).
- operators¶
Return the list of frame operators.
- pauli_operators¶
Convert the internal frame operators to Pauli form.
Warning
The conversion to Pauli form can be computationally intensive.
- Returns:
The frame operators in Pauli form. Each frame operator is returned as a dictionary mapping Pauli labels to coefficients.
- Raises:
QiskitError – when the frame operators could not be converted to Pauli form (e.g. when they are not N-qubit operators).
Methods
- draw_bloch(*, title: str = '', figure: Figure | None = None, axes: Axes | list[Axes] | None = None, figsize: tuple[float, float] | None = None, font_size: float | None = None, colorbar: bool = False) Figure [source]¶
Plot the Bloch vector of each effect of the POVM.
Warning
This method is not actually implemented for a generic multi-qubit POVM. However, it is available for single-qubit POVMs (see
SingleQubitPOVM.draw_bloch()
) as well as products of such single-qubit POVMs (seeProductPOVM.draw_bloch()
).- Parameters:
title (str) – A string that represents the plot title.
figure (Figure | None) – User supplied Matplotlib Figure instance for plotting Bloch sphere.
axes (Axes | list[Axes] | None) – User supplied Matplotlib axes to render the bloch sphere.
figsize (tuple[float, float] | None) – Figure size in inches. Has no effect if passing
ax
.font_size (float | None) – Size of font used for Bloch sphere labels.
colorbar (bool) – If
True
, normalize the vectors on the Bloch sphere and add a colormap to keep track of the norm of the vectors. It can help to visualize the vector if they have a small norm.
- Returns:
The resulting figure.
- Return type:
Figure
Inherited Methods
- analysis(hermitian_op: SparsePauliOp | Operator, frame_op_idx: int | set[int] | None = None) float | dict[int, float] | ndarray ¶
Return the frame coefficients of
hermitian_op
.This method implements the analysis operator \(A\) of the frame \(\{F_k\}_k\):
\[A: \mathcal{O} \mapsto \{ \mathrm{Tr}\left[F_k \mathcal{O} \right] \}_k,\]where \(c_k = \mathrm{Tr}\left[F_k \mathcal{O} \right]\) are called the frame coefficients of the Hermitian operator \(\mathcal{O}\).
- Parameters:
hermitian_op (SparsePauliOp | Operator) – a hermitian operator whose frame coefficients to compute.
frame_op_idx (int | set[int] | None) – label or set of labels indicating which coefficients are queried. If
None
, all coefficients are queried.
- Returns:
Frame coefficients, specified by
frame_op_idx
, of the Hermitian operatorhermitian_op
. If a specific coefficient was queried, afloat
is returned. If a specific set of coefficients was queried, a dictionary mapping labels to coefficients is returned. If all coefficients were queried, an array with all coefficients is returned.- Raises:
TypeError – when the provided single or sequence of labels
frame_op_idx
does not have a valid type.ValueError – when the dimension of the provided
hermitian_op
does not match the dimension of the frame operators.
- Return type:
- classmethod from_vectors(frame_vectors: ndarray) Self ¶
Initialize a frame from non-normalized bloch vectors.
The non-normalized Bloch vectors are given by \(|\tilde{\psi}_k \rangle = \sqrt{\gamma_k} |\psi_k \rangle\). The resulting frame operators are \(F_k = \gamma_k |\psi_k \rangle \langle \psi_k |\) where \(\gamma_k\) is the trace of the \(k\)’th frame operator.
- Parameters:
frame_vectors (ndarray) – list of vectors \(|\tilde{\psi_k} \rangle\). The length of the list corresponds to the number of operators of the frame. Each vector is of shape \((\mathrm{dim},)\) where \(\mathrm{dim}\) is the
dimension
of the Hilbert space on which the frame acts.- Returns:
The frame corresponding to the vectors.
- Return type:
Self
- get_prob(rho: SparsePauliOp | DensityMatrix | Statevector, outcome_idx: LabelT | set[LabelT] | None = None) float | dict[LabelT, float] | ndarray ¶
Return the outcome probabilities given a state, \(\rho\).
Each outcome \(k\) is associated with an effect \(M_k\) of the POVM. The probability of obtaining the outcome \(k\) when measuring a state
rho
is given by \(p_k = \text{Tr}\left[M_k \rho\right]\).Note
In the frame theory formalism, the mapping \(A: \rho \mapsto \{\text{Tr}\left[M_k \rho\right]\}_k\) is referred to as the analysis operator, which is implemented by the
analysis()
method.- Parameters:
rho (SparsePauliOp | DensityMatrix | Statevector) – the state for which to compute the outcome probabilities.
outcome_idx (LabelT | set[LabelT] | None) – label or set of labels indicating which outcome probabilities are queried. If
None
, all outcome probabilities are queried.
- Returns:
Probabilities of obtaining the outcome(s) specified by
outcome_idx
over the staterho
. If a specific outcome was queried, afloat
is returned. If a specific set of outcomes was queried, a dictionary mapping outcomes to probabilities is returned. If all outcomes were queried, an array with all probabilities is returned.- Return type: