qat.lang.algorithms.quantum_counting

qat.lang.algorithms.quantum_counting(oracle, nbits, prepare=True)

Performs a quantum counting on some oracle.

The number of qubits of the resulting routine is \(n+k\) where \(n\) is the arity of oracle and \(k\) is nbits. The routine assumes that the first \(n\) qubits are already prepared and contain the states on which the counting should be performed. The result will be stored in the last \(k\) qubits.

Parameters
  • oracle (Gate) – a quantum gate or routine implementing the oracle

  • nbits (int) – the number of bits to store the result in

  • prepare (optional, bool) – if set to False, omits the preparation of the data register. Defaults to True.

Returns

a routine

Return type

QRoutine