Interfaces¶
The base interfaces for the quantum-informational frame, POVM, and Dual classes.
- class BaseFrame[source]¶
Abstract base class that contains all methods that any specific frame should implement.
A frame is a generalization of the notion of the basis of a vector space to sets that may not necessarily be linearly independent. Consider a Hilbert space of finite dimension \(d\), then the set of Hermitian operators is an operator-valued vector space on the Hilbert space. Therefore, a set of Hermitian operators that spans the entire Hilbert space is said to be a frame.
If a set of operators does not span the entire Hilbert space, it can still be considered as a frame on the subspace it spans.
- abstract property dimension: int¶
The dimension of the Hilbert space on which the frame operators act.
- property num_subsystems: int¶
The number of subsystems which the frame operators act on.
For qubits, this is always \(\log_2(\)
dimension
\()\).
- abstract analysis(hermitian_op: SparsePauliOp | Operator, frame_op_idx: LabelT | set[LabelT] | None = None) float | dict[LabelT, float] | ndarray [source]¶
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 (LabelT | set[LabelT] | 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:
- class BasePOVM[source]¶
Abstract base class that contains all methods that any specific POVM should implement.
- get_prob(rho: SparsePauliOp | DensityMatrix | Statevector, outcome_idx: LabelT | set[LabelT] | None = None) float | dict[LabelT, float] | ndarray [source]¶
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:
- class BaseDual[source]¶
Abstract base class that contains all methods that any specific Dual should implement.
- get_omegas(observable: SparsePauliOp | Operator, outcome_idx: LabelT | set[LabelT] | None = None) float | dict[LabelT, float] | ndarray [source]¶
Return the decomposition weights of the provided observable.
Computes the \(\omega_k\) in
\[\mathcal{O} = \sum_{k=1}^n \omega_k M_k\]where \(\mathcal{O}\) is the
observable
and \(M_k\) are the effects of the POVM of whichself
is the dual. The closed form for computing \(\omega_k\) is\[\omega_k = \text{Tr}\left[\mathcal{O} D_k\right]\]where \(D_k\) make of this dual frame (i.e.
self
).Note
In the frame theory formalism, the mapping \(A: \mathcal{O} \mapsto \{\text{Tr}\left[\mathcal{O} D_k\right]\}_k\) is referred to as the analysis operator, which is implemented by the
analysis()
method.- Parameters:
observable (SparsePauliOp | Operator) – the observable for which to compute the decomposition weights.
outcome_idx (LabelT | set[LabelT] | None) – label or set of labels indicating which decomposition weights are queried. If
None
, all weights are queried.
- Returns:
Decomposition weight(s) associated to the effect(s) specified by
outcome_idx
. If a specific outcome was queried, afloat
is returned. If a specific set of outcomes was queried, a dictionary mapping outcome labels to weights is returned. If all outcomes were queried, an array with all weights is returned.- Return type:
- class LabelT¶
Each operator in the frame is identified by a label.
This is the type of these labels. For instance, labels could be strings, integers, or it could be tuples of integers among other possibilities.
alias of TypeVar(‘LabelT’)