qiskit-documentation/docs/api/qiskit/0.32/qiskit.circuit.library.Hidd...

161 lines
5.2 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: HiddenLinearFunction
description: API reference for qiskit.circuit.library.HiddenLinearFunction
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.HiddenLinearFunction
---
# HiddenLinearFunction
<Class id="qiskit.circuit.library.HiddenLinearFunction" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/circuit/library/hidden_linear_function.py" signature="HiddenLinearFunction(adjacency_matrix)" modifiers="class">
Bases: `qiskit.circuit.quantumcircuit.QuantumCircuit`
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:**
>
**Reference:**
\[1] S. Bravyi, D. Gosset, R. Koenig, Quantum Advantage with Shallow Circuits, 2017. [arXiv:1704.00690](https://arxiv.org/abs/1704.00690)
Create new HLF circuit.
**Parameters**
**adjacency\_matrix** (`Union`\[`List`\[`List`\[`int`]], `ndarray`]) a symmetric n-by-n list of 0-1 lists. n will be the number of qubits.
**Raises**
**CircuitError** If A is not symmetric.
## Attributes
### ancillas
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.ancillas">
Returns a list of ancilla bits in the order that the registers were added.
</Attribute>
### calibrations
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.calibrations">
Return calibration dictionary.
**The custom pulse definition of a given gate is of the form**
\{gate\_name: \{(qubits, params): schedule}}
</Attribute>
### clbits
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.clbits">
Returns a list of classical bits in the order that the registers were added.
</Attribute>
### data
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.data">
Return the circuit data (instructions and context).
**Returns**
a list-like object containing the tuples for the circuits data.
Each tuple is in the format `(instruction, qargs, cargs)`, where instruction is an Instruction (or subclass) object, qargs is a list of Qubit objects, and cargs is a list of Clbit objects.
**Return type**
QuantumCircuitData
</Attribute>
### extension\_lib
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.extension_lib" attributeValue="'include &#x22;qelib1.inc&#x22;;'" />
### global\_phase
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.global_phase">
Return the global phase of the circuit in radians.
</Attribute>
### header
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.header" attributeValue="'OPENQASM 2.0;'" />
### instances
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.instances" attributeValue="16" />
### metadata
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.metadata">
The user provided metadata associated with the circuit
The metadata for the circuit is a user provided `dict` of metadata for the circuit. It will not be used to influence the execution or operation of the circuit, but it is expected to be passed between all transforms of the circuit (ie transpilation) and that providers will associate any circuit metadata with the results it returns from execution of that circuit.
</Attribute>
### num\_ancillas
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.num_ancillas">
Return the number of ancilla qubits.
</Attribute>
### num\_clbits
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.num_clbits">
Return number of classical bits.
</Attribute>
### num\_parameters
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.num_parameters">
Convenience function to get the number of parameter objects in the circuit.
</Attribute>
### num\_qubits
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.num_qubits">
Return number of qubits.
</Attribute>
### parameters
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.parameters">
Convenience function to get the parameters defined in the parameter table.
</Attribute>
### prefix
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.prefix" attributeValue="'circuit'" />
### qubits
<Attribute id="qiskit.circuit.library.HiddenLinearFunction.qubits">
Returns a list of quantum bits in the order that the registers were added.
</Attribute>
</Class>