expression
Axis
Bases: BaseAxis
The Axis
object parses and stores a vector containing 3 elements.
The input vector is always normalized before it is stored.
Source code in opensquirrel/ir/expression.py
accept(visitor)
parse(axis)
staticmethod
Parse and validate an AxisLike
.
Check if the axis
can be cast to a 1DArray of length 3, raise an error otherwise.
After casting to an array, the axis is normalized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axis
|
AxisLike
|
|
required |
Returns:
Type | Description |
---|---|
NDArray[float64]
|
Parsed axis represented as a 1DArray of length 3. |
Source code in opensquirrel/ir/expression.py
BaseAxis
Bases: Sequence[float64]
, Expression
, ABC
Source code in opensquirrel/ir/expression.py
value
property
writable
The BaseAxis
data saved as a 1D-Array with 3 elements.
__array__(dtype=None, *, copy=None)
__eq__(other)
Check if self
is equal to other
.
Two BaseAxis
objects are considered equal if their axes are equal.
Source code in opensquirrel/ir/expression.py
__getitem__(index)
__init__(*axis)
Init of the BaseAxis
object.
axis: An AxisLike
to create the axis from.
__len__()
Float
dataclass
Bases: Expression
Floats used for intermediate representation of Statement
arguments.
Attributes:
Name | Type | Description |
---|---|---|
value |
float
|
value of the |
Source code in opensquirrel/ir/expression.py
__float__()
Cast the Float
object to a built-in Python float
.
Returns:
Type | Description |
---|---|
float
|
Built-in Python |
__init__(value)
Init of the Float
object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
SupportsFloat
|
value of the |
required |
Source code in opensquirrel/ir/expression.py
Int
dataclass
Bases: Expression
Integers used for intermediate representation of Statement
arguments.
Attributes:
Name | Type | Description |
---|---|---|
value |
int
|
value of the |
Source code in opensquirrel/ir/expression.py
__init__(value)
Init of the Int
object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
SupportsInt
|
value of the |
required |
Source code in opensquirrel/ir/expression.py
__int__()
Cast the Int
object to a built-in Python int
.
Returns:
Type | Description |
---|---|
int
|
Built-in Python |
Qubit
dataclass
Bases: Expression
Qubit
is used for intermediate representation of Statement
arguments.
Attributes:
Name | Type | Description |
---|---|---|
index |
int
|
index of the |
Source code in opensquirrel/ir/expression.py
String
dataclass
Bases: Expression
Strings used for intermediate representation of Statement
arguments.
Attributes:
Name | Type | Description |
---|---|---|
value |
str
|
value of the |
Source code in opensquirrel/ir/expression.py
__init__(value)
Init of the String
object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
SupportsStr
|
value of the |
required |
Source code in opensquirrel/ir/expression.py
__str__()
Cast the String
object to a built-in Python str
.
Returns:
Type | Description |
---|---|
str
|
Built-in Python |