measure_on_z_basis#

cuquantum.bindings.custatevec.measure_on_z_basis(
intptr_t handle,
intptr_t sv,
int sv_data_type,
uint32_t n_index_bits,
basis_bits,
uint32_t n_basis_bits,
double randnum,
int collapse,
) int32_t[source]#

Measurement on a given Z-product basis.

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

  • sv (intptr_t) – state vector.

  • sv_data_type (int) – data type of state vector.

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

  • basis_bits (object) –

    pointer to a host array of Z basis bits. It can be:

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

    • a Python sequence of int32_t.

  • n_basis_bits (uint32_t) – the number of Z basis bits.

  • randnum (double) – random number, [0, 1).

  • collapse (CollapseOp) – Collapse operation.

Returns:

parity, 0 or 1.

Return type:

int32_t