I nee some help to clarify the number operator. I thought that this would give me the number of photons, i.e. an integer. However, if i set shots =1 (to have samples) and compute the expectation value, i get non integers values.
dev = qml.device("strawberryfields.fock", wires=1, cutoff_dim=30,shots=1) @qml.qnode(dev) def quantum_neural_net(var): qml.CoherentState(var,var,wires = 0) return qml.expval(qml.NumberOperator(0))
i would expect samples according to the Poisson(3) distribution and indeed the expectation value is 3 but the individual samples are non integer, like below:
>>> print(quantum_neural_net([np.sqrt(3),0])) 1.596027833083245
How can i do to get integer when sampling (shots =1 )?