Note

# Boson Sampling#

[4]:

import numpy as np
import piquasso as pq

with pq.Program() as program:
pq.Q(all) | pq.StateVector([0, 1, 1, 0])

pq.Q(0, 1) | pq.Beamsplitter(theta=np.pi / 3, phi=np.pi / 4)
pq.Q(2, 3) | pq.Beamsplitter(theta=np.pi / 2, phi=np.pi / 3)

pq.Q() | pq.ParticleNumberMeasurement()

simulator = pq.SamplingSimulator(d=4)

result = simulator.execute(program, shots=5)

print(result.samples)

[(1, 0, 0, 1), (1, 0, 0, 1), (1, 0, 0, 1), (1, 0, 0, 1), (1, 0, 0, 1)]