cuquantum.custatevec.compute_expectation(intptr_t handle, intptr_t sv, int sv_data_type, uint32_t n_index_bits, intptr_t expect, int expect_data_type, intptr_t matrix, int matrix_data_type, int layout, basis_bits, uint32_t n_basis_bits, int compute_type, intptr_t workspace, size_t workspace_size)[source]

Compute the expectation value of the given matrix with respect to the statevector.

  • 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.

  • expect (intptr_t) – The pointer address (as Python int) for storing the expectation value (on host).

  • expect_data_type (cuquantum.cudaDataType) – The data type of expect.

  • matrix (intptr_t) – The pointer address (as Python int) to a matrix (on either host or device).

  • matrix_data_type (cuquantum.cudaDataType) – The data type of the matrix.

  • layout (MatrixLayout) – The memory layout the the matrix.

  • basis_bits

    A host array of basis index bits. It can be

    • an int as the pointer address to the array

    • a Python sequence of basis bits

  • n_basis_bits (uint32_t) – The length of basis_bits.

  • compute_type (cuquantum.ComputeType) – The compute type of matrix multiplication.

  • workspace (intptr_t) – The pointer address (as Python int) to the workspace (on device).

  • workspace_size (size_t) – The workspace size (in bytes).