Codebook: Steps and Speedups

Ask here about the “Steps and Speedups” Codebook topic from the “Grover’s Algorithm” module.

Hey Catalina,

I’m kinda stuck with he inner circuit code. I know we need to implement the Grover circuit which is superpositioning all the qubits, initializing the auxiliary qubit, applying the Oracle and then applying the Diffusion operator. I did the same but the output says “the circuit doesn’t seem quite right”. I’m not sure where I’m going wrong.
Please help.
Thank you!!

def inner_circuit():
        ##################
        # YOUR CODE HERE #
        ##################
        # IMPLEMENT THE GROVER CIRCUIT

        # Initial superpositioning of the qubits
        hadamard_transform(query_register)

        # Initializing the auxillary qubit
        qml.PauliX(wires=aux)
        qml.Hadamard(wires=aux)

        # Applying the Oracle
        oracle(combo)

        # Applying the Diffusion operator
        diffusion(n_bits)
        
        
        return qml.probs(wires=query_register)

Hey Catalina,

I got it. It struck to me after reading the second problem that we don’t just apply the U.D once, we need to apply it “num_steps” times to get the right amplification of the correct combo.

Anyways, thank you for creating such a wonderful and interactive way of learning quantum computing.

1 Like

I’m glad you could solve it @Krishna_Bhatia !

The Codebook is the work of a lot of people. I’ll forward your Thank you to the team! :heart:

1 Like