Skip to content

Commit

Permalink
implement backend.calculate_overlap_density_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Oct 12, 2023
1 parent 51233c2 commit 8be795f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/qibo/backends/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,9 @@ def calculate_overlap(self, state1, state2):
return self.np.abs(self.np.sum(self.np.conj(state1) * state2))

def calculate_overlap_density_matrix(self, state1, state2):
raise_error(NotImplementedError)
state1 = self.cast(state1)
state2 = self.cast(state2)
return self.np.trace(self.np.transpose(self.np.conj(state1)) @ state2)

def calculate_eigenvalues(self, matrix, k=6):
if self.issparse(matrix):
Expand Down

0 comments on commit 8be795f

Please sign in to comment.