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
, 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
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
of the frame :where
are called the frame coefficients of the Hermitian operator .- 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,
.Each outcome
is associated with an effect of the POVM. The probability of obtaining the outcome when measuring a staterho
is given by .Note
In the frame theory formalism, the mapping
is referred to as the analysis operator, which is implemented by theanalysis()
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
inwhere
is theobservable
and are the effects of the POVM of whichself
is the dual. The closed form for computing iswhere
make of this dual frame (i.e.self
).Note
In the frame theory formalism, the mapping
is referred to as the analysis operator, which is implemented by theanalysis()
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’)