two_qubit_gate
TwoQubitGate
Bases: Gate
Source code in opensquirrel/ir/two_qubit_gate.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
accept
Accepts visitor and processes this IR node.
is_identity
Checks if the two-qubit gate is an identity gate.
Returns:
| Type | Description |
|---|---|
bool
|
True if the two-qubit gate is an identity gate, False otherwise. |
Source code in opensquirrel/ir/two_qubit_gate.py
try_match_replace_with_default_two_qubit_gate
Tries to match a given two-qubit gate with a default two-qubit gate. It does that by checking if the two-qubit gates matches one of the default two-qubit gates.
Note
- The default (two-qubit) gates are defined in the cQASM standard gate set.
- If no specific match is found, the input gate is returned unmodified.
- The parameterized two-qubit gates (e.g., CR, CRk) are not included in the default two-qubit gate set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gate
|
TwoQubitGate
|
The two-qubit gate to be matched. |
required |
Returns:
| Type | Description |
|---|---|
TwoQubitGate
|
A default two-qubit gate if this two-qubit gate matches it, otherwise return the input gate. |