canonical_gate
CanonicalAxis
Bases: BaseAxis
Source code in opensquirrel/ir/semantics/canonical_gate.py
accept
parse
staticmethod
Parse and validate an AxisLike.
Checks if the axis can be cast to a 1DArray of length 3, raise an error otherwise. After casting to an array, the elements of the canonical axis are restricted to the Weyl chamber.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
AxisLike
|
Axis to validate and parse. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Parsed axis to 1DArray of length 3. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the axis cannot be cast to an ArrayLike. |
ValueError
|
If the axis cannot be flattened to length 3. |
Source code in opensquirrel/ir/semantics/canonical_gate.py
restrict_to_weyl_chamber
staticmethod
Restricts the given axis to the Weyl chamber.
The six rules that are (implicitly) used are:
- The canonical parameters are periodic with a period of 2 (neglecting a global phase).
- \(\text{Can}(t_x, t_y, t_z)\sim\text{Can}(t_x - 1, t_y, t_z)\) (for any parameter)
- \(\text{Can}(t_x, t_y, t_z)\sim\text{Can}(t_x, -t_y, -t_z)\) (for any pair of parameters)
- \(\text{Can}(t_x, t_y, t_z)\sim\text{Can}(t_y, t_x, t_z)\) (for any pair of parameters)
- \(\text{Can}(t_x, t_y, 0)\sim\text{Can}(1 - t_x, t_y, 0)\)
- \(\text{Can}(t_x, t_y, t_z) * \text{Can}(t_x', t_y', t_z') = \text{Can}(t_x + t_x', t_y + t_y', t_z + t_z')\)
Note
Based on the rules described in Quantum Gates by G.E. Crooks (2024), Section 5.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
NDArray[float64]
|
Axis to restrict to the Weyl chamber. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Axis restricted to the Weyl chamber. |
Source code in opensquirrel/ir/semantics/canonical_gate.py
CanonicalGateSemantic
Bases: GateSemantic
Source code in opensquirrel/ir/semantics/canonical_gate.py
accept
is_identity
Checks if the canonical gate semantic represents an identity operation.
Returns:
| Type | Description |
|---|---|
bool
|
True if the canonical gate semantic represents an identity operation, False otherwise. |