qat.linalg.oracles.PhaseOracle
- class qat.linalg.oracles.PhaseOracle(targets, arity, msb_first=True)
Phase oracles simply flips the phase of some computational basis state.
I.e:
\(| i \rangle \mapsto (-1)^{f(i)} | i \rangle\)
where \(f:\{0,1\}^n \rightarrow \{0, 1\}\).
For simplicity \(f\) is specified via the list of states \(i\) such that \(f(i) = 1\).
E.g an oracle flipping the phase of states \(| 100 \rangle\) and \(| 001 \rangle\) , would be constructed using:
PhaseOracle([4, 1])
If not arity is specified, the oracle will have a variable arity and will consider the list of targets as a list of states over the full data register
E.g PhaseOracle([4, 1]) applied on a register of length 4 will flip phases of states: \(|0100\rangle\) and \(|0001\rangle\).
Warning
The emulation of this gate is only supported using the
LinAlg
simulator at this time.- Parameters
targets (list<int>) – a list of target states to flip
arity (int) – the arity of the oracle (i.e the size of the data register).
msb_first (bool, optional) – If set to True, the targets will be flipped using the most-significant-bit first ordering convention. If set to False, assumes least-significant-bit first ordering. Defaults to True.