cuquantum.custatevec.compute_expectation¶
- cuquantum.custatevec.compute_expectation(intptr_t handle, intptr_t sv, int sv_data_type, uint32_t n_index_bits, intptr_t expectation_value, int expectation_data_type, intptr_t matrix, int matrix_data_type, int layout, basis_bits, uint32_t n_basis_bits, int compute_type, intptr_t extra_workspace, size_t extra_workspace_size_in_bytes) double [source]¶
Compute expectation of matrix observable.
- Parameters
handle (intptr_t) – the handle to the cuStateVec library.
sv (intptr_t) – state vector.
sv_data_type (int) – data type of the state vector.
n_index_bits (uint32_t) – the number of index bits of the state vector.
expectation_value (intptr_t) – host pointer to a variable to store an expectation value.
expectation_data_type (int) – data type of expect.
matrix (intptr_t) – observable as matrix.
matrix_data_type (int) – data type of matrix.
layout (MatrixLayout) – matrix memory layout.
basis_bits (object) –
pointer to a host array of basis index bits. It can be:
an
int
as the pointer address to the array, ora Python sequence of
int32_t
.
n_basis_bits (uint32_t) – the number of basis bits.
compute_type (ComputeType) – compute_type of matrix multiplication.
extra_workspace (intptr_t) – pointer to an extra workspace.
extra_workspace_size_in_bytes (size_t) – the size of extra workspace.
- Returns
result of matrix type test.
- Return type
double
See also