toqito
toqito copied to clipboard
Feature: Compute mutual overlaps of vectors or density matrices
It would be helpful to have a function that provides the mutual overlaps (inner products) of a list of numpy arrays (representing vectors of quantum states).
Something like the following:
def compute_overlaps(vectors: list[np.ndarray]) -> list[np.ndarray]:
"""Returns list of all overlaps such that i != j."""
inner_products = []
for i in range(len(vectors)):
for j in range(i + 1, len(vectors)):
inner_products.append(np.vdot(vectors[i], vectors[j]))
return inner_products
In addition, we can refactor is_mutually_orthogonal.py to use this function as there is going to be a good amount of redundancy between these functions as is.
The function should also include proper documentation, examples, and tests.