inst/tinytest/testProd.R

#Check that Q*R is equal to the original matrix

#Square matrix
A<-matrix(sample(-100:100, size = 49, replace = TRUE),7,7)

expect_equal(QR(A)$Q%*%QR(A)$R,A)



#(m x n) matrix with m > n.

B<-matrix(sample(-100:100, size = 35, replace = TRUE),7,5)

expect_equal(QR(B)$Q%*%QR(B)$R,B)



#(m x n) matrix with m < n

C<-matrix(sample(-100:100, size = 35, replace = TRUE),5,7)

expect_equal(QR(C)$Q%*%QR(C)$R,C)

Try the QR package in your browser

Any scripts or data that you put into this service are public.

QR documentation built on July 17, 2022, 5:05 p.m.