mimiqcircuits.operations.gates.generalized.phasegradient

Phase gradient gate.

Classes

PhaseGradient(*args)

Phase gradient gate on num_qubits qubits.

class PhaseGradient(*args)[source]

Bases: Gate

Phase gradient gate on num_qubits qubits.

Each computational basis state \(|k\rangle\) gets a phase proportional to its integer value \(k\), with the first qubit as the most significant bit:

\[\operatorname{PhaseGradient} = \sum_{k=0}^{2^n-1} \mathrm{e}^{i \frac{2 \pi}{2^n} k} |k\rangle\langle k|\]

The gate decomposes into one GateP per qubit. PhaseGradient() with no arguments returns a lazy expression that takes the number of qubits later. The gate has no matrix representation: matrix() raises NotImplementedError.

Parameters:

num_qubits (int) – Number of qubits.

Raises:

ValueError – If more than one argument is given.

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(PhaseGradient(2), 9, 8)
10-qubit circuit with 1 instruction:
└── PhaseGradient @ q[9,8]

>>> PhaseGradient(3).decompose()
3-qubit circuit with 3 instructions:
├── P((1/4)*pi) @ q[2]
├── P((1/2)*pi) @ q[1]
└── P(pi) @ q[0]