Skip to main content
<!— cspell:ignore cudaq —> Classiq to 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.

Functions

qprog_to_cudaq_kernel

qprog_to_cudaq_kernel(
quantum_program: QuantumProgram,
is_main_kernel: bool = True
) -> cudaq.PyKernel | tuple
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: Returns:
  • Type: 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

pauli_operator_to_cudaq_spin_op(
operator: SparsePauliOp
) -> cudaq.SpinOperator
Transforms Qmod’s SparsePauliOp data structure to CUDA-Q’s SpinOperator. Parameters: Returns:
  • Type: cudaq.SpinOperator
  • The equivalent operator in CUDA-Q’s data structure

parse_cudaq_result

parse_cudaq_result(
qprog: QuantumProgram,
counts: Mapping[str, int]
) -> pd.DataFrame
Parse a CUDA-Q sampling histogram into typed Qmod output registers. Parameters: Returns:
  • Type: pd.DataFrame
  • A pandas.DataFrame identical to the one returned by
  • classiq.sample: one column per main output plus counts,
  • probability and bitstring.