ProductPOVM¶
- class ProductPOVM(frames)¶
Bases:
ProductFrame
[MultiQubitPOVM
],BasePOVM
Class to represent a set of product POVM operators.
A product POVM \(M\) is made of local POVMs \(M1, M2, ...\) acting on respective subsystems. Each global effect can be written as the tensor product of local effects, \(M_{k_1, k_2, ...} = M1_{k_1} \otimes M2_{k_2} \otimes \cdots\).
Below is an example of how to construct an instance of this class.
>>> from qiskit.quantum_info import Operator >>> from povm_toolbox.quantum_info import SingleQubitPOVM, MultiQubitPOVM, ProductPOVM >>> sqp = SingleQubitPOVM([Operator.from_label("0"), Operator.from_label("1")]) >>> mqp = MultiQubitPOVM( ... [ ... Operator.from_label("00"), ... Operator.from_label("01"), ... Operator.from_label("10"), ... Operator.from_label("11"), ... ] ... ) >>> product = ProductPOVM({(0,): sqp, (1, 3): mqp, (2,): sqp})
Note
For most cases, you may find that
ProductPOVM.from_list()
works just fine and is easier to use.Initialize from a mapping of local frames.
- Parameters:
frames (dict[tuple[int, ...], T]) – a dictionary mapping from a tuple of subsystem indices to a local frame objects.
- Raises:
ValueError – if any key in
frames
is not a tuple consisting of unique integers. In other words, every local frame must act on a distinct set of subsystem indices which do not overlap with each other.ValueError – if any key in
frames
re-uses a previously used subsystem index. In other words, all local frames must act on mutually exclusive subsystem indices.ValueError – if any key in
frames
does not specify the number of subsystem indices, which matches the number of systems acted upon by that local frame (MultiQubitFrame.num_subsystems()
).
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
\()\).
- shape¶
Give the shape of the product frame.
- sub_systems¶
Give the number of operators per sub-system.
Methods
- draw_bloch(*, title='', figure=None, axes=None, figsize=None, font_size=None, colorbar=False)¶
Plot a Bloch sphere for each single-qubit POVM forming the product POVM.
- 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) – size of each individual Bloch sphere figure, in inches.
font_size (float | None) – Font size for the Bloch ball figures.
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.
- Raises:
NotImplementedError – if this product POVM contains a
MultiQubitPOVM
acting on more than a single qubit.- Return type:
Figure
Inherited Methods
- analysis(hermitian_op, frame_op_idx=None)¶
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:
- 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_list(frames)¶
Construct a
ProductFrame
from a list ofMultiQubitFrame
objects.This is a convenience method to simplify the construction of a
ProductFrame
for the cases in which the local frame objects act on a sequential order of subsystems. In other words, this method converts the sequence of frames to a dictionary of frames in accordance with the input toProductFrame.__init__()
by using the positions along the sequence as subsystem indices.Below are some examples:
>>> from qiskit.quantum_info import Operator >>> from povm_toolbox.quantum_info import SingleQubitPOVM, MultiQubitPOVM, ProductPOVM
>>> sqp = SingleQubitPOVM([Operator.from_label("0"), Operator.from_label("1")]) >>> product = ProductPOVM.from_list([sqp, sqp]) >>> # is equivalent to >>> product = ProductPOVM({(0,): sqp, (1,): sqp})
>>> mqp = MultiQubitPOVM( ... [ ... Operator.from_label("00"), ... Operator.from_label("01"), ... Operator.from_label("10"), ... Operator.from_label("11"), ... ] ... ) >>> product = ProductPOVM.from_list([mqp, mqp]) >>> # is equivalent to >>> product = ProductPOVM({(0, 1): mqp, (2, 3): mqp})
>>> product = ProductPOVM.from_list([sqp, sqp, mqp]) >>> # is equivalent to >>> product = ProductPOVM({(0,): sqp, (1,): sqp, (2, 3): mqp})
>>> product = ProductPOVM.from_list([sqp, mqp, sqp]) >>> # is equivalent to >>> product = ProductPOVM({(0,): sqp, (1, 2): mqp, (3,): sqp})
- Parameters:
frames (Sequence[T]) – a sequence of
MultiQubitFrame
objects.- Returns:
A new
ProductFrame
instance.- Return type:
Self
- get_operator(frame_op_idx)¶
Return a product frame operator in a product form.
- Parameters:
frame_op_idx (tuple[int, ...]) – the label specifying the frame operator to get. The frame operator is labeled by a tuple of integers (one index per local frame).
- Returns:
The product frame operator specified by
frame_op_idx
. The operator is returned in a product form. More specifically, is it a dictionary mapping the subsystems to the corresponding local frame operators forming the product frame operator.- Return type:
- get_prob(rho, outcome_idx=None)¶
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: