autoqasm.operators.data_structures module
Operators for other data structures (e.g. list).
- class autoqasm.operators.data_structures.ListPopOpts(element_dtype, element_shape)[source]
Bases:
ListPopOptsCreate new instance of ListPopOpts(element_dtype, element_shape)
- class autoqasm.operators.data_structures.ListStackOpts(element_dtype, original_call)[source]
Bases:
ListStackOptsCreate new instance of ListStackOpts(element_dtype, original_call)
- autoqasm.operators.data_structures.list_append(target: list, element: Any) list[source]
The list append function.
- Parameters:
target (list) – An entity that supports append semantics.
element (Any) – The element to append.
- Returns:
list – The resulting list after performing the append.
- autoqasm.operators.data_structures.list_pop(target: list, element: Any, opts: ListPopOpts) tuple[source]
The list pop function.
- Parameters:
target (list) – An entity that supports append semantics.
element (Any) – The element index to pop. If None, pops the last element.
opts (ListPopOpts) – Metadata about the converted pop operation.
- Returns:
tuple – The resulting list after performing the pop, and the popped item.
- autoqasm.operators.data_structures.list_stack(target: list, opts: ListStackOpts) list[source]
The list stack function.
- Parameters:
target (list) – An entity that supports stack semantics.
opts (ListStackOpts) – Metadata about the converted stack operation.
- Returns:
list – The stacked list.
- autoqasm.operators.data_structures.new_list(iterable: Iterable | None = None) list[source]
The list constructor.
- Parameters:
iterable (Iterable | None) – Optional elements to fill the list with. Defaults to None.
- Returns:
list – A list-like object. The exact return value depends on the initial elements.