This function computes principal angles between subspaces

angle_AB(A, B)

Arguments

A

matrix whose columns form a basis of a subspace

B

matrix whose columns form a basis of a subspace

Details

The function finds the principal angles between both subspaces

Value

vector of length minimum number of columns of A and B containing the ordered principal angles (in degrees) between the subspaces generated by the columns of A and B

Examples

p=10 AA=as.matrix(cbind(c(1,rep(0,p-1)),c(0,1,rep(0,p-2)))) BB=as.matrix(cbind(c(rep(0,p-1),1),c(rep(0,p-2),1,0),c(0,1,rep(0,p-2)))) angle_AB(AA,BB)
#> [1] 0 90