Quantum Measurements API
Quantum Measurements
- class graphcalc.quantum.measurements.QuantumMeasurement(operators: Iterable[Sequence[Sequence[complex]] | ndarray], *, dim: int | None = None, validate: bool = True, tol: float = 1e-09)[source]
Bases:
objectFinite quantum measurement represented by measurement operators.
The measurement is stored as a family
(M_a)of operators on a fixed finite-dimensional Hilbert space. The corresponding effects areE_a = M_a^dagger M_a.Conventions
all measurement operators act on the same Hilbert space
the measurement is complete when
sum_a E_a = Iprojective measurements are included as a special case
post-measurement states are normalized conditional states
- param operators:
Measurement operators.
- type operators:
iterable of array-like
- param dim:
Hilbert-space dimension. If omitted, inferred from the operators.
- type dim:
int | None, default=None
- param validate:
Whether to validate the measurement as complete.
- type validate:
bool, default=True
- param tol:
Numerical tolerance used in validation.
- type tol:
float, default=1e-9
- classmethod computational_basis(*, dim: int = 2, tol: float = 1e-09) QuantumMeasurement[source]
Return the computational-basis projective measurement in dimension
dim.
- classmethod from_projectors(projectors: Iterable[Sequence[Sequence[complex]] | ndarray], *, dim: int | None = None, validate: bool = True, tol: float = 1e-09) QuantumMeasurement[source]
Construct a projective measurement from projectors.
Notes
For projective measurements, the measurement operators and effects coincide.
- property num_outcomes: int
Return the number of outcomes.
- property operators: tuple[ndarray, ...]
Return copies of the measurement operators.
- outcome_probabilities(state: QuantumState) ndarray[source]
Return the vector of outcome probabilities.
- outcome_probability(state: QuantumState, outcome: int) float[source]
Return the probability of a specified outcome.
- post_measurement_state(state: QuantumState, outcome: int) QuantumState[source]
Return the normalized post-measurement state conditioned on an outcome.
Notes
If the outcome probability is zero, this function raises
ValueError.