View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 2 ratings Rate this file 7 Downloads (last 30 days) File Size: 4.38 KB File ID: #55 Version: 1.2




20 Sep 2000 (Updated )

Angles between subspaces. Canonical correlations.

| Watch this File

File Information

subspacea(F,G,A) Finds all min(size(orth(F),2),size(orth(G),2)) principal angles between two subspaces spanned by the columns of matrices F and G in the A-based scalar product x'*A*y, where A is Hermitian and positive definite. COS of principal angles is called canonical correlations in statistics.
[theta,U,V] = subspacea(F,G,A) also computes left and right
principal (canonical) vectors - columns of U and V, respectively.

If F and G are vectors of unit length and A=I, the angle is ACOS(F'*G) in exact arithmetic. If A is not provided as a third argument, than A=I and the function gives the same largest angle as SUBSPACE.m by Andrew Knyazev. MATLAB's SUBSPACE.m function is still badly designed and fails to compute some angles accurately.

The algorithm is described in A. V. Knyazev and M. E. Argentati, Principal Angles between Subspaces in an A-Based Scalar Product: Algorithms and Perturbation Estimates. SIAM J. Scientific Computing, 23 (2002), no. 6, 2009-2041.


Subspace.M and Ortha.M inspired this file.

This file inspired Subspace.M.

Required Products MATLAB
MATLAB release MATLAB 5.2 (R10)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
13 Jul 2010 Ken Crounse

20 Jun 2005 jeff arndt

05 Oct 2001

new revision

19 May 2009 1.1

License update to free software (BSD). Comments update.

24 Jul 2011 1.2

Updated description.

15 May 2015 1.2

added a conversion to a toolbox

Contact us