About quantum natural gradient circuit


In the article “Quantum natural gradient”, for three qubits we have two parametrized gates in Parametrized Layer_0,

  1. Is the wire choosen randomly to apply RY operations?

  2. If the input layer has four qubits, then Parametrized Layer_0 must contains totally three qubits each one on wire_1, wire_2 and wire_3?

Your Sincerely

Hi @Franz_Ogur!

Is the wire chosen randomly to apply RY operations?

In a way, yes. Every wire has a parametrized rotation gate applied, but the specific gate is chosen at random from the set \{RX, RY, RZ\}.

The PennyLane code that creates the circuit explored in the paper is:

gates = [
    [np.random.choice([qml.RX, qml.RY, qml.RZ]) for _ in range(depth)] for _ in range(n_qubits)

def Ry_layer():
    for wire in range(n_qubits):
        qml.RY(np.pi / 4, wires=wire)

def parametric_layer(params, layer):
    for wire in range(n_qubits):
        gates[wire][layer](params[wire, layer], wires=wire)

def entangler():
    for wire in range(0, n_qubits - 1, 2):
        qml.CZ(wires=[wire, wire + 1])
    for wire in range(1, n_qubits, 2):
        qml.CZ(wires=[wire, wire + 1])

def circuit(params):
    params = np.reshape(params, (n_qubits, depth))
    for layer in range(depth):
        parametric_layer(params, layer)
    return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))

Hi @josh,

Thank you for your reply.

According to your code below, every wires in every layers has a gate. But in the picture below at ParametrizedLayer_0, I see that RZ gates applied only on wire of 0 and 1. Is there a confliction between code and the picture?

Hi @Franz_Ogur, yes the code doesn’t correspond to the picture.

The code is the same used to create the variational circuit explored in the Quantum Natural Gradient paper.

For the QNG tutorial, I created a simplified version of the circuit (including the gaps you see) just to make it easier to discuss :slightly_smiling_face: