Compare column spaces of two matrices

compare_column_space(X1, X2)

Arguments

X1, X2

matrices with the same number of rows

Value

  • -1 : Either C(X1)=C(X2), or the spaces are not nested.

  • 0 : C(X1) is contained in C(X2)

  • 1 : C(X2) is contained in C(X1)

Examples


A1 <- matrix(c(1,1,1,1,2,3), nrow=3)
A2 <- A1[, 1, drop=FALSE]

compare_column_space(A1, A2)
#> [1] 1
compare_column_space(A2, A1)
#> [1] 0
compare_column_space(A1, A1)
#> [1] -1