bsr
BlochSphereRotation
Bases: GateSemantic, IRNode
Source code in opensquirrel/ir/semantics/bsr.py
__mul__
Computes the Bloch sphere rotation resulting from the multiplication of two Bloch sphere
rotations. Note that the multiplication of Bloch sphere rotations A * B corrensponds to
linear operation \(B \cdot A\).
Notes
- It is checked whether the result is a known gate.
- Uses Rodrigues' rotation formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
BlochSphereRotation
|
The second Bloch sphere rotation to multiply with. |
required |
Returns:
| Type | Description |
|---|---|
BlochSphereRotation
|
The resulting Bloch sphere rotation. |
Source code in opensquirrel/ir/semantics/bsr.py
accept
is_identity
Checks if the Bloch sphere rotation represents an identity operation.
Returns:
| Type | Description |
|---|---|
bool
|
True if the Bloch sphere rotation represents an identity operation, False otherwise. |
Source code in opensquirrel/ir/semantics/bsr.py
BsrAngleParam
Bases: BlochSphereRotation
Source code in opensquirrel/ir/semantics/bsr.py
accept
Accepts visitor and processes this IR node.
BsrFullParams
Bases: BlochSphereRotation
Source code in opensquirrel/ir/semantics/bsr.py
accept
Accepts visitor and processes this IR node.
BsrNoParams
Bases: BlochSphereRotation
Source code in opensquirrel/ir/semantics/bsr.py
accept
Accepts visitor and processes this IR node.
BsrUnitaryParams
Bases: BlochSphereRotation
Source code in opensquirrel/ir/semantics/bsr.py
accept
Accepts visitor and processes this IR node.
get_bsr
staticmethod
Generates the corresponding Bloch sphere rotation from the given Euler angles, \(\theta\), \(\phi\), and \(\lambda\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
SupportsFloat
|
The Euler angle \(\theta\). |
required |
phi
|
SupportsFloat
|
The Euler angle \(\phi\). |
required |
lmbda
|
SupportsFloat
|
The Euler angle \(\lambda\). |
required |
Returns:
| Type | Description |
|---|---|
BlochSphereRotation
|
The corresponding Bloch sphere rotation. |
Source code in opensquirrel/ir/semantics/bsr.py
bsr_from_matrix
Generates a Bloch sphere rotation from a \(2\times 2\) unitary matrix \(U(2)\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ArrayLike | list[list[int | DTypeLike]]
|
A \(2\times 2\) unitary matrix \(U(2)\). |
required |
Returns:
| Type | Description |
|---|---|
BlochSphereRotation
|
The corresponding Bloch sphere rotation. |