# qiskit.ignis.verification.CNOTDihedral¶

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

CNOT-dihedral Object Class. The CNOT-dihedral group on num_qubits qubits is generated by the gates CNOT, T and X.

References

1. Shelly Garion and Andrew W. Cross, On the structure of the CNOT-Dihedral group, arXiv:2006.12042 [quant-ph]

2. Andrew W. Cross, Easwar Magesan, Lev S. Bishop, John A. Smolin and Jay M. Gambetta, Scalable randomised benchmarking of non-Clifford gates, npj Quantum Inf 2, 16012 (2016).

Initialize a CNOTDihedral operator object.

__init__(data, validate=True)[Quellcode]

Initialize a CNOTDihedral operator object.

Methods

 __init__(data[, validate]) Initialize a CNOTDihedral operator object. Return the conjugate transpose of the CNOTDihedral element cnot(i, j) Apply a CNOT gate to this element. compose(other[, qargs, front]) Return the composed operator. Return the conjugate of the CNOTDihedral element. 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 tensor self. Apply X to this element. from_circuit(circuit) Initialize from a QuantumCircuit or Instruction. input_dims([qargs]) Return tuple of input dimension for specified subsystems. Return True if input is a CNOTDihedral element. output_dims([qargs]) Return tuple of output dimension for specified subsystems. phase(k, i) Apply an k-th power of T to this element. 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 operator: self tensor other. Return a QuantumCircuit implementing the CNOT-Dihedral element. Return a Gate instruction implementing the CNOTDihedral object. Convert operator to Numpy matrix. Convert to an Operator object. Return the transpose of the CNOT-Dihedral element.

Attributes

 dim Return tuple (input_shape, output_shape). key Return a string representation of a CNOT-dihedral object. num_qubits Return the number of qubits if a N-qubit operator or None otherwise. qargs Return the qargs for the operator. settings Return operator settings.
adjoint()[Quellcode]

Return the conjugate transpose of the CNOTDihedral element

cnot(i, j)[Quellcode]

Apply a CNOT gate to this element. Left multiply the element by CNOT_{i,j}.

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

Return the composed operator.

Parameter
• other (CNOTDihedral) – an operator object.

• qargs (None) – using specific qargs is not implemented for this operator.

• front (bool) – if True compose using right operator multiplication, instead of left multiplication [default: False].

Rückgabe

The operator self @ other.

Rückgabetyp

CNOTDihedral

Verursacht
• QiskitError – if operators have incompatible dimensions for composition.

• NotImplementedError – if qargs is not None.

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 CNOTDihedral element.

copy()

Make a deep copy of current operator.

property dim

Return tuple (input_shape, output_shape).

dot(other, qargs=None)[Quellcode]

Return the right multiplied operator self * other.

Parameter
• other (CNOTDihedral) – an operator object.

• qargs (None) – using specific qargs is not implemented for this operator.

Rückgabe

The operator self * other.

Rückgabetyp

CNOTDihedral

Verursacht
• QiskitError – if operators have incompatible dimensions for composition.

• NotImplementedError – if qargs is not None.

expand(other)[Quellcode]

Return the tensor product operator: other tensor self.

Parameter

other (CNOTDihedral) – an operator subclass object.

Rückgabe

the tensor product operator: other tensor other.

Rückgabetyp

CNOTDihedral

flip(i)[Quellcode]

Apply X to this element. Left multiply the element by X_i.

from_circuit(circuit)[Quellcode]

Initialize from a QuantumCircuit or Instruction.

Parameter

circuit (QuantumCircuit or Instruction) – instruction to initialize.

Rückgabe

the CNOTDihedral object for the circuit.

Rückgabetyp

CNOTDihedral

Verursacht

QiskitError – if the input instruction is not CNOTDihedral or contains classical register instruction.

input_dims(qargs=None)

Return tuple of input dimension for specified subsystems.

is_cnotdihedral()[Quellcode]

Return True if input is a CNOTDihedral element.

property key

Return a string representation of a CNOT-dihedral object.

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.

phase(k, i)[Quellcode]

Apply an k-th power of T to this element. Left multiply the element by T_i^k.

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

Pauli

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, num_qubits=None)

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

Parameter
• 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 N-qubit operator [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 settings

Return operator settings.

tensor(other)[Quellcode]

Return the tensor product operator: self tensor other.

Parameter

other (CNOTDihedral) – an operator subclass object.

Rückgabe

the tensor product operator: self tensor other.

Rückgabetyp

CNOTDihedral

to_circuit()[Quellcode]

Return a QuantumCircuit implementing the CNOT-Dihedral element.

Rückgabe

a circuit implementation of the CNOTDihedral object.

Rückgabetyp

QuantumCircuit

Remark:

Decompose 1 and 2-qubit CNOTDihedral elements.

References

1. Shelly Garion and Andrew W. Cross, On the structure of the CNOT-Dihedral group, arXiv:2006.12042 [quant-ph]

2. Andrew W. Cross, Easwar Magesan, Lev S. Bishop, John A. Smolin and Jay M. Gambetta, Scalable randomised benchmarking of non-Clifford gates, npj Quantum Inf 2, 16012 (2016).

to_instruction()[Quellcode]

Return a Gate instruction implementing the CNOTDihedral object.

to_matrix()[Quellcode]

Convert operator to Numpy matrix.

to_operator()[Quellcode]

Convert to an Operator object.

transpose()[Quellcode]

Return the transpose of the CNOT-Dihedral element.