Skip to main content
This is a list of the path operators available in Qmod for accessing elements and sub-arrays of arrays inside quantum expressions. Functions:

python_value_to_qmod_object

python_value_to_qmod_object(
value: Any,
qmodule: ModelStateContainer
) -> Any
Translate a Python classical value into a QMod object. numpy values are normalized to native Python, and dataclasses (which are always classical structs in QMod) become QmodStructInstances with their declaration registered on qmodule. The result is a QMod object from which both an expression string (via qmod_val_to_expr_str) and a classical type (via infer_classical_type) can be derived. Parameters:

subscript

subscript(
array: list | CArray | np.ndarray,
index: Any
) -> Any
Return the element of array at position index in an expression. This is the expression-level form of the array[index] indexing operator. Parameters:

slice_

slice_(
array: list | CArray | np.ndarray,
start: Any,
stop: Any
) -> Any
Return the array[start:stop] sub-array in an expression. This is the expression-level form of the array[start:stop] slicing operator. Parameters: