Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

subspace

Angle between two subspaces


Description

Finds the angle between two subspaces.

Usage

subspace(A, B)

Arguments

A, B

Numeric matrices; vectors will be considered as column vectors. These matrices must have the same number or rows.

Details

Finds the angle between two subspaces specified by the columns of A and B.

Value

An angle in radians.

Note

It is not necessary that two subspaces be the same size in order to find the angle between them. Geometrically, this is the angle between two hyperplanes embedded in a higher dimensional space.

References

Strang, G. (1998). Introduction to Linear Algebra. Wellesley-Cambridge Press.

See Also

Examples

180 * subspace(c(1, 2), c(2, 1)) / pi  #=> 36.87
180 * subspace(c(0, 1), c(1, 2)) / pi  #=> 26.565

H <- 
hadamard(8)
A <- H[, 2:4]
B <- H[, 5:8]
subspace(A, B)    #=> 1.5708 or pi/2, i.e. A and B are orthogonal

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.