pygsti.tools.symplectic.random_symplectic_matrix#
- random_symplectic_matrix(n, convention='standard', rand_state=None)#
Returns a symplectic matrix of dimensions 2n x 2n sampled uniformly at random from the symplectic group S(n).
This uses the method of Robert Koenig and John A. Smolin, presented in “How to efficiently select an arbitrary Clifford group element”.
- Parameters:
n (int) – The size of the symplectic group to sample from.
convention (str, optional) – Can be either ‘standard’ or ‘directsum’, which correspond to two different definitions for the symplectic form. In the case of ‘standard’, the symplectic form is the 2n x 2n matrix of ((0,1),(1,0)), where ‘1’ and ‘0’ are the identity and all-zeros matrices of size n x n. The ‘standard’ symplectic form is the convention used throughout most of the code. In the case of ‘directsum’, the symplectic form is the direct sum of n 2x2 bit-flip matrices.
rand_state (RandomState, optional) – A np.random.RandomState object for seeding RNG
- Returns:
s – A uniformly sampled random symplectic matrix.
- Return type:
numpy array