qiskit-documentation/docs/api/qiskit/0.37/qiskit.algorithms.linear_so...

95 lines
3.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: LinearSystemObservable
description: API reference for qiskit.algorithms.linear_solvers.LinearSystemObservable
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.algorithms.linear_solvers.LinearSystemObservable
---
# LinearSystemObservable
<Class id="qiskit.algorithms.linear_solvers.LinearSystemObservable" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.21/qiskit/algorithms/linear_solvers/observables/linear_system_observable.py" signature="LinearSystemObservable" modifiers="class">
Bases: `abc.ABC`
An abstract class for linear system observables in Qiskit.
## Methods
### evaluate\_classically
<Function id="qiskit.algorithms.linear_solvers.LinearSystemObservable.evaluate_classically" signature="LinearSystemObservable.evaluate_classically(solution)" modifiers="abstract">
#### Calculates the analytical value of the given observable from the solution vector to the
linear system.
**Parameters**
**solution** (`Union`\[`array`, [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.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.
</Function>
### observable
<Function id="qiskit.algorithms.linear_solvers.LinearSystemObservable.observable" signature="LinearSystemObservable.observable(num_qubits)" modifiers="abstract">
The observable operator.
**Parameters**
**num\_qubits** (`int`) The number of qubits on which the observable will be applied.
**Return type**
`Union`\[[`TensoredOp`](qiskit.opflow.list_ops.TensoredOp "qiskit.opflow.list_ops.tensored_op.TensoredOp"), `List`\[[`TensoredOp`](qiskit.opflow.list_ops.TensoredOp "qiskit.opflow.list_ops.tensored_op.TensoredOp")]]
**Returns**
The observable as a sum of Pauli strings.
</Function>
### observable\_circuit
<Function id="qiskit.algorithms.linear_solvers.LinearSystemObservable.observable_circuit" signature="LinearSystemObservable.observable_circuit(num_qubits)" modifiers="abstract">
The circuit implementing the observable.
**Parameters**
**num\_qubits** (`int`) The number of qubits on which the observable will be applied.
**Return type**
`Union`\[[`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit"), `List`\[[`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")]]
**Returns**
The observable as a QuantumCircuit.
</Function>
### post\_processing
<Function id="qiskit.algorithms.linear_solvers.LinearSystemObservable.post_processing" signature="LinearSystemObservable.post_processing(solution, num_qubits, scaling=1)" modifiers="abstract">
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.
</Function>
</Class>