paraqeet.measurement.unitary_fidelity.UnitaryFidelity#
- class paraqeet.measurement.unitary_fidelity.UnitaryFidelity(propagation, gate, basis_states=None)#
Bases:
NormalizableMeasurement,DifferentiableUnitary fidelity measurement model.
Fidelity measure that compares the propagator with a desired gate by way of L2 norm.
- Parameters:
propagation (Propagation) – Implementation of EOM solver.
gate (Array) – Matrix representation of target gate.
times (Array) – List of times to compare. Should have length 2. More is allowed, but only the first and last are used.
basis_states (Array optional) – List of basis states. If set the ideal and actual gate are applied to these states and their pairwise overlap computed, equivalent to the L2 trace norm. Defaults to [].
- __init__(propagation, gate, basis_states=None)#
- Parameters:
propagation (DifferentiablePropagation)
gate (Array)
basis_states (Array | None)
Methods
__init__(propagation, gate[, basis_states])calculate_normalized_scalar(times)Return the L2 norm of the last time step compared to the ideal gate.
get_value_and_gradient(times)Get the L2 norm and the analytic expression for the gradient.
measure(times)Return measurement in the range [0, 1].
set_ideal_gate(gate)Compute target states for the L2 norm.
- calculate_normalized_scalar(times)#
Return the L2 norm of the last time step compared to the ideal gate.
- Returns:
L2 norm of the last time step compared to the ideal gate.
- Return type:
Array
- Parameters:
times (Array | float)
- get_value_and_gradient(times)#
Get the L2 norm and the analytic expression for the gradient.
- Returns:
Tuple of function value and gradient of shape (n_parameters,).
- Return type:
Tuple[Array Array]
- Parameters:
times (Array)
- measure(times)#
Return measurement in the range [0, 1].
- Parameters:
times (Array)
- Return type:
Array | float
- set_ideal_gate(gate)#
Compute target states for the L2 norm.
- Parameters:
gate (Array) – Target state computation via this gate.