qiskit.quantum_info.CNOTDihedral¶

class
CNOTDihedral
(data=None, num_qubits=None, validate=True)[소스]¶ An Nqubit operator from the CNOTDihedral group.
The CNOTDihedral group is generated by the quantum gates,
CXGate
,TGate
, andXGate
.Representation
An \(N\)qubit CNOTDihedral operator is stored as an affine function and a phase polynomial, based on the convention in references [1, 2].
The affine function consists of an \(N \times N\) invertible binary matrix, and an \(N\) binary vector.
The phase polynomial is a polynomial of degree at most 3, in \(N\) variables, whose coefficients are in the ring Z_8 with 8 elements.
from qiskit import QuantumCircuit from qiskit.quantum_info import CNOTDihedral circ = QuantumCircuit(3) circ.cx(0, 1) circ.x(2) circ.t(1) circ.t(1) circ.t(1) elem = CNOTDihedral(circ) # Print the CNOTDihedral element print(elem)
phase polynomial = 0 + 3*x_0 + 3*x_1 + 2*x_0*x_1 affine function = (x_0,x_0 + x_1,x_2 + 1)
Circuit Conversion
CNOTDihedral operators can be initialized from circuits containing only the following gates:
IGate
,XGate
,YGate
,ZGate
,TGate
,TdgGate
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 if the number of qubits is more than two.CNOTDihedral 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. References:
Shelly Garion and Andrew W. Cross, Synthesis of CNOTDihedral circuits with optimal number of two qubit gates, Quantum 4(369), 2020
Andrew W. Cross, Easwar Magesan, Lev S. Bishop, John A. Smolin and Jay M. Gambetta, Scalable randomised benchmarking of nonClifford gates, npj Quantum Inf 2, 16012 (2016).
Initialize a CNOTDihedral operator object.
 매개변수
data (CNOTDihedral or QuantumCircuit or Instruction) – Optional, operator to initialize.
num_qubits (int) – Optional, initialize an empty CNOTDihedral operator.
validate (bool) – if True, validates the CNOTDihedral element.
 예외
QiskitError – if the type is invalid.
QiskitError – if validate=True and the CNOTDihedral element is invalid.

__init__
(data=None, num_qubits=None, validate=True)[소스]¶ Initialize a CNOTDihedral operator object.
 매개변수
data (CNOTDihedral or QuantumCircuit or Instruction) – Optional, operator to initialize.
num_qubits (int) – Optional, initialize an empty CNOTDihedral operator.
validate (bool) – if True, validates the CNOTDihedral element.
 예외
QiskitError – if the type is invalid.
QiskitError – if validate=True and the CNOTDihedral element is invalid.
Methods
__init__
([data, num_qubits, validate])Initialize a CNOTDihedral operator object.
adjoint
()Return the adjoint of the Operator.
compose
(other[, qargs, front])Return the operator composition with another CNOTDihedral.
Return the conjugate of the CNOTDihedral.
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 CNOTDihedral.
input_dims
([qargs])Return tuple of input dimension for specified subsystems.
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 CNOTDihedral.
Return a QuantumCircuit implementing the CNOTDihedral element.
Return a Gate instruction implementing the CNOTDihedral object.
Convert operator to Numpy matrix.
Convert to an Operator object.
Return the transpose of the CNOTDihedral.
Attributes
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 operator settings.

compose
(other, qargs=None, front=False)[소스]¶ Return the operator composition with another CNOTDihedral.
 매개변수
other (CNOTDihedral) – a CNOTDihedral 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 CNOTDihedral.
 반환 형식
 예외
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
dim
¶ Return tuple (input_shape, output_shape).

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

expand
(other)[소스]¶ Return the reverseorder tensor product with another CNOTDihedral.
 매개변수
other (CNOTDihedral) – a CNOTDihedral object.
 반환값
 the tensor product \(b \otimes a\), where \(a\)
is the current CNOTDihedral, and \(b\) is the other CNOTDihedral.
 반환 형식

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
settings
¶ Return operator settings.

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

to_circuit
()[소스]¶ Return a QuantumCircuit implementing the CNOTDihedral element.
 반환값
a circuit implementation of the CNOTDihedral object.
 반환 형식
참조
Shelly Garion and Andrew W. Cross, Synthesis of CNOTDihedral circuits with optimal number of two qubit gates, Quantum 4(369), 2020
Andrew W. Cross, Easwar Magesan, Lev S. Bishop, John A. Smolin and Jay M. Gambetta, Scalable randomised benchmarking of nonClifford gates, npj Quantum Inf 2, 16012 (2016).