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)[源代码]

从状态向量中采样比特串。

参数
  • handle (intptr_t) – cuStateVec 库的句柄。

  • sampler (intptr_t) – 采样器描述符。

  • bit_strings (intptr_t) – 指向主机数组的指针,用于存储采样的比特串。

  • bit_ordering (object) –

    指向主机数组的指针,用于采样的比特顺序。它可以是

    • 指向数组的指针地址的 int,或

    • int32_t 的 Python 序列。

  • bit_string_len (uint32_t) – 比特顺序中的比特数。

  • randnums (object) –

    指向随机数数组的指针。它可以是

    • 指向数组的指针地址的 int,或

    • double 的 Python 序列。

  • n_shots (uint32_t) – 采样次数。

  • output (SamplerOutput) – 采样比特串的顺序。