Clifford2017Backend

The Clifford2017Backend is a sampling backend that is able to compute random output states according to the exact output distribution without computing it, by computing sub-permanents of chosen matrices and computing sampling weights from them, adding the photons one by one. The algorithm is introduced in Clifford and Clifford [18].

This backend has the advantage of being able to handle more modes and photons than the strong simulation backends, and does not need to represent the whole output space, so it is much more memory efficient, at the cost of only being able to approximate the resulting distribution.

This backend is available in Processor by using the name "CliffordClifford2017".

>>> import perceval as pcvl
>>> c = pcvl.BS()
>>> backend = pcvl.Clifford2017Backend()
>>> backend.set_circuit(c)
>>> backend.set_input_state(pcvl.BasicState([1, 0]))
>>> print(backend.samples(10))  # Results may vary
[ |1,0>, |0,1>, |0,1>, |0,1>, |1,0>, |0,1>, |1,0>, |0,1>, |0,1>, |0,1> ]
class perceval.backends._clifford2017.Clifford2017Backend
property name: str

Returns the back-end name as a string

sample()

Request one sample from the circuit given an input state

samples(count)

Request count samples from the circuit given an input state. Uses parallel processing, so it is much more efficient than calling self.sample() several times.

set_circuit(circuit)

Sets the circuit to simulate. This circuit must not contain polarized components (use PolarizationSimulator instead, if required).

set_input_state(input_state)

Sets an input state for the simulation. This state has to be a Fock state without annotations.