cuquantum.custatevec.sampler_sample

cuquantum.custatevec.sampler_sample(intptr_t handle, intptr_t sampler, intptr_t bit_strings, bit_ordering, uint32_t bit_string_len, randnums, uint32_t n_shots, int output)[source]

Sample bit strings from the state vector.

Parameters
  • handle (intptr_t) – the handle to the cuStateVec library.

  • sampler (intptr_t) – the sampler descriptor.

  • bit_strings (intptr_t) – pointer to a host array to store sampled bit strings.

  • bit_ordering (object) –

    pointer to a host array of bit ordering for sampling. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int32_t.

  • bit_string_len (uint32_t) – the number of bits in bit_ordering.

  • randnums (object) –

    pointer to an array of random numbers. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of double.

  • n_shots (uint32_t) – the number of shots.

  • output (SamplerOutput) – the order of sampled bit strings.