get_statetensor_to_expectation_func
- qujax.get_statetensor_to_expectation_func(hermitian_seq_seq, qubits_seq_seq, coefficients)
Takes strings (or arrays) representing Hermitian matrices, along with qubit indices and a list of coefficients and returns a function that converts a statetensor into an expected value.
- Parameters:
hermitian_seq_seq (Sequence[Sequence[str | ndarray]]) – Sequence of sequences of Hermitian matrices/tensors. Each Hermitian matrix is either represented by a tensor (jnp.ndarray) or by a list of ‘X’, ‘Y’ or ‘Z’ characters corresponding to the standard Pauli matrices. E.g. [[‘Z’, ‘Z’], [‘X’]]
qubits_seq_seq (Sequence[Sequence[int]]) – Sequence of sequences of integer qubit indices. E.g. [[0,1], [2]]
coefficients (Sequence[float] | ndarray) – Sequence of float coefficients to scale the expected values.
- Returns:
Function that takes statetensor and returns expected value (float).
- Return type:
Callable[[ndarray], float]