pygsti.tools.symplectic

pygsti.tools.symplectic#

Symplectic representation utility functions

Functions

apply_clifford_to_stabilizer_state(s, p, ...)

Applies a clifford in the symplectic representation to a stabilizer state in the standard stabilizer representation.

apply_internal_gate_to_symplectic(s, ...[, ...])

Applies a Clifford gate to the n-qubit Clifford gate specified by the 2n x 2n symplectic matrix.

bitstring_for_pauli(p)

Get the bitstring corresponding to a Pauli.

bitstring_to_int(b, n)

Converts an n-bit string b to an integer between 0 and 2^`n` - 1.

change_symplectic_form_convention(s[, ...])

Maps the input symplectic matrix between the 'standard' and 'directsum' symplectic form conventions.

check_symplectic(m[, convention])

Checks whether a matrix is symplectic.

check_valid_clifford(s, p)

Checks if a symplectic matrix - phase vector pair (s,p) is the symplectic representation of a Clifford.

colsum(i, j, s, p, n)

A helper routine used for manipulating stabilizer state representations.

colsum_acc(acc_s, acc_p, j, s, p, n)

A helper routine used for manipulating stabilizer state representations.

compose_cliffords(s1, p1, s2, p2[, do_checks])

Multiplies two cliffords in the symplectic representation.

compute_internal_gate_symplectic_representations([...])

Creates a dictionary of the symplectic representations of 'standard' Clifford gates.

compute_num_cliffords(n)

The number of Clifford gates in the n-qubit Clifford group.

compute_num_cosets(n)

Returns the number of different cosets for the symplectic group S(n) over the 2-element finite field.

compute_num_symplectics(n)

The number of elements in the symplectic group S(n) over the 2-element finite field.

compute_symplectic_label(gn[, n])

Returns the "canonical" index of 2n x 2n symplectic matrix gn over the finite field containing 0 and 1.

compute_symplectic_matrix(i, n)

Returns the 2n x 2n symplectic matrix, over the finite field containing 0 and 1, with the "canonical" index i.

construct_valid_phase_vector(s, pseed)

Constructs a phase vector that, when paired with the provided symplectic matrix, defines a Clifford gate.

embed_clifford(s, p, qubit_inds, n)

Embeds the (s,p) Clifford symplectic representation into a larger symplectic representation.

find_pauli_layer(pvec, qubit_labels[, ...])

TODO: docstring pauli_labels defaults to ['I', 'X', 'Y', 'Z'].

find_pauli_number(pvec)

TODO: docstring

find_postmultipled_pauli(s, p_implemented, ...)

Finds the Pauli layer that should be appended to a circuit to implement a given Clifford.

find_premultipled_pauli(s, p_implemented, ...)

Finds the Pauli layer that should be prepended to a circuit to implement a given Clifford.

find_symplectic_transvection(x, y)

A utility function for selecting a random Clifford element.

int_to_bitstring(i, n)

Converts integer i to an length n array of bits.

inverse_clifford(s, p)

Returns the inverse of a Clifford gate in the symplectic representation.

inverse_symplectic(s)

Returns the inverse of a symplectic matrix over the integers mod 2.

one_q_clifford_symplectic_group_relations()

Gives the group relationship between the 'I', 'H', 'P' 'HP', 'PH', and 'HPH' up-to-Paulis operators.

pauli_z_measurement(state_s, state_p, ...)

Computes the probabilities of 0/1 (+/-) outcomes from measuring a Pauli operator on a stabilizer state.

prep_stabilizer_state(nqubits[, zvals])

Construct the (s,p) stabilizer representation for a computational basis state given by zvals.

random_clifford(n[, rand_state])

Returns a Clifford, in the symplectic representation, sampled uniformly at random from the n-qubit Clifford group.

random_phase_vector(s, n[, rand_state])

Generates a uniformly random phase vector for a n-qubit Clifford.

random_symplectic_index(n[, rand_state])

The index of a uniformly random 2n x 2n symplectic matrix over the finite field containing 0 and 1.

random_symplectic_matrix(n[, convention, ...])

Returns a symplectic matrix of dimensions 2n x 2n sampled uniformly at random from the symplectic group S(n).

stabilizer_measurement_prob(state_sp_tuple, ...)

Compute the probability of a given outcome when measuring some or all of the qubits in a stabilizer state.

symplectic_form(n[, convention])

Creates the symplectic form for the number of qubits specified.

symplectic_innerproduct(v, w)

Returns the symplectic inner product of two vectors in F_2^(2n).

symplectic_kronecker(sp_factors)

Takes a kronecker product of symplectic representations.

symplectic_rep_of_clifford_circuit(circuit)

Returns the symplectic representation of the composite Clifford implemented by the specified Clifford circuit.

symplectic_rep_of_clifford_layer(layer[, n, ...])

Constructs the symplectic representation of the n-qubit Clifford implemented by a single quantum circuit layer.

symplectic_transvection(k, v)

Applies transvection Z k to v.

unitary_is_clifford(unitary)

Returns True if the unitary is a Clifford gate (w.r.t the standard basis), and False otherwise.

unitary_to_symplectic(u[, flagnonclifford])

Returns the symplectic representation of a one-qubit or two-qubit Clifford unitary.