Utility functions

Utility functions#

spgrep.utils.grassmann_distance(basis1, basis2, ord='min', skip_orthonormalization=False)[source]#

Return Grassmann distance between two linear subspaces spanned by basis1 and basis2.

References * [1] Jihun Hamm and Daniel D. Lee. 2008. Grassmann discriminant analysis: a unifying view on subspace-based learning. In Proceedings of the 25th international conference on Machine learning (ICML ‘08). Association for Computing Machinery, New York, NY, USA, 376–383. https://doi.org/10.1145/1390156.1390204 * [2] Schubert Varieties and Distances between Subspaces of Different Dimensions, Ke Ye and Lek-Heng Lim, SIAM Journal on Matrix Analysis and Applications 2016 37:3, 1176-1197

Parameters:
  • basis1 (array, (k, n)) – k-dimensional subspace in \(\mathbb{C}^{n}\). basis1[i] is the i-th basis vector.

  • basis2 (array, (l, n)) – l-dimensional subspace in \(\mathbb{C}^{n}\). basis2[i] is the i-th basis vector.

  • ord (str) – Kind of Grassmann distance to be calculated * ord='min': Min correlation * ord='projection': Projection metric

  • skip_orthonormalization (bool default=False) – If true, skip to orthonormalize bases.

Returns:

distance

Return type:

float