R Under development (unstable) (2023-11-07 r85491 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## > ## s u b s p a c e . r Test suite > ## > > > orth <- pracma::orth > subspace <- pracma::subspace > > is.null(orth(c())) [1] TRUE > M <- matrix(1:12, 3, 4) > all.equal(orth(M), + matrix(c(-0.504533, -0.760776, + -0.574516, -0.057141, + -0.644497, 0.646495), 3, 2, byrow = TRUE), + tolerance = 1e-5) [1] "Mean relative difference: 2" > > H <- pracma::hadamard(8) > A <- H[, 2:4] > B <- H[, 5:8] > all.equal(subspace(A, B), pi/2, tolerance = 1e-10) [1] TRUE > > proc.time() user system elapsed 0.18 0.00 0.17