StabilizerTable

class StabilizerTable(data, phase=None)[source]

Symplectic representation of a list Stabilizer matrices.

Symplectic Representation

The symplectic representation of a single-qubit Stabilizer matrix is a pair of boolean values \([x, z]\) and a boolean phase p such that the Stabilizer matrix is given by \(S = (-1)^p \sigma_z^z.\sigma_x^x\). The correspondence between labels, symplectic representation, stabilizer matrices, and Pauli matrices for the single-qubit case is shown in the following table.

Table 11 Table 1: Stabilizer Representations

Label

Phase

Symplectic

Matrix

Pauli

"+I"

0

\([0, 0]\)

\(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)

\(I\)

"-I"

1

\([0, 0]\)

\(\begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix}\)

\(-I\)

"X"

0

\([1, 0]\)

\(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\)

\(X\)

"-X"

1

\([1, 0]\)

\(\begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}\)

\(-X\)

"Y"

0

\([1, 1]\)

\(\begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}\)

\(iY\)

"-Y"

1

\([1, 1]\)

\(\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}\)

\(-iY\)

"Z"

0

\([0, 1]\)

\(\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\)

\(Z\)

"-Z"

1

\([0, 1]\)

\(\begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix}\)

\(-Z\)

Internally this is stored as a length N boolean phase vector \([p_{N-1}, ..., p_{0}]\) and a PauliTable \(M \times 2N\) boolean matrix:

\[\begin{split}\left(\begin{array}{ccc|ccc} x_{0,0} & ... & x_{0,N-1} & z_{0,0} & ... & z_{0,N-1} \\ x_{1,0} & ... & x_{1,N-1} & z_{1,0} & ... & z_{1,N-1} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ x_{M-1,0} & ... & x_{M-1,N-1} & z_{M-1,0} & ... & z_{M-1,N-1} \end{array}\right)\end{split}\]

where each row is a block vector \([X_i, Z_i]\) with \(X_i = [x_{i,0}, ..., x_{i,N-1}]\), \(Z_i = [z_{i,0}, ..., z_{i,N-1}]\) is the symplectic representation of an N-qubit Pauli. This representation is based on reference [1].

StabilizerTable’s can be created from a list of labels using from_labels(), and converted to a list of labels or a list of matrices using to_labels() and to_matrix() respectively.

Group Product

The product of the stabilizer elements is defined with respect to the matrix multiplication of the matrices in Table 1. In terms of stabilizes labels the dot product group structure is

A.B

I

X

Y

Z

I

I

X

Y

Z

X

X

I

-Z

Y

Y

Y

Z

-I

-X

Z

Z

-Y

X

I

The dot() method will return the output for row.dot(col) = row.col, while the compose() will return row.compose(col) = col.row from the above table.

Note that while this dot product is different to the matrix product of the PauliTable, it does not change the commutation structure of elements. Hence commutes:() will be the same for the same labels.

Qubit Ordering

The qubits are ordered in the table such the least significant qubit [x_{i, 0}, z_{i, 0}] is the first element of each of the \(X_i, Z_i\) vector blocks. This is the opposite order to position in string labels or matrix tensor products where the least significant qubit is the right-most string character. For example Pauli "ZX" has "X" on qubit-0 and "Z" on qubit 1, and would have symplectic vectors \(x=[1, 0]\), \(z=[0, 1]\).

Data Access

Subsets of rows can be accessed using the list access [] operator and will return a table view of part of the StabilizerTable. The underlying phase vector and Pauli array can be directly accessed using the phase and array properties respectively. The sub-arrays for only the X or Z blocks can be accessed using the X and Z properties respectively.

The Pauli part of the Stabilizer table can be viewed and accessed as a PauliTable object using the pauli property. Note that this doesn’t copy the underlying array so any changes made to the Pauli table will also change the stabilizer table.

Iteration

Rows in the Stabilizer table can be iterated over like a list. Iteration can also be done using the label or matrix representation of each row using the label_iter() and matrix_iter() methods.

References

  1. S. Aaronson, D. Gottesman, Improved Simulation of Stabilizer Circuits, Phys. Rev. A 70, 052328 (2004). arXiv:quant-ph/0406196

Initialize the StabilizerTable.

Parameters
  • data (array or str or PauliTable) – input PauliTable data.

  • phase (array or bool or None) – optional phase vector for input data (Default: None).

Raises

QiskitError – if input array or phase vector has an invalid shape.

Additional Information:

The input array is not copied so multiple Pauli and Stabilizer tables can share the same underlying array.

Attributes

StabilizerTable.X

The X block of the array.

StabilizerTable.Z

The Z block of the array.

StabilizerTable.array

The underlying boolean array.

StabilizerTable.atol

The default absolute tolerance parameter for float comparisons.

StabilizerTable.dim

Return tuple (input_shape, output_shape).

StabilizerTable.num_qubits

Return the number of qubits if a N-qubit operator or None otherwise.

StabilizerTable.pauli

Return PauliTable

StabilizerTable.phase

Return phase vector

StabilizerTable.qargs

Return the qargs for the operator.

StabilizerTable.rtol

The relative tolerance parameter for float comparisons.

StabilizerTable.shape

The full shape of the array()

StabilizerTable.size

The number of Pauli rows in the table.

Methods

StabilizerTable.__call__(qargs)

Return a clone with qargs set

StabilizerTable.__getitem__(key)

Return a view of StabilizerTable

StabilizerTable.__len__()

Return the number of Pauli rows in the table.

StabilizerTable.__mul__(other)

StabilizerTable.add(other)

Return the linear operator self + other.

StabilizerTable.adjoint()

Return the adjoint of the operator.

StabilizerTable.anticommutes_with_all(other)

Return indexes of rows that commute other.

StabilizerTable.argsort([weight])

Return indices for sorting the rows of the PauliTable.

StabilizerTable.commutes(pauli)

Return list of commutation properties for each row with a Pauli.

StabilizerTable.commutes_with_all(other)

Return indexes of rows that commute other.

StabilizerTable.compose(other[, qargs, front])

Return the compose output product of two tables.

StabilizerTable.conjugate()

Not implemented.

StabilizerTable.copy()

Return a copy of the StabilizerTable.

StabilizerTable.delete(ind[, qubit])

Return a copy with Stabilizer rows deleted from table.

StabilizerTable.dot(other[, qargs])

Return the dot output product of two tables.

StabilizerTable.expand(other)

Return the expand output product of two tables.

StabilizerTable.from_labels(labels)

Construct a StabilizerTable from a list of Pauli stabilizer strings.

StabilizerTable.input_dims([qargs])

Return tuple of input dimension for specified subsystems.

StabilizerTable.insert(ind, value[, qubit])

Insert stabilizers’s into the table.

StabilizerTable.label_iter()

Return a label representation iterator.

StabilizerTable.matrix_iter([sparse])

Return a matrix representation iterator.

StabilizerTable.multiply(other)

Return the linear operator other * self.

StabilizerTable.output_dims([qargs])

Return tuple of output dimension for specified subsystems.

StabilizerTable.power(n)

Return the compose of a operator with itself n times.

StabilizerTable.reshape([input_dims, …])

Return a shallow copy with reshaped input and output subsystem dimensions.

StabilizerTable.set_atol(value)

Set the class default absolute tolerance parameter for float comparisons.

StabilizerTable.set_rtol(value)

Set the class default relative tolerance parameter for float comparisons.

StabilizerTable.sort([weight])

Sort the rows of the table.

StabilizerTable.subtract(other)

Return the linear operator self - other.

StabilizerTable.tensor(other)

Return the tensor output product of two tables.

StabilizerTable.to_labels([array])

Convert a StabilizerTable to a list Pauli stabilizer string labels.

StabilizerTable.to_matrix([sparse, array])

Convert to a list or array of Stabilizer matrices.

StabilizerTable.transpose()

Not implemented.

StabilizerTable.unique([return_index, …])

Return unique stabilizers from the table.

StabilizerTable.__call__(qargs)

Return a clone with qargs set

StabilizerTable.__len__()

Return the number of Pauli rows in the table.

StabilizerTable.__mul__(other)