English
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

# Clifford¶

class Clifford(data, validate=True, copy=True)[source]

Bases: `qiskit.quantum_info.operators.base_operator.BaseOperator`, `qiskit.quantum_info.operators.mixins.adjoint.AdjointMixin`, `qiskit.circuit.operation.Operation`

An N-qubit unitary operator from the Clifford group.

Representation

An N-qubit Clifford operator is stored as a length 2N × (2N+1) boolean tableau using the convention from reference [1].

• Rows 0 to N-1 are the destabilizer group generators

• Rows N to 2N-1 are the stabilizer group generators.

The internal boolean tableau for the Clifford can be accessed using the `tableau` attribute. The destabilizer or stabilizer rows can each be accessed as a length-N Stabilizer table using `destab` and `stab` attributes.

A more easily human readable representation of the Clifford operator can be obtained by calling the `to_dict()` method. This representation is also used if a Clifford object is printed as in the following example

```from qiskit import QuantumCircuit
from qiskit.quantum_info import Clifford

# Bell state generation circuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
cliff = Clifford(qc)

# Print the Clifford
print(cliff)

# Print the Clifford destabilizer rows
print(cliff.to_labels(mode="D"))

# Print the Clifford stabilizer rows
print(cliff.to_labels(mode="S"))
```
```Clifford: Stabilizer = ['+XX', '+ZZ'], Destabilizer = ['+IZ', '+XI']
['+IZ', '+XI']
['+XX', '+ZZ']
```

Circuit Conversion

Clifford operators can be initialized from circuits containing only the following Clifford gates: `IGate`, `XGate`, `YGate`, `ZGate`, `HGate`, `SGate`, `SdgGate`, `CXGate`, `CZGate`, `SwapGate`. They can be converted back into a `QuantumCircuit`, or `Gate` object using the `to_circuit()` or `to_instruction()` methods respectively. Note that this decomposition is not necessarily optimal in terms of number of gates.

Note

A minimally generating set of gates for Clifford circuits is the `HGate` and `SGate` gate and either the `CXGate` or `CZGate` two-qubit gate.

Clifford operators can also be converted to `Operator` objects using the `to_operator()` method. This is done via decomposing to a circuit, and then simulating the circuit as a unitary operator.

References

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

Initialize an operator object.

Methods

 `adjoint` Return the adjoint of the Operator. `compose` Return the operator composition with another Clifford. `conjugate` Return the conjugate of the Clifford. `copy` Make a deep copy of current operator. `dot` Return the right multiplied operator self * other. `expand` Return the reverse-order tensor product with another Clifford. `from_circuit` Initialize from a QuantumCircuit or Instruction. `from_dict` Load a Clifford from a dictionary `from_label` Return a tensor product of single-qubit Clifford gates. `input_dims` Return tuple of input dimension for specified subsystems. `is_unitary` Return True if the Clifford table is valid. `output_dims` Return tuple of output dimension for specified subsystems. `power` Return the compose of a operator with itself n times. `reshape` Return a shallow copy with reshaped input and output subsystem dimensions. `tensor` Return the tensor product with another Clifford. `to_circuit` Return a QuantumCircuit implementing the Clifford. `to_dict` Return dictionary representation of Clifford object. `to_instruction` Return a Gate instruction implementing the Clifford. `to_labels` Convert a Clifford to a list Pauli (de)stabilizer string labels. `to_matrix` Convert operator to Numpy matrix. `to_operator` Convert to an Operator object. `transpose` Return the transpose of the Clifford.

Attributes

destab

The destabilizer array for the symplectic representation.

destab_phase

Return phase of destaibilizer with boolean representation.

destab_x

The destabilizer x array for the symplectic representation.

destab_z

The destabilizer z array for the symplectic representation.

destabilizer

Return the destabilizer block of the StabilizerTable.

dim

Return tuple (input_shape, output_shape).

name

Unique string identifier for operation type.

num_clbits

Number of classical bits.

num_qubits

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

phase

Return phase with boolean representation.

qargs

Return the qargs for the operator.

stab

The stabilizer array for the symplectic representation.

stab_phase

Return phase of stablizer with boolean representation.

stab_x

The stabilizer x array for the symplectic representation.

stab_z

The stabilizer array for the symplectic representation.

stabilizer

Return the stabilizer block of the StabilizerTable.

symplectic_matrix

Return boolean symplectic matrix.

table

Return StabilizerTable

x

The x array for the symplectic representation.

z

The z array for the symplectic representation.