matrix_props.mutual_coherence¶
Computes the mutual coherence for a list of 1D numpy arrays.
Functions¶
|
Calculate the mutual coherence of a collection of input vectors. |
Module Contents¶
- matrix_props.mutual_coherence.mutual_coherence(vectors)¶
Calculate the mutual coherence of a collection of input vectors.
The mutual coherence of a collection of input vectors is defined as the maximum absolute value of the inner product between any two distinct vectors, divided by the product of their norms [1]. It provides a measure of how similar the vectors are to each other.
Examples
import numpy as np from toqito.matrix_props.mutual_coherence import mutual_coherence example_A = [np.array([1, 0]), np.array([0, 1])] print("Result for example_A = ",mutual_coherence(example_A)) # An example with a larger set of vectors example_B = [np.array([1, 0, 1]), np.array([0, 1, 1]), np.array([1, 1, 0])] print("Result for example_B = ",mutual_coherence(example_B))
Result for example_A = 0.0 Result for example_B = 0.4999999999999999
References
- Parameters:
vectors (list[numpy.ndarray]) – A list of 1D numpy arrays.
- Raises:
ValueError – If arrays in list are not 1D.
TypeError – If input is not a list.
- Returns:
The mutual coherence of the collection of input vectors.
- Return type:
float