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

41 lines
1.9 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: LinearSolver
description: API reference for qiskit.algorithms.linear_solvers.LinearSolver
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.algorithms.linear_solvers.LinearSolver
---
# LinearSolver
<Class id="qiskit.algorithms.linear_solvers.LinearSolver" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.20/qiskit/algorithms/linear_solvers/linear_solver.py" signature="LinearSolver" modifiers="class">
Bases: `abc.ABC`
An abstract class for linear system solvers in Qiskit.
## Methods
### solve
<Function id="qiskit.algorithms.linear_solvers.LinearSolver.solve" signature="LinearSolver.solve(matrix, vector, observable=None, observable_circuit=None, post_processing=None)" modifiers="abstract">
Solve the system and compute the observable(s)
**Parameters**
* **matrix** (`Union`\[`ndarray`, `QuantumCircuit`]) The matrix specifying the system, i.e. A in Ax=b.
* **vector** (`Union`\[`ndarray`, `QuantumCircuit`]) The vector specifying the right hand side of the equation in Ax=b.
* **observable** (`Union`\[`LinearSystemObservable`, `BaseOperator`, `List`\[`LinearSystemObservable`], `List`\[`BaseOperator`], `None`]) Optional information to be extracted from the solution. Default is the probability of success of the algorithm.
* **observable\_circuit** (`Union`\[`QuantumCircuit`, `List`\[`QuantumCircuit`], `None`]) Optional circuit to be applied to the solution to extract information. Default is `None`.
* **post\_processing** (`Optional`\[`Callable`\[\[`Union`\[`float`, `List`\[`float`]]], `Union`\[`float`, `List`\[`float`]]]]) Optional function to compute the value of the observable. Default is the raw value of measuring the observable.
**Return type**
`LinearSolverResult`
**Returns**
The result of the linear system.
</Function>
</Class>