Scalar
Literal ¶
Bases: Real
value instance-attribute
¶
Scalar Literal, which stores a decimaal value instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value | Decimal | decimal value instance | required |
Scalar ¶
Base class for all scalar expressions.
<scalar> ::= <literal>
| <variable>
| <default>
| <negative>
| <add>
| <mul>
| <min>
| <max>
| <slice>
| <inverval>
<mul> ::= <scalar> '*' <scalar>
<add> ::= <scalar> '+' <scalar>
<min> ::= 'min' <scalar>+
<max> ::= 'max' <scalar>+
<slice> ::= <scalar expr> '[' <interval> ']'
<interval> ::= <scalar expr> '..' <scalar expr>
<real> ::= <literal> | <var>
Variable ¶
Bases: Real
Variable, which stores a variable name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | variable instance. | required |
cast ¶
-
cast Real number (or list/tuple of Real numbers) to
Scalar Literal
. -
cast str (or list/tuple of Real numbers) to
Scalar Variable
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py | Union[str, Real, Tuple[Real], List[Real]] | python object to cast | required |
Returns:
Type | Description |
---|---|
Scalar | Scalar |
Source code in src/bloqade/ir/scalar.py
var ¶
cast string (or list/tuple of strings) to Variable
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py | Union[str, List[str]] | a string or list/tuple of strings | required |
Returns:
Type | Description |
---|---|
Variable | Union[Variable] |