braket.experimental.algorithms.quantum_walk.quantum_walk module

braket.experimental.algorithms.quantum_walk.quantum_walk.qft(num_qubits: int, inverse: bool = False) Circuit[source]

Creates the quantum Fourier transform circuit and its inverse.

Parameters:
  • num_qubits (int) – Number of qubits in the circuit

  • inverse (bool) – If true return the inverse of the circuit. Default is False

Returns:

Circuit – Circuit object that implements the quantum Fourier transform or its inverse

braket.experimental.algorithms.quantum_walk.quantum_walk.qft_conditional_add_1(num_qubits: int) Circuit[source]

Creates the quantum circuit that conditionally add +1 or -1 using:

1) The first qubit to control if add 1 or subtract 1: when the first qubit is 0, we add 1 from the number, and when the first qubit is 1, we subtract 1 from the number.

  1. The second register with num_qubits qubits to save the result.

Parameters:

num_qubits (int) – Number of qubits that saves the result.

Returns:

Circuit – Circuit object that implements the circuit that conditionally add +1 or -1.

braket.experimental.algorithms.quantum_walk.quantum_walk.quantum_walk(n_nodes: int, num_steps: int = 1) Circuit[source]

Creates the quantum random walk circuit.

Parameters:
  • n_nodes (int) – The number of nodes in the graph

  • num_steps (int) – The number of steps for the quantum walk. Default is 1

Returns:

Circuit – Circuit object that implements the quantum random walk algorithm

Raises:

If np.log2(n_nodes) is not an integer, a value error will be raised.

braket.experimental.algorithms.quantum_walk.quantum_walk.run_quantum_walk(circ: Circuit, device: Device, shots: int = 1000) Dict[str, Any][source]

Function to run quantum random walk algorithm and return measurement counts.

Parameters:
  • circ (Circuit) – Quantum random walk circuit

  • device (Device) – Braket device backend

  • shots (int) – Number of measurement shots. Default is 1000.

Returns:

Dict[str, Any] – measurements and results from running Quantum Phase Estimation