expectation_value
- SimulationResult.expectation_value(operator, shot='avg', t_idx='all', basis='product', frame='rotating', in_qubit_subspace=True, source=None)
Return the expectation values of a given operator or operators.
- Parameters:
operator (
Operator|ndarray|Array|str|List[Operator|ndarray|Array|str]) –Operator, square matrix, Pauli string, or list of these. Strings may includeI,X,Y,Z(qubit subspace),x,y,z,1,Msymbols (full Hilbert space).shot (
str|int|List[int]) – Specify the shot by its index or indices, or use'avg'.t_idx (
str|int|List[int]) – Specify the time by its index or indices, or use'all'.basis (
str) – Specify the basis, must be either'product'or'eigen'.frame (
str) – Specify the frame, must be either'lab'or'rotating'.source (
str|None) – Explicit expectation-value source forwarded toplot_expectation_value().in_qubit_subspace (
bool) – IfTruethe state is projected to the qubit subspace. Ignored when any operator string contains1orM.source – Explicit expectation-value source. Must be
'state'or'density_matrix'when bothtime_evol_stateandtime_evol_density_matrixare present.
- Return type:
- Returns:
Expectation values for shots and time points. Array of shape (n_shots, n_times, n_operators).
- Raises:
SimphonyError – If the initial state is undefined.
Note
X,YandZdenote the Pauli operators in the qubit subspace.x,yandzdenote the full-spin operators \(S_x\), \(S_y\) and \(S_z\).Idenotes the qubit-subspace identity while1denotes the full-spin identity.Mdenotes the full-spin \(S_z^2\) operator (corresponding to the photoluminescence signal for the NV center).