cuquantum.custatevec.sampler_create

cuquantum.custatevec.sampler_create(intptr_t handle, intptr_t sv, int sv_data_type, uint32_t n_index_bits, uint32_t n_max_shots) tuple

Create a sampler descriptor.

Parameters
  • handle (intptr_t) – The library handle.

  • sv (intptr_t) – The pointer address (as Python int) to the statevector (on device).

  • sv_data_type (cuquantum.cudaDataType) – The data type of the statevector.

  • n_index_bits (uint32_t) – The number of index bits.

  • n_max_shots (uint32_t) – The maximal number of shots that will be performed using this sampler.

Returns

A 2-tuple. The first element is the pointer address (as Python int) to the sampler descriptor, and the second element is the amount of required workspace size (in bytes).

Return type

tuple

Note

Unlike its C counterpart, the returned sampler descriptor must be explicitly cleaned up using sampler_destroy() when the work is done.