qiskit.quantum_info.Clifford¶

class
Clifford
(data, validate=True)[소스]¶ An Nqubit unitary operator from the Clifford group.
Representation
An Nqubit Clifford operator is stored as a length 2N
StabilizerTable
using the convention from reference [1].Rows 0 to N1 are the destabilizer group generators
Rows N to 2N1 are the stabilizer group generators.
The internal
StabilizerTable
for the Clifford can be accessed using thetable
attribute. The destabilizer or stabilizer rows can each be accessed as a lengthN Stabilizer table usingdestabilizer
andstabilizer
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 examplefrom 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.destabilizer) # Print the Clifford stabilizer rows print(cliff.stabilizer)
Clifford: Stabilizer = ['+XX', '+ZZ'], Destabilizer = ['+IZ', '+XI'] StabilizerTable: ['+IZ', '+XI'] StabilizerTable: ['+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 aQuantumCircuit
, orGate
object using theto_circuit()
orto_instruction()
methods respectively. Note that this decomposition is not necessarily optimal in terms of number of gates.참고
A minimally generating set of gates for Clifford circuits is the
HGate
andSGate
gate and either theCXGate
orCZGate
twoqubit gate.Clifford operators can also be converted to
Operator
objects using theto_operator()
method. This is done via decomposing to a circuit, and then simulating the circuit as a unitary operator.참조
S. Aaronson, D. Gottesman, Improved Simulation of Stabilizer Circuits, Phys. Rev. A 70, 052328 (2004). arXiv:quantph/0406196
Initialize an operator object.
Methods
__init__
(data[, validate])Initialize an operator object.
adjoint
()Return the adjoint of the Operator.
compose
(other[, qargs, front])Return the operator composition with another Clifford.
Return the conjugate of the Clifford.
copy
()Make a deep copy of current operator.
dot
(other[, qargs])Return the right multiplied operator self * other.
expand
(other)Return the reverseorder tensor product with another Clifford.
from_circuit
(circuit)Initialize from a QuantumCircuit or Instruction.
from_dict
(obj)Load a Clifford from a dictionary
from_label
(label)Return a tensor product of singlequbit Clifford gates.
input_dims
([qargs])Return tuple of input dimension for specified subsystems.
Return True if the Clifford table is valid.
output_dims
([qargs])Return tuple of output dimension for specified subsystems.
power
(n)Return the compose of a operator with itself n times.
reshape
([input_dims, output_dims, num_qubits])Return a shallow copy with reshaped input and output subsystem dimensions.
tensor
(other)Return the tensor product with another Clifford.
Return a QuantumCircuit implementing the Clifford.
to_dict
()Return dictionary representation of Clifford object.
Return a Gate instruction implementing the Clifford.
Convert operator to Numpy matrix.
Convert to an Operator object.
Return the transpose of the Clifford.
Attributes
Return the destabilizer block of the StabilizerTable.
Return tuple (input_shape, output_shape).
Return the number of qubits if a Nqubit operator or None otherwise.
Return the qargs for the operator.
Return the stabilizer block of the StabilizerTable.
Return StabilizerTable

compose
(other, qargs=None, front=False)[소스]¶ Return the operator composition with another Clifford.
 매개변수
other (Clifford) – a Clifford object.
qargs (list or None) – Optional, a list of subsystem positions to apply other on. If None apply on all subsystems (default: None).
front (bool) – If True compose using right operator multiplication, instead of left multiplication [default: False].
 반환값
The composed Clifford.
 반환 형식
 예외
QiskitError – if other cannot be converted to an operator, or has incompatible dimensions for specified subsystems.
참고
Composition (
&
) by default is defined as left matrix multiplication for matrix operators, whiledot()
is defined as right matrix multiplication. That is thatA & B == A.compose(B)
is equivalent toB.dot(A)
whenA
andB
are of the same type.Setting the
front=True
kwarg changes this to right matrix multiplication and is equivalent to thedot()
methodA.dot(B) == A.compose(B, front=True)
.

copy
()¶ Make a deep copy of current operator.

property
destabilizer
¶ Return the destabilizer block of the StabilizerTable.

property
dim
¶ Return tuple (input_shape, output_shape).

dot
(other, qargs=None)¶ Return the right multiplied operator self * other.

static
from_circuit
(circuit)[소스]¶ Initialize from a QuantumCircuit or Instruction.
 매개변수
circuit (QuantumCircuit or Instruction) – instruction to initialize.
 반환값
the Clifford object for the instruction.
 반환 형식
 예외
QiskitError – if the input instruction is nonClifford or contains classical register instruction.

static
from_label
(label)[소스]¶ Return a tensor product of singlequbit Clifford gates.
 매개변수
label (string) – singlequbit operator string.
 반환값
The Nqubit Clifford operator.
 반환 형식
 예외
QiskitError – if the label contains invalid characters.
 Additional Information:
The labels correspond to the singlequbit Cliffords are
Label
Stabilizer
Destabilizer
"I"
+Z
+X
"X"
Z
+X
"Y"
Z
X
"Z"
+Z
X
"H"
+X
+Z
"S"
+Z
+Y

input_dims
(qargs=None)¶ Return tuple of input dimension for specified subsystems.

property
num_qubits
¶ Return the number of qubits if a Nqubit operator or None otherwise.

output_dims
(qargs=None)¶ Return tuple of output dimension for specified subsystems.

power
(n)¶ Return the compose of a operator with itself n times.
 매개변수
n (int) – the number of times to compose with self (n>0).
 반환값
the ntimes composed operator.
 반환 형식
 예외
QiskitError – if the input and output dimensions of the operator are not equal, or the power is not a positive integer.

property
qargs
¶ Return the qargs for the operator.

reshape
(input_dims=None, output_dims=None, num_qubits=None)¶ Return a shallow copy with reshaped input and output subsystem dimensions.
 매개변수
input_dims (None or tuple) – new subsystem input dimensions. If None the original input dims will be preserved [Default: None].
output_dims (None or tuple) – new subsystem output dimensions. If None the original output dims will be preserved [Default: None].
num_qubits (None or int) – reshape to an Nqubit operator [Default: None].
 반환값
returns self with reshaped input and output dimensions.
 반환 형식
BaseOperator
 예외
QiskitError – if combined size of all subsystem input dimension or subsystem output dimensions is not constant.

property
stabilizer
¶ Return the stabilizer block of the StabilizerTable.

property
table
¶ Return StabilizerTable

tensor
(other)[소스]¶ Return the tensor product with another Clifford.
 매개변수
other (Clifford) – a Clifford object.
 반환값
 the tensor product \(a \otimes b\), where \(a\)
is the current Clifford, and \(b\) is the other Clifford.
 반환 형식
참고
The tensor product can be obtained using the
^
binary operator. Hencea.tensor(b)
is equivalent toa ^ b
.

to_circuit
()[소스]¶ Return a QuantumCircuit implementing the Clifford.
For N <= 3 qubits this is based on optimal CX cost decomposition from reference [1]. For N > 3 qubits this is done using the general nonoptimal compilation routine from reference [2].
 반환값
a circuit implementation of the Clifford.
 반환 형식
참조
S. Bravyi, D. Maslov, Hadamardfree circuits expose the structure of the Clifford group, arXiv:2003.09412 [quantph]
S. Aaronson, D. Gottesman, Improved Simulation of Stabilizer Circuits, Phys. Rev. A 70, 052328 (2004). arXiv:quantph/0406196