; test of matrix related functions (not very thorough) (setf eps 1.e-7 xmat (transpose (matrix '(4 6) (iseq 1 24))) xmat2 (permute-array xmat '(1 0))) (check #'= (array-dimension (matrix '(4 1) (iseq 1 4)) 0) 4) (check #'= (aref xmat2 0 1) (aref xmat 1 0)) (check #'= (mapcar #'mean (column-list xmat)) (mapcar #'mean (row-list xmat2))) (check #'= (bind-columns (iseq 1 3) (iseq 4 6)) (bind-rows '(1 4) '(2 5) '(3 6))) (check #'= (mapcar #'(lambda (x y) (select xmat x y)) '(0 1 2 3) '(0 1 2 3)) (diagonal xmat)) (check #'= xmat (transpose xmat2)) #| ymat matrix(seq(0.1,18),nrow=6) # ray cancor(xmat,ymat)$cor!=1 # ray begins sum(hat(longley.x,F))==dim(longley.x)[2] all(l1fit(matrix(rnorm(24),nrow=6),(iseq 1 6))$coef!=0) all(leaps(matrix(rnorm(24),nrow=6),(iseq 1 6))$Cp!=0) sum(ls.summary(ls.out_lsfit(matrix(runif(18),nrow=6),(iseq 1 6),int=F))$hat)-3 < eps all(qr.coef(ls.out$qr,(iseq 1 6))!=0) all(qr.fitted(ls.out$qr,(iseq 1 6))+qr.resid(ls.out$qr,(iseq 1 6))+qr.qty(ls.out$qr,(iseq 1 6))+qr.qy(ls.out$qr,(iseq 1 6))!=0) all(apply(scale(ymat),2,"var")-1=1&&max(s2)<=10&&length(s2)==20) all(min(s3)>=1&&max(s3)<=10000&&length(s3)==10) |#