BIB-VERSION:: CS-TR-v2.0 ID:: STAN//CS-TR-71-225 ENTRY:: November 01, 1995 ORGANIZATION:: Stanford University, Department of Computer Science TITLE:: Numerical methods for computing angles between linear subspaces TYPE:: Technical Report AUTHOR:: Bjoerck, Ake AUTHOR:: Golub, Gene H. DATE:: July 1971 PAGES:: 33 ABSTRACT:: Assume that two subspaces F and G of unitary space are defined as the ranges (or nullspaces) of given rectangular matrices A and B. Accurate numerical methods are developed for computing the principal angles $\theta_k (F,G)$ and orthogonal sets of principal vectors $u_k\ \epsilon\ F$ and $v_k\ \epsilon\ G$, k = 1,2,..., q = dim(G) $\leq$ dim(F). An important application in statistics is computing the canonical correlations $\sigma_k\ = cos \theta_k$ between two sets of variates. A perturbation analysis shows that the condition number for $\theta_k$ essentially is max($\kappa (A),\kappa (B)$), where $\kappa$ denotes the condition number of a matrix. The algorithms are based on a preliminary QR-factorization of A and B (or $A^H$ and $B^H$), for which either the method of Householder transformations (HT) or the modified Gram-Schmidt method (MGS) is used. Then cos $\theta_k$ and sin $\theta_k$ are computed as the singular values of certain related matrices. Experimental results are given, which indicates that MGS gives $\theta_k$ with equal precision and fewer arithmetic operations than HT. However, HT gives principal vectors, which are orthogonal to working accuracy, which is not in general true for MGS. Finally the case when A and/or B are rank deficient is discussed. NOTES:: [Adminitrivia V1/Prg/19951101] END:: STAN//CS-TR-71-225