qiskit-documentation/docs/api/qiskit/qiskit.circuit.library.hidd...

66 lines
2.6 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: hidden_linear_function (latest version)
description: API reference for qiskit.circuit.library.hidden_linear_function in the latest version of qiskit
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.hidden_linear_function
---
<span id="hidden-linear-function" />
# hidden\_linear\_function
<Class id="qiskit.circuit.library.hidden_linear_function" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit/tree/stable/1.3/qiskit/circuit/library/hidden_linear_function.py#L92-L163" signature="qiskit.circuit.library.hidden_linear_function(adjacency_matrix)" modifiers="class">
Bases:
Circuit to solve the hidden linear function problem.
The 2D Hidden Linear Function problem is determined by a 2D adjacency matrix A, where only elements that are nearest-neighbor on a grid have non-zero entries. Each row/column corresponds to one binary variable $x_i$.
The hidden linear function problem is as follows:
Consider the quadratic form
$$
q(x) = \sum_{i,j=1}^{n}{x_i x_j} ~(\mathrm{mod}~ 4)
$$
and restrict $q(x)$ onto the nullspace of A. This results in a linear function.
$$
2 \sum_{i=1}^{n}{z_i x_i} ~(\mathrm{mod}~ 4) \forall x \in \mathrm{Ker}(A)
$$
and the goal is to recover this linear function (equivalently a vector $[z_0, ..., z_{n-1}]$). There can be multiple solutions.
In \[1] it is shown that the present circuit solves this problem on a quantum computer in constant depth, whereas any corresponding solution on a classical computer would require circuits that grow logarithmically with $n$. Thus this circuit is an example of quantum advantage with shallow circuits.
**Reference Circuit:**
```python
from qiskit.circuit.library import hidden_linear_function
A = [[1, 1, 0], [1, 0, 1], [0, 1, 1]]
circuit = hidden_linear_function(A)
circuit.draw('mpl')
```
![Circuit diagram output by the previous code.](/images/api/qiskit/qiskit-circuit-library-hidden_linear_function-1.avif)
**Parameters**
**adjacency\_matrix** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") *| np.ndarray*) a symmetric n-by-n list of 0-1 lists. n will be the number of qubits.
**Raises**
[**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") If A is not symmetric.
**Return type**
[QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")
**Reference:**
\[1] S. Bravyi, D. Gosset, R. Koenig, Quantum Advantage with Shallow Circuits, 2017. [arXiv:1704.00690](https://arxiv.org/abs/1704.00690)
</Class>