Thanks for the detailed response.

On (1.) above you say that the problem comes from the forest.wavefunction simulator continues to use dense matrix multiplication.

- Does the same problem apply to the pyqvm?
- Is this something on the pennylane plugin side or the forest side?

I ask because the pyqvm simulator is usually very fast, whereas the other simulators scale badly.

(ex)

import pennylane as qml

from pennylane import numpy as np

NUM_QUBITS = 12

def circuit(thetas):

for i in range(NUM_QUBITS):

qml.RX(thetas[i], wires=i)

for i in range(NUM_QUBITS - 1):

qml.CNOT(wires=[i, i + 1])

for i in range(NUM_QUBITS):

qml.RX(thetas[i], wires=i)

for i in range(NUM_QUBITS, 2 * NUM_QUBITS):

qml.RY(thetas[i], wires=(i - NUM_QUBITS))

observable = np.zeros((2**NUM_QUBITS, 2**NUM_QUBITS))

wires = list(range(NUM_QUBITS))

# return qml.expval.Hermitian(observable, wires=wires)

return [qml.expval.PauliZ(wires=[i]) for i in range(NUM_QUBITS)]

x = np.random.random([NUM_QUBITS])

devices = [

qml.device(“default.qubit”, wires=NUM_QUBITS),

qml.device(“forest.numpy_wavefunction”, wires=NUM_QUBITS),

qml.device(“forest.wavefunction”, wires=NUM_QUBITS),

qml.device(“forest.qvm”, device="{}q-qvm".format(NUM_QUBITS)),

qml.device(“forest.qvm”, device="{}q-pyqvm".format(NUM_QUBITS)),

]

print(“Encoding size: {}”.format(NUM_QUBITS))

print(“Number of qubits: {}”.format(NUM_QUBITS))

from time import time

for dev in devices:

print("\nDevice: {}".format(dev.name))

qnode = qml.QNode(circuit, dev)

thetas = np.random.random(2 * NUM_QUBITS)

# t0 = time()

# opt = qml.AdamOptimizer(stepsize=0.1)

# thetas = opt.step(qnode, thetas)

# print('Time gradients: ', (time() - t0))

t0 = time()

qnode(thetas)

print('Time cost: ', (time() - t0))

out

Device: Default qubit PennyLane plugin

Time cost: 6.934019327163696

Device: pyQVM NumpyWavefunction Simulator Device

Time cost: 6.896592617034912

Device: Forest Wavefunction Simulator Device

Time cost: 6.934622526168823

Device: Forest QVM Device

Time cost: 14.904531717300415

Device: Forest QVM Device

Time cost: 0.00637364387512207