> ## Documentation Index
> Fetch the complete documentation index at: https://prod-mint.classiq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Cudaq

\<!-- cspell:ignore cudaq -->

Classiq to [CUDA-Q](https://developer.nvidia.com/cuda-q) translation.
These functions require the `cudaq` extra (install `classiq[cudaq]`).
Note that the `cudaq` extra is only available in Classiq Studio and on any Linux
Machine.

### qprog\_to\_cudaq\_kernel

<pre><code>qprog\_to\_cudaq\_kernel(
quantum\_program: QuantumProgram,
is\_main\_kernel: bool = True
) -> Union\[cudaq.PyKernel, tuple]</code></pre>

Translates a quantum program into a CUDA-Q kernel.

The 'is\_main\_kernel' parameter controls the kind of the returned kernel.
If 'is\_main\_kernel' is True, the returned kernel can be used with CUDA-Q functions
such as 'cudaq.draw()' and 'cudaq.get\_state()', but it cannot be added to another
kernel via \`apply\_call()'.
If 'is\_main\_kernel' is False, the reverse holds: The returned kernel cannot be used
with CUDA-Q functions but can be added to another kernel.

**Parameters:**

| Name              | Type             | Description                                                                                                                                      | Default    |
| ----------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| `quantum_program` | `QuantumProgram` | The quantum program to translate into CUDA-Q kernel. This is the result of the function 'synthesize()'.                                          | *required* |
| `is_main_kernel`  | `bool`           | Whether the kernel is compatible with CUDA-Q functions (`is_main_kernel=True`, the default behavior) or 'apply\_call()' (`is_main_kernel=False`) | True       |

**Returns:**

* **Type:** `Union[cudaq.PyKernel, tuple]`
* A CUDA-Q kernel. If the quantum program includes foreach statements, a tuple
* containing a CUDA-Q kernel and its foreach arguments will be returned.

### pauli\_operator\_to\_cudaq\_spin\_op

<pre><code>pauli\_operator\_to\_cudaq\_spin\_op(
operator: SparsePauliOp
) -> cudaq.SpinOperator</code></pre>

Transforms Qmod's SparsePauliOp data structure to CUDA-Q's SpinOperator.

**Parameters:**

| Name       | Type            | Description                    | Default    |
| ---------- | --------------- | ------------------------------ | ---------- |
| `operator` | `SparsePauliOp` | The operator to be transformed | *required* |

**Returns:**

* **Type:** `cudaq.SpinOperator`
* The equivalent operator in CUDA-Q's data structure
