Classical sampling algorithms¶
Module name: thewalrus.csamples
This submodule provides access to classical sampling algorithms for thermal states going through an interferometer specified by a real orthogonal matrix. The quantum state to be sampled is specified by a positive semidefinite real matrix and a mean photon number. The algorithm implemented here was first derived in
Saleh Rahimi-Keshari, Austin P Lund, and Timothy C Ralph. “What can quantum optics say about computational complexity theory?” Physical Review Letters, 114(6):060501, (2015).
For more precise details of the implementation see
Soran Jahangiri, Juan Miguel Arrazola, Nicolás Quesada, and Nathan Killoran. “Point processes with Gaussian boson sampling” Phys. Rev. E 101, 022134, (2020)..
Summary¶
|
Returns the scaling parameter by which the adjacency matrix A should be rescaled so that the Gaussian state that encodes it has a total mean photon number n_mean for thermal sampling. |
|
Returns the scaling parameter by which the adjacency matrix A should be rescaled so that the Gaussian state that encodes it has a total mean photon number n_mean. |
|
Generates samples of the Gaussian state in terms of the mean photon number parameter ls and the interferometer O. |
Code details¶
- generate_thermal_samples(ls, O, num_samples=1)[source]¶
Generates samples of the Gaussian state in terms of the mean photon number parameter ls and the interferometer O.
- Parameters:
ls (array) – squashing parameters
O (array) – Orthogonal matrix representing the interferometer
num_samples – Number of samples to generate
- Returns:
samples
- Return type:
list(array
- rescale_adjacency_matrix(A, n_mean, scale, check_positivity=True, check_symmetry=True, rtol=1e-05, atol=1e-08)[source]¶
Returns the scaling parameter by which the adjacency matrix A should be rescaled so that the Gaussian state that encodes it has a total mean photon number n_mean.
- Parameters:
A (array) – Adjacency matrix, assumed to be positive semi-definite and real
n_mean (float) – Mean photon number of the Gaussian state
scale (float) – Determines whether to rescale the matrix for thermal sampling (scale = 1.0) or for squashed sampling (scale = 2.0)
check_positivity (bool) – Checks if the matrix A is positive semidefinite
check_symmetry (bool) – Checks if the matrix is symmetric
rtol – relative tolerance for the checks
atol – absolute tolerance for the checks
- Returns:
rescaled eigenvalues and eigenvectors of the matrix A
- Return type:
tuple(array,array)
- rescale_adjacency_matrix_thermal(A, n_mean, check_positivity=True, check_symmetry=True, rtol=1e-05, atol=1e-08)[source]¶
Returns the scaling parameter by which the adjacency matrix A should be rescaled so that the Gaussian state that encodes it has a total mean photon number n_mean for thermal sampling.
- Parameters:
A (array) – Adjacency matrix, assumed to be positive semi-definite and real
n_mean (float) – Mean photon number of the Gaussian state
check_positivity (bool) – Checks if the matrix A is positive semidefinite
check_symmetry (bool) – Checks if the matrix is symmetric
rtol – relative tolerance for the checks
atol – absolute tolerance for the checks
- Returns:
rescaled eigenvalues and eigenvectors of the matrix A
- Return type:
tuple(array,array)