Asynchronously retrieve the state generated by the given quantum kernel. When targeting a quantum platform with more than one QPU, the optional `qpu_id` allows for control over which QPU to enable. Will return a future whose results can be retrieved via `future.get()`. Args:
(kernel, *args, qpu_id=0)
| 53 | |
| 54 | @trace.traced |
| 55 | def get_state_async(kernel, *args, qpu_id=0): |
| 56 | """ |
| 57 | Asynchronously retrieve the state generated by the given quantum kernel. |
| 58 | When targeting a quantum platform with more than one QPU, the optional |
| 59 | `qpu_id` allows for control over which QPU to enable. Will return a future |
| 60 | whose results can be retrieved via `future.get()`. |
| 61 | |
| 62 | Args: |
| 63 | kernel (:class:`Kernel`): The :class:`Kernel` to execute on the QPU. |
| 64 | *arguments (Optional[Any]): The concrete values to evaluate the kernel |
| 65 | function at. Leave empty if the kernel doesn't accept any arguments. |
| 66 | `qpu_id` (Optional[int]): The optional identification for which QPU |
| 67 | on the platform to target. Defaults to zero. Key-word only. |
| 68 | |
| 69 | Returns: |
| 70 | :class:`AsyncStateResult`: Quantum state data. (state vector or density |
| 71 | matrix) |
| 72 | """ |
| 73 | if isa_kernel_decorator(kernel): |
| 74 | decorator = kernel |
| 75 | else: |
| 76 | decorator = mk_decorator(kernel) |
| 77 | processedArgs, module = decorator.prepare_call(*args) |
| 78 | return cudaq_runtime.get_state_async_impl(decorator.uniqName, module, |
| 79 | qpu_id, *processedArgs) |
| 80 | |
| 81 | |
| 82 | def to_cupy(state, dtype=None): |