# sf.utils¶

This package defines and implements several utility functions and language extensions that complement StrawberryFields.

## Functions¶

 all_fock_probs_pnr(photon_number_samples) The Fock state probabilities for the specified modes obtained from PNR samples. cat_state(a[, p, fock_dim]) Returns the cat state coherent_state(r, phi[, basis, fock_dim, hbar]) Returns the coherent state displaced_squeezed_state(r_d, phi_d, r_s, phi_s) Returns the squeezed coherent state extract_channel(prog, cutoff_dim[, …]) Numerical array representation of the channel corresponding to a quantum circuit. extract_unitary(prog, cutoff_dim[, …]) Numerical array representation of a unitary quantum circuit. fock_state(n[, fock_dim]) Returns the Fock state is_channel(prog) True iff all the operations in the program can be represented as quantum channels. is_unitary(prog) True iff all the operations in the program are unitary. randnc(*arg) Normally distributed array of random complex numbers. random_covariance(N[, hbar, pure, block_diag]) Random covariance matrix. random_interferometer(N[, real]) Random unitary matrix representing an interferometer. random_symplectic(N[, passive, block_diag, …]) Random symplectic matrix representing a Gaussian transformation. samples_expectation(samples[, modes]) Uses samples obtained by a measurement operator to return the expectation value of the operator. samples_variance(samples[, modes]) Uses samples obtained by a measurement operator to return the expectation value of the operator. squeezed_cov(r, phi[, hbar]) Returns the squeezed covariance matrix of a squeezed state squeezed_state(r, p[, basis, fock_dim, hbar]) Returns the squeezed state vacuum_state([basis, fock_dim, hbar]) Returns the vacuum state

## Classes¶

 Groups a sequence of gates into a single operation to be used within a Program context.