Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pauli string python #7

Merged
merged 10 commits into from
Jul 18, 2024
Prev Previous commit
Next Next commit
Missed weight mutliplication in efficient_sparse_multiply
stand-by committed Jul 12, 2024
commit a4da0474ef0059c9821765574caab87e5153a179
7 changes: 3 additions & 4 deletions benchmarks/pauli_operations.py
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ def efficient_sparse_multiply(self, state: np.ndarray) -> np.ndarray:
cols[0], vals[0] = self.__resolve_init_conditions()

product = np.empty((self.n_vals, state.shape[1]), dtype=np.complex128)
product[0] = vals[0] * state[cols[0]]
product[0] = self.pauli.weight * vals[0] * state[cols[0]]

for l in range(self.n_qubits):
p = self.pauli.string[self.n_qubits - l - 1]
@@ -130,9 +130,8 @@ def efficient_sparse_multiply(self, state: np.ndarray) -> np.ndarray:
cols[new_slice] = cols[old_slice] + pow_of_two
vals[new_slice] = -vals[old_slice]

vals[new_slice] *= self.pauli.weight
product[new_slice] = vals[new_slice, np.newaxis] * state[cols[new_slice]]

product[new_slice] = self.pauli.weight * vals[new_slice, np.newaxis] * state[cols[new_slice]]

return product