From 865a0ba1aea1611e5b28e6f3c9b84cebdd2b1d2b Mon Sep 17 00:00:00 2001 From: Wong Zi Cheng <70616433+chmwzc@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:25:22 +0000 Subject: [PATCH] Fix minor bugs --- src/qibochem/measurement/expectation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qibochem/measurement/expectation.py b/src/qibochem/measurement/expectation.py index ccbad2a..02549b9 100644 --- a/src/qibochem/measurement/expectation.py +++ b/src/qibochem/measurement/expectation.py @@ -1,5 +1,6 @@ from functools import reduce +import numpy as np import qibo from qibo import gates from qibo.hamiltonians import SymbolicHamiltonian @@ -73,6 +74,7 @@ def expectation( if n_shots_per_pauli_term: total = sum(pauli_term_sample_expectation(circuit, term, n_shots) for term in hamiltonian.terms) else: + n_terms = len(hamiltonian.terms) # Determine how to allocate n_shots first if shot_distribution == "uniform": # Split evenly amongst all the terms in the Hamiltonian