expression
Axis
Bases: Sequence[float64]
, Expression
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
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
value
property
writable
The Axis
data saved as a 1D-Array with 3 elements.
__array__(dtype=None, *, copy=None)
__eq__(other)
Check if self
is equal to other
.
Two Axis
objects are considered equal if their axes are equal.
Source code in opensquirrel/ir/expression.py
__getitem__(index)
__init__(*axis)
Init of the Axis
object.
axis: An AxisLike
to create the axis from.
Source code in opensquirrel/ir/expression.py
__len__()
__repr__()
accept(visitor)
normalize(axis)
staticmethod
Normalize a NDArray.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axis
|
NDArray[float64]
|
NDArray to normalize. |
required |
Returns:
Type | Description |
---|---|
NDArray[float64]
|
Normalized NDArray. |
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
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 |