compute_expectation#

cuquantum.bindings.custatevecEx.compute_expectation(
intptr_t state_vector,
intptr_t expectation_values,
intptr_t matrices,
int matrix_data_type,
int layout,
int32_t num_matrices,
basis_wires,
int32_t num_basis_wires,
)[source]#

Compute expectation values for a batch of matrix observables.

Parameters:
  • state_vector (intptr_t) – state vector instance.

  • expectation_values (intptr_t) – pointer to a host array to store expectation values.

  • matrices (intptr_t) – pointer to a buffer that holds matrix observables.

  • matrix_data_type (int) – data type of matrices.

  • layout (int) – enumerator specifying the memory layout of matrices.

  • num_matrices (int32_t) – the number of matrix observables.

  • basis_wires (object) –

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

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

    • a Python sequence of int32_t.

  • num_basis_wires (int32_t) – the number of basis wires.