single_qubit_gate
SingleQubitGate
Bases: Gate
Source code in opensquirrel/ir/single_qubit_gate.py
accept
Accepts visitor and processes this IR node.
is_identity
Checks if the single-qubit gate is an identity gate.
Returns:
| Type | Description |
|---|---|
bool
|
True if the single-qubit gate is an identity gate, False otherwise. |
Source code in opensquirrel/ir/single_qubit_gate.py
try_match_replace_with_default_gate
Tries to match a given single-qubit gate with a default single-qubit gate. It does that by checking if the parameters of the Bloch sphere rotation (BSR) semantic of the input single-qubit gate are close to those of any of the default single-qubit gates.
Note
- The default (single-qubit) gates are defined in the cQASM standard gate set.
- If no specific match is found, the general Rn gate is returned with the same parameters values as those of the input gate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gate
|
SingleQubitGate
|
The single-qubit gate to be matched. |
required |
Returns:
| Type | Description |
|---|---|
SingleQubitGate
|
A default single-qubit gate if this single-qubit gate matches it, the Rn gate otherwise. |