The QuantumSimulator device¶
You can instantiate the device as follows:
import pennylane as qml dev = qml.device('microsoft.QuantumSimulator', wires=2)
The device can then be used just like other devices for the definition and evaluation of QNodes within PennyLane.
A simple quantum function that returns the expectation value of a measurement and depends on three classical input parameters would look like:
@qml.qnode(dev) def circuit(x, y, z): qml.RZ(z, wires=) qml.RY(y, wires=) qml.RX(x, wires=) qml.CNOT(wires=[0, 1]) return qml.expval(qml.PauliZ(wires=1))
You can then execute the circuit like any other function to get the quantum mechanical expectation value.
circuit(0.2, 0.1, 0.3)