mimiqcircuits.operations.gates.generalized.polynomialoracle¶
Polynomial Oracle gate.
Classes
|
Quantum oracle for a polynomial of two registers. |
- class PolynomialOracle(*args)[source]¶
Bases:
GateQuantum oracle for a polynomial of two registers.
Applies a \(\pi\) phase to every basis state \(|x\rangle|y\rangle\) with \(a xy + b x + c y + d = 0\), where \(x\) and \(y\) are the integer values of the two registers. Each register is little-endian: its first qubit is the least significant bit. The gate is its own inverse.
PolynomialOracle(a, b, c, d)with four arguments returns a lazy expression that takes the two register sizes later.The oracle has no matrix representation. It decomposes into one multi-controlled Z per solution, so the decomposition is only practical when there are few solutions. A decomposition without solutions is a single
GateIDon the last qubit, which keeps the oracle’s width.- Parameters:
- Raises:
ValueError – If a coefficient is not an integer, or the number of arguments is neither 4 nor 6.
Examples
>>> from mimiqcircuits import * >>> c = Circuit() >>> c.push(PolynomialOracle(5, 5, 1, 2, 3, 4), *range(1, 11)) 11-qubit circuit with 1 instruction: └── PolynomialOracle(1, 2, 3, 4) @ q[1:5], q[6:10] >>> # lazy form: the register sizes are given later >>> PolynomialOracle(1, 2, 3, 4)(5, 5) PolynomialOracle(1, 2, 3, 4)