concept Hadamard gate in category quantum computing

appears as: Hadamard gate, Hadamard gates, Hadamard gates
Quantum Computing for Developers: A Java-based introduction

This is an excerpt from Manning's book Quantum Computing for Developers: A Java-based introduction.

Note that we introduced another gate here, the Hadamard gate represented by the H class. We will cover this gate in the next chapter, and only used it here to show that it is not allowed to have two gates operating on the same qubit in a single step.

Figure 4.1. From superposition to the Hadamard gate.
ch4 mindpic

4.5  Java code using the Hadamard gate

You are now going to use the Hadamard gate to create a random number generator. This is already a useful application, as random numbers are very useful in cryptography.

You learned the theory about the Hadamard gate, now it is time to use it in quantum applications.

Similar to how you created a quantum application with a Pauli-X gate in the previous chapter, you will now create a simple quantum application with a Hadamard gate. The code for this sample can be found in our samples, under ch04/hadamard. This sample contains 2 parts. In the first part, you only run the application once. The relevant code for this part is shown below:

Listing 1.1. first code snippet using a Hadamard gate.
public static void singleExecution(String[] args) {
        QuantumExecutionEnvironment simulator = new SimpleQuantumExecutionEnvironment();
        Program program = new Program(1);
        Step step = new Step();                               #1
        step.addGate(new Hadamard(0));                        #2
        program.addStep(step);
        Result result = simulator.runProgram(program);        #3
        Qubit[] qubits = result.getQubits();
        Qubit zero = qubits[0];
        int value = zero.measure();                           #4
        System.out.println("Value = "+value);
    }