2

I'm trying to implement an oracle in Qiskit or Cirq for a function f that maps Z x Z to a group A. The function is defined as f(a, b) = (x^a) * (y^b).

  • a and b are the first two quantum registers, both initialized in a uniform superposition.
  • The oracle function f is stored in a third register.

I‘m a little bit lost when it comes to the implementation details of oracles in qiskit, especially when the oracle incorporates classical mathematical and not just boolean operations.

It‘s part of a quantum algorithm for the DLP. See here: https://youtu.be/c1WRcu6Fy0A?si=5DwS4mL4YbnO7c9v

Any hints or examples would be greatly appreciated!

Ted Met
  • 41
  • 4

1 Answers1

1

Found the answer here:

EDIT:

The oracle is implemented as a double function call to a modular exponentiation function defined in the context of Shor’s factoring algorithm (https://github.com/Classiq/classiq-library/blob/main/algorithms/algebraic/shor/shor_modular_exponentiation.ipynb).

The function takes in the modulus, the base, a value by which the exponentiation is multiplied and the exponent. So, it maps the state like this:

$|power\rangle|x\rangle \rightarrow |power\rangle|x \cdot a ^ {power}\mod n\rangle$

And a double invocation will result in the state:

$|x_1\rangle|x_2\rangle|1\rangle \rightarrow |x_1\rangle|x_2\rangle|x^{x_1} g^{x_2}\rangle$

where $x_1$ and $x_2$ are the powers to find and $x,g$ are known.

Ted Met
  • 41
  • 4