cuquantum.custatevec.abs2sum_on_z_basis

cuquantum.custatevec.abs2sum_on_z_basis(intptr_t handle, intptr_t sv, int sv_data_type, uint32_t n_index_bits, bool get_parity0, bool get_parity1, basis_bits, uint32_t n_basis_bits) tuple[source]

Calculates the sum of squared absolute values on a given Z product basis.

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.

  • get_parity0 (bool) – Whether to compute the sum of squared absolute values for parity 0.

  • get_parity1 (bool) – Whether to compute the sum of squared absolute values for parity 1.

  • basis_bits

    A host array of Z-basis index bits. It can be

    • an int as the pointer address to the array

    • a Python sequence of index bits

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

Returns

A 2-tuple of the calculated sums for partiy 0 and 1, respectively. If the corresponding bool is set to False, None is returned.

Return type

tuple