451 lines
20 KiB
Plaintext
451 lines
20 KiB
Plaintext
---
|
||
title: CNOTDihedral
|
||
description: API reference for qiskit.ignis.verification.CNOTDihedral
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.ignis.verification.CNOTDihedral
|
||
---
|
||
|
||
<span id="qiskit-ignis-verification-cnotdihedral" />
|
||
|
||
# qiskit.ignis.verification.CNOTDihedral
|
||
|
||
<Class id="qiskit.ignis.verification.CNOTDihedral" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-ignis/tree/stable/0.5/qiskit/ignis/verification/randomized_benchmarking/dihedral.py" signature="CNOTDihedral(data, validate=True)" modifiers="class">
|
||
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\]](https://arxiv.org/abs/2006.12042)
|
||
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\_\_
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.__init__" signature="__init__(data, validate=True)">
|
||
Initialize a CNOTDihedral operator object.
|
||
</Function>
|
||
|
||
## Methods
|
||
|
||
| | |
|
||
| ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||
| [`__init__`](#qiskit.ignis.verification.CNOTDihedral.__init__ "qiskit.ignis.verification.CNOTDihedral.__init__")(data\[, validate]) | Initialize a CNOTDihedral operator object. |
|
||
| [`add`](#qiskit.ignis.verification.CNOTDihedral.add "qiskit.ignis.verification.CNOTDihedral.add")(other) | Return the linear operator self + other. |
|
||
| [`adjoint`](#qiskit.ignis.verification.CNOTDihedral.adjoint "qiskit.ignis.verification.CNOTDihedral.adjoint")() | Return the conjugate transpose of the CNOTDihedral element |
|
||
| [`cnot`](#qiskit.ignis.verification.CNOTDihedral.cnot "qiskit.ignis.verification.CNOTDihedral.cnot")(i, j) | Apply a CNOT gate to this element. |
|
||
| [`compose`](#qiskit.ignis.verification.CNOTDihedral.compose "qiskit.ignis.verification.CNOTDihedral.compose")(other\[, qargs, front]) | Return the composed operator. |
|
||
| [`conjugate`](#qiskit.ignis.verification.CNOTDihedral.conjugate "qiskit.ignis.verification.CNOTDihedral.conjugate")() | Return the conjugate of the CNOTDihedral element. |
|
||
| [`copy`](#qiskit.ignis.verification.CNOTDihedral.copy "qiskit.ignis.verification.CNOTDihedral.copy")() | Make a deep copy of current operator. |
|
||
| [`dot`](#qiskit.ignis.verification.CNOTDihedral.dot "qiskit.ignis.verification.CNOTDihedral.dot")(other\[, qargs]) | Return the right multiplied operator self \* other. |
|
||
| [`expand`](#qiskit.ignis.verification.CNOTDihedral.expand "qiskit.ignis.verification.CNOTDihedral.expand")(other) | Return the tensor product operator: other tensor self. |
|
||
| [`flip`](#qiskit.ignis.verification.CNOTDihedral.flip "qiskit.ignis.verification.CNOTDihedral.flip")(i) | Apply X to this element. |
|
||
| [`from_circuit`](#qiskit.ignis.verification.CNOTDihedral.from_circuit "qiskit.ignis.verification.CNOTDihedral.from_circuit")(circuit) | Initialize from a QuantumCircuit or Instruction. |
|
||
| [`input_dims`](#qiskit.ignis.verification.CNOTDihedral.input_dims "qiskit.ignis.verification.CNOTDihedral.input_dims")(\[qargs]) | Return tuple of input dimension for specified subsystems. |
|
||
| [`is_cnotdihedral`](#qiskit.ignis.verification.CNOTDihedral.is_cnotdihedral "qiskit.ignis.verification.CNOTDihedral.is_cnotdihedral")() | Return True if input is a CNOTDihedral element. |
|
||
| [`multiply`](#qiskit.ignis.verification.CNOTDihedral.multiply "qiskit.ignis.verification.CNOTDihedral.multiply")(other) | Return the linear operator other \* self. |
|
||
| [`output_dims`](#qiskit.ignis.verification.CNOTDihedral.output_dims "qiskit.ignis.verification.CNOTDihedral.output_dims")(\[qargs]) | Return tuple of output dimension for specified subsystems. |
|
||
| [`phase`](#qiskit.ignis.verification.CNOTDihedral.phase "qiskit.ignis.verification.CNOTDihedral.phase")(k, i) | Apply an k-th power of T to this element. |
|
||
| [`power`](#qiskit.ignis.verification.CNOTDihedral.power "qiskit.ignis.verification.CNOTDihedral.power")(n) | Return the compose of a operator with itself n times. |
|
||
| [`reshape`](#qiskit.ignis.verification.CNOTDihedral.reshape "qiskit.ignis.verification.CNOTDihedral.reshape")(\[input\_dims, output\_dims]) | Return a shallow copy with reshaped input and output subsystem dimensions. |
|
||
| [`set_atol`](#qiskit.ignis.verification.CNOTDihedral.set_atol "qiskit.ignis.verification.CNOTDihedral.set_atol")(value) | Set the class default absolute tolerance parameter for float comparisons. |
|
||
| [`set_rtol`](#qiskit.ignis.verification.CNOTDihedral.set_rtol "qiskit.ignis.verification.CNOTDihedral.set_rtol")(value) | Set the class default relative tolerance parameter for float comparisons. |
|
||
| [`subtract`](#qiskit.ignis.verification.CNOTDihedral.subtract "qiskit.ignis.verification.CNOTDihedral.subtract")(other) | Return the linear operator self - other. |
|
||
| [`tensor`](#qiskit.ignis.verification.CNOTDihedral.tensor "qiskit.ignis.verification.CNOTDihedral.tensor")(other) | Return the tensor product operator: self tensor other. |
|
||
| [`to_circuit`](#qiskit.ignis.verification.CNOTDihedral.to_circuit "qiskit.ignis.verification.CNOTDihedral.to_circuit")() | Return a QuantumCircuit implementing the CNOT-Dihedral element. |
|
||
| [`to_instruction`](#qiskit.ignis.verification.CNOTDihedral.to_instruction "qiskit.ignis.verification.CNOTDihedral.to_instruction")() | Return a Gate instruction implementing the CNOTDihedral object. |
|
||
| [`to_matrix`](#qiskit.ignis.verification.CNOTDihedral.to_matrix "qiskit.ignis.verification.CNOTDihedral.to_matrix")() | Convert operator to Numpy matrix. |
|
||
| [`to_operator`](#qiskit.ignis.verification.CNOTDihedral.to_operator "qiskit.ignis.verification.CNOTDihedral.to_operator")() | Convert to an Operator object. |
|
||
| [`transpose`](#qiskit.ignis.verification.CNOTDihedral.transpose "qiskit.ignis.verification.CNOTDihedral.transpose")() | Return the transpose of the CNOT-Dihedral element. |
|
||
|
||
## Attributes
|
||
|
||
| | |
|
||
| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
||
| [`atol`](#qiskit.ignis.verification.CNOTDihedral.atol "qiskit.ignis.verification.CNOTDihedral.atol") | The default absolute tolerance parameter for float comparisons. |
|
||
| [`dim`](#qiskit.ignis.verification.CNOTDihedral.dim "qiskit.ignis.verification.CNOTDihedral.dim") | Return tuple (input\_shape, output\_shape). |
|
||
| [`key`](#qiskit.ignis.verification.CNOTDihedral.key "qiskit.ignis.verification.CNOTDihedral.key") | Return a string representation of a CNOT-dihedral object. |
|
||
| [`num_qubits`](#qiskit.ignis.verification.CNOTDihedral.num_qubits "qiskit.ignis.verification.CNOTDihedral.num_qubits") | Return the number of qubits if a N-qubit operator or None otherwise. |
|
||
| [`qargs`](#qiskit.ignis.verification.CNOTDihedral.qargs "qiskit.ignis.verification.CNOTDihedral.qargs") | Return the qargs for the operator. |
|
||
| [`rtol`](#qiskit.ignis.verification.CNOTDihedral.rtol "qiskit.ignis.verification.CNOTDihedral.rtol") | The relative tolerance parameter for float comparisons. |
|
||
|
||
### add
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.add" signature="add(other)">
|
||
Return the linear operator self + other.
|
||
|
||
DEPRECATED: use `operator + other` instead.
|
||
|
||
**Parameters**
|
||
|
||
**other** (*BaseOperator*) – an operator object.
|
||
|
||
**Returns**
|
||
|
||
the operator self + other.
|
||
|
||
**Return type**
|
||
|
||
BaseOperator
|
||
</Function>
|
||
|
||
### adjoint
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.adjoint" signature="adjoint()">
|
||
Return the conjugate transpose of the CNOTDihedral element
|
||
</Function>
|
||
|
||
### atol
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.atol">
|
||
The default absolute tolerance parameter for float comparisons.
|
||
</Attribute>
|
||
|
||
### cnot
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.cnot" signature="cnot(i, j)">
|
||
Apply a CNOT gate to this element. Left multiply the element by CNOT\_\{i,j}.
|
||
</Function>
|
||
|
||
### compose
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.compose" signature="compose(other, qargs=None, front=False)">
|
||
Return the composed operator.
|
||
|
||
**Parameters**
|
||
|
||
* **other** ([*CNOTDihedral*](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.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].
|
||
|
||
**Returns**
|
||
|
||
The operator self @ other.
|
||
|
||
**Return type**
|
||
|
||
[CNOTDihedral](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")
|
||
|
||
**Raises**
|
||
|
||
* **QiskitError** – if operators have incompatible dimensions for composition.
|
||
* **NotImplementedError** – if qargs is not None.
|
||
|
||
**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()`](#qiskit.ignis.verification.CNOTDihedral.dot "qiskit.ignis.verification.CNOTDihedral.dot") method.
|
||
</Function>
|
||
|
||
### conjugate
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.conjugate" signature="conjugate()">
|
||
Return the conjugate of the CNOTDihedral element.
|
||
</Function>
|
||
|
||
### copy
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.copy" signature="copy()">
|
||
Make a deep copy of current operator.
|
||
</Function>
|
||
|
||
### dim
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.dim">
|
||
Return tuple (input\_shape, output\_shape).
|
||
</Attribute>
|
||
|
||
### dot
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.dot" signature="dot(other, qargs=None)">
|
||
Return the right multiplied operator self \* other.
|
||
|
||
**Parameters**
|
||
|
||
* **other** ([*CNOTDihedral*](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")) – an operator object.
|
||
* **qargs** (*None*) – using specific qargs is not implemented for this operator.
|
||
|
||
**Returns**
|
||
|
||
The operator self \* other.
|
||
|
||
**Return type**
|
||
|
||
[CNOTDihedral](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")
|
||
|
||
**Raises**
|
||
|
||
* **QiskitError** – if operators have incompatible dimensions for composition.
|
||
* **NotImplementedError** – if qargs is not None.
|
||
</Function>
|
||
|
||
### expand
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.expand" signature="expand(other)">
|
||
Return the tensor product operator: other tensor self.
|
||
|
||
**Parameters**
|
||
|
||
**other** ([*CNOTDihedral*](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")) – an operator subclass object.
|
||
|
||
**Returns**
|
||
|
||
the tensor product operator: other tensor other.
|
||
|
||
**Return type**
|
||
|
||
[CNOTDihedral](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")
|
||
</Function>
|
||
|
||
### flip
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.flip" signature="flip(i)">
|
||
Apply X to this element. Left multiply the element by X\_i.
|
||
</Function>
|
||
|
||
### from\_circuit
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.from_circuit" signature="from_circuit(circuit)">
|
||
Initialize from a QuantumCircuit or Instruction.
|
||
|
||
**Parameters**
|
||
|
||
**circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") *or*[*Instruction*](qiskit.circuit.Instruction "qiskit.circuit.Instruction")) – instruction to initialize.
|
||
|
||
**Returns**
|
||
|
||
the CNOTDihedral object for the circuit.
|
||
|
||
**Return type**
|
||
|
||
[CNOTDihedral](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")
|
||
|
||
**Raises**
|
||
|
||
**QiskitError** – if the input instruction is not CNOTDihedral or contains classical register instruction.
|
||
</Function>
|
||
|
||
### input\_dims
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.input_dims" signature="input_dims(qargs=None)">
|
||
Return tuple of input dimension for specified subsystems.
|
||
</Function>
|
||
|
||
### is\_cnotdihedral
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.is_cnotdihedral" signature="is_cnotdihedral()">
|
||
Return True if input is a CNOTDihedral element.
|
||
</Function>
|
||
|
||
### key
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.key">
|
||
Return a string representation of a CNOT-dihedral object.
|
||
</Attribute>
|
||
|
||
### multiply
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.multiply" signature="multiply(other)">
|
||
Return the linear operator other \* self.
|
||
|
||
DEPRECATED: use `other * operator` instead.
|
||
|
||
**Parameters**
|
||
|
||
**other** (*complex*) – a complex number.
|
||
|
||
**Returns**
|
||
|
||
the linear operator other \* self.
|
||
|
||
**Return type**
|
||
|
||
BaseOperator
|
||
|
||
**Raises**
|
||
|
||
**NotImplementedError** – if subclass does not support multiplication.
|
||
</Function>
|
||
|
||
### num\_qubits
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.num_qubits">
|
||
Return the number of qubits if a N-qubit operator or None otherwise.
|
||
</Attribute>
|
||
|
||
### output\_dims
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.output_dims" signature="output_dims(qargs=None)">
|
||
Return tuple of output dimension for specified subsystems.
|
||
</Function>
|
||
|
||
### phase
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.phase" signature="phase(k, i)">
|
||
Apply an k-th power of T to this element. Left multiply the element by T\_i^k.
|
||
</Function>
|
||
|
||
### power
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.power" signature="power(n)">
|
||
Return the compose of a operator with itself n times.
|
||
|
||
**Parameters**
|
||
|
||
**n** (*int*) – the number of times to compose with self (n>0).
|
||
|
||
**Returns**
|
||
|
||
the n-times composed operator.
|
||
|
||
**Return type**
|
||
|
||
BaseOperator
|
||
|
||
**Raises**
|
||
|
||
**QiskitError** – if the input and output dimensions of the operator are not equal, or the power is not a positive integer.
|
||
</Function>
|
||
|
||
### qargs
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.qargs">
|
||
Return the qargs for the operator.
|
||
</Attribute>
|
||
|
||
### reshape
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.reshape" signature="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].
|
||
|
||
**Returns**
|
||
|
||
returns self with reshaped input and output dimensions.
|
||
|
||
**Return type**
|
||
|
||
BaseOperator
|
||
|
||
**Raises**
|
||
|
||
**QiskitError** – if combined size of all subsystem input dimension or subsystem output dimensions is not constant.
|
||
</Function>
|
||
|
||
### rtol
|
||
|
||
<Attribute id="qiskit.ignis.verification.CNOTDihedral.rtol">
|
||
The relative tolerance parameter for float comparisons.
|
||
</Attribute>
|
||
|
||
### set\_atol
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.set_atol" signature="set_atol(value)" modifiers="classmethod">
|
||
Set the class default absolute tolerance parameter for float comparisons.
|
||
|
||
DEPRECATED: use operator.atol = value instead
|
||
</Function>
|
||
|
||
### set\_rtol
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.set_rtol" signature="set_rtol(value)" modifiers="classmethod">
|
||
Set the class default relative tolerance parameter for float comparisons.
|
||
|
||
DEPRECATED: use operator.rtol = value instead
|
||
</Function>
|
||
|
||
### subtract
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.subtract" signature="subtract(other)">
|
||
Return the linear operator self - other.
|
||
|
||
DEPRECATED: use `operator - other` instead.
|
||
|
||
**Parameters**
|
||
|
||
**other** (*BaseOperator*) – an operator object.
|
||
|
||
**Returns**
|
||
|
||
the operator self - other.
|
||
|
||
**Return type**
|
||
|
||
BaseOperator
|
||
</Function>
|
||
|
||
### tensor
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.tensor" signature="tensor(other)">
|
||
Return the tensor product operator: self tensor other.
|
||
|
||
**Parameters**
|
||
|
||
**other** ([*CNOTDihedral*](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")) – an operator subclass object.
|
||
|
||
**Returns**
|
||
|
||
the tensor product operator: self tensor other.
|
||
|
||
**Return type**
|
||
|
||
[CNOTDihedral](#qiskit.ignis.verification.CNOTDihedral "qiskit.ignis.verification.CNOTDihedral")
|
||
</Function>
|
||
|
||
### to\_circuit
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.to_circuit" signature="to_circuit()">
|
||
Return a QuantumCircuit implementing the CNOT-Dihedral element.
|
||
|
||
**Returns**
|
||
|
||
a circuit implementation of the CNOTDihedral object.
|
||
|
||
**Return type**
|
||
|
||
[QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.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\]](https://arxiv.org/abs/2006.12042)
|
||
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).
|
||
</Function>
|
||
|
||
### to\_instruction
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.to_instruction" signature="to_instruction()">
|
||
Return a Gate instruction implementing the CNOTDihedral object.
|
||
</Function>
|
||
|
||
### to\_matrix
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.to_matrix" signature="to_matrix()">
|
||
Convert operator to Numpy matrix.
|
||
</Function>
|
||
|
||
### to\_operator
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.to_operator" signature="to_operator()">
|
||
Convert to an Operator object.
|
||
</Function>
|
||
|
||
### transpose
|
||
|
||
<Function id="qiskit.ignis.verification.CNOTDihedral.transpose" signature="transpose()">
|
||
Return the transpose of the CNOT-Dihedral element.
|
||
</Function>
|
||
</Class>
|
||
|