Utils
check_circuit
check_circuit(
squin_method: Method[[], None],
other_squin_method: Method[[], None],
atol: float = 1e-05,
rtol: float = 1e-08,
) -> bool
Check if two squin methods are equivalent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
squin_method
|
Method[[], None]
|
The first squin method. This method should not take any arguments and return None. |
required |
other_squin_method
|
Method[[], None]
|
The second squin method. This method should not take any arguments and return None. |
required |
atol
|
float
|
Absolute tolerance for state vector comparison. Defaults to 1.0e-5. |
1e-05
|
rtol
|
float
|
Relative tolerance for state vector comparison. Defaults to 1 |
1e-08
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the methods are equivalent, False otherwise. |
Note
The methods should not perform any measurements. Otherwise, the state vectors may not be comparable.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
no_none_elements
no_none_elements(
xs: Sequence[T | None],
) -> TypeGuard[Sequence[T]]
Check that there are no None elements in the sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
Sequence[T | None]
|
A sequence that may contain None elements. |
required |
Returns:
| Type | Description |
|---|---|
TypeGuard[Sequence[T]]
|
A TypeGuard indicating that all elements are not None. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/utils.py
9 10 11 12 13 14 15 16 17 18 19 | |
no_none_elements_tuple
no_none_elements_tuple(
xs: tuple[T | None, ...],
) -> TypeGuard[tuple[T, ...]]
Check that there are no None elements in the tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
tuple[T | None, ...]
|
A tuple that may contain None elements. |
required |
Returns:
| Type | Description |
|---|---|
TypeGuard[tuple[T, ...]]
|
A TypeGuard indicating that all elements are not None. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/utils.py
22 23 24 25 26 27 28 29 30 31 32 | |