Shortcuts

qiskit.quantum_info.Clifford

class Clifford(data, validate=True)[Quellcode]

An N-qubit unitary operator from the Clifford group.

Representation

An N-qubit Clifford operator is stored as a length 2N StabilizerTable 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 StabilizerTable for the Clifford can be accessed using the table attribute. The destabilizer or stabilizer rows can each be accessed as a length-N Stabilizer table using destabilizer and stabilizer attributes.

A more easily human readible 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.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 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.

Bemerkung

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.

__init__(data, validate=True)[Quellcode]

Initialize an operator object.

Methods

__init__(data[, validate])

Initialize an operator object.

add(other)

Return the linear operator self + other.

adjoint()

Return the conjugate transpose of the Clifford

compose(other[, qargs, front])

Return the composed operator.

conjugate()

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 tensor product operator other ⊗ self.

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 single-qubit Clifford gates.

input_dims([qargs])

Return tuple of input dimension for specified subsystems.

is_unitary()

Return True if the Clifford table is valid.

multiply(other)

Return the linear operator other * self.

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])

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

set_atol(value)

Set the class default absolute tolerance parameter for float comparisons.

set_rtol(value)

Set the class default relative tolerance parameter for float comparisons.

subtract(other)

Return the linear operator self - other.

tensor(other)

Return the tensor product operator self ⊗ other.

to_circuit()

Return a QuantumCircuit implementing the Clifford.

to_dict()

Return dictionary represenation of Clifford object.

to_instruction()

Return a Gate instruction implementing the Clifford.

to_matrix()

Convert operator to Numpy matrix.

to_operator()

Convert to an Operator object.

transpose()

Return the transpose of the Clifford.

Attributes

atol

The default absolute tolerance parameter for float comparisons.

destabilizer

Return the destabilizer block of the StabilizerTable.

dim

Return tuple (input_shape, output_shape).

num_qubits

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

qargs

Return the qargs for the operator.

rtol

The relative tolerance parameter for float comparisons.

stabilizer

Return the stabilizer block of the StabilizerTable.

table

Return StabilizerTable

add(other)

Return the linear operator self + other.

DEPRECATED: use operator + other instead.

Parameter

other (BaseOperator) – an operator object.

Rückgabe

the operator self + other.

Rückgabetyp

BaseOperator

adjoint()[Quellcode]

Return the conjugate transpose of the Clifford

property atol

The default absolute tolerance parameter for float comparisons.

compose(other, qargs=None, front=False)[Quellcode]

Return the composed operator.

Parameter
  • other (Clifford) – an operator object.

  • qargs (list or None) – 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].

Rückgabe

The operator self @ other.

Rückgabetyp

Clifford

Verursacht

QiskitError – if operators have incompatible dimensions for composition.

Additional Information:

Composition (@) is defined as left matrix multiplication for matrix operators. That is that A @ B is equal to B * A. Setting front=True returns right matrix multiplication A * B and is equivalent to the dot() method.

conjugate()[Quellcode]

Return the conjugate of the Clifford.

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)[Quellcode]

Return the right multiplied operator self * other.

Parameter
  • other (Clifford) – an operator object.

  • qargs (list or None) – a list of subsystem positions to apply other on. If None apply on all subsystems [default: None].

Rückgabe

The operator self * other.

Rückgabetyp

Clifford

Verursacht

QiskitError – if operators have incompatible dimensions for composition.

expand(other)[Quellcode]

Return the tensor product operator other ⊗ self.

Parameter

other (Clifford) – an operator object.

Rückgabe

the tensor product operator other ⊗ self.

Rückgabetyp

Clifford

static from_circuit(circuit)[Quellcode]

Initialize from a QuantumCircuit or Instruction.

Parameter

circuit (QuantumCircuit or Instruction) – instruction to initialize.

Rückgabe

the Clifford object for the instruction.

Rückgabetyp

Clifford

Verursacht

QiskitError – if the input instruction is non-Clifford or contains classical register instruction.

static from_dict(obj)[Quellcode]

Load a Clifford from a dictionary

static from_label(label)[Quellcode]

Return a tensor product of single-qubit Clifford gates.

Parameter

label (string) – single-qubit operator string.

Rückgabe

The N-qubit Clifford operator.

Rückgabetyp

Clifford

Verursacht

QiskitError – if the label contains invalid characters.

Additional Information:

The labels correspond to the single-qubit 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.

is_unitary()[Quellcode]

Return True if the Clifford table is valid.

multiply(other)

Return the linear operator other * self.

DEPRECATED: use other * operator instead.

Parameter

other (complex) – a complex number.

Rückgabe

the linear operator other * self.

Rückgabetyp

BaseOperator

Verursacht

NotImplementedError – if subclass does not support multiplication.

property num_qubits

Return the number of qubits if a N-qubit 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.

Parameter

n (int) – the number of times to compose with self (n>0).

Rückgabe

the n-times composed operator.

Rückgabetyp

BaseOperator

Verursacht

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)

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

Arg:
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].

Rückgabe

returns self with reshaped input and output dimensions.

Rückgabetyp

BaseOperator

Verursacht

QiskitError – if combined size of all subsystem input dimension or subsystem output dimensions is not constant.

property rtol

The relative tolerance parameter for float comparisons.

classmethod set_atol(value)

Set the class default absolute tolerance parameter for float comparisons.

DEPRECATED: use operator.atol = value instead

classmethod set_rtol(value)

Set the class default relative tolerance parameter for float comparisons.

DEPRECATED: use operator.rtol = value instead

property stabilizer

Return the stabilizer block of the StabilizerTable.

subtract(other)

Return the linear operator self - other.

DEPRECATED: use operator - other instead.

Parameter

other (BaseOperator) – an operator object.

Rückgabe

the operator self - other.

Rückgabetyp

BaseOperator

property table

Return StabilizerTable

tensor(other)[Quellcode]

Return the tensor product operator self ⊗ other.

Parameter

other (Clifford) – a operator subclass object.

Rückgabe

the tensor product operator self ⊗ other.

Rückgabetyp

Clifford

to_circuit()[Quellcode]

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 non-optimal compilation routine from reference [2].

Rückgabe

a circuit implementation of the Clifford.

Rückgabetyp

QuantumCircuit

References

  1. S. Bravyi, D. Maslov, Hadamard-free circuits expose the structure of the Clifford group, arXiv:2003.09412 [quant-ph]

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

to_dict()[Quellcode]

Return dictionary represenation of Clifford object.

to_instruction()[Quellcode]

Return a Gate instruction implementing the Clifford.

to_matrix()[Quellcode]

Convert operator to Numpy matrix.

to_operator()[Quellcode]

Convert to an Operator object.

transpose()[Quellcode]

Return the transpose of the Clifford.

Zu sehen ist lang: German
Sprachen
English
Japanese
German
Korean