LinearSystemObservable
class LinearSystemObservable
Bases: abc.ABC
An abstract class for linear system observables in Qiskit.
Methods
evaluate_classically
abstract LinearSystemObservable.evaluate_classically(solution)
Calculates the analytical value of the given observable from the solution vector to the
linear system.
Parameters
solution (Union
[array
, QuantumCircuit
]) – The solution to the system as a numpy array or the circuit that prepares it.
Return type
float
Returns
The value of the observable.
observable
abstract LinearSystemObservable.observable(num_qubits)
The observable operator.
Parameters
num_qubits (int
) – The number of qubits on which the observable will be applied.
Return type
Union
[TensoredOp
, List
[TensoredOp
]]
Returns
The observable as a sum of Pauli strings.
observable_circuit
abstract LinearSystemObservable.observable_circuit(num_qubits)
The circuit implementing the observable.
Parameters
num_qubits (int
) – The number of qubits on which the observable will be applied.
Return type
Union
[QuantumCircuit
, List
[QuantumCircuit
]]
Returns
The observable as a QuantumCircuit.
post_processing
abstract LinearSystemObservable.post_processing(solution, num_qubits, scaling=1)
Evaluates the given observable on the solution to the linear system.
Parameters
- solution (
Union
[float
,List
[float
]]) – The probability calculated from the circuit and the observable. - num_qubits (
int
) – The number of qubits where the observable was applied. - scaling (
float
) – Scaling of the solution.
Return type
float
Returns
The value of the observable.