# sf.apps.points.sample¶

sample(K, n_mean, n_samples)[source]

Sample subsets of points using the permanental point process.

Points can be encoded through a radial basis function kernel, provided in rbf_kernel(). Subsets of points are sampled with probabilities that are proportional to the permanent of the submatrix of the kernel selected by those points.

This permanental point process is likely to sample points that are clustered together [16]. It can be realized using a variant of Gaussian boson sampling with thermal states as input.

Example usage:

>>> K = np.array([[1., 0.36787944, 0.60653066, 0.60653066],
>>>               [0.36787944, 1., 0.60653066, 0.60653066],
>>>               [0.60653066, 0.60653066, 1., 0.36787944],
>>>               [0.60653066, 0.60653066, 0.36787944, 1.]])
>>> sample(K, 1.0, 10)
[[0, 1, 1, 1],
[0, 0, 0, 0],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 1, 1, 0],
[2, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 1, 1],
[0, 0, 0, 0]]

Parameters
• K (array) – the positive semidefinite kernel matrix

• n_mean (float) – average number of points per sample

• n_samples (int) – number of samples to be generated

Returns

samples generated by the point process

Return type

samples (list[list[int]])

### Contents

Using Strawberry Fields

Development

API