# NOT RUN {
## generate a dataset with two types of Grassmann elements
# group1 : first four columns of (8x8) identity matrix + noise
# group2 : last four columns of (8x8) identity matrix + noise
mydata1 = list()
mydata2 = list()
sdval = 0.25
diag8 = diag(8)
for (i in 1:10){
mydata1[[i]] = qr.Q(qr(diag8[,1:4] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}
for (i in 1:10){
mydata2[[i]] = qr.Q(qr(diag8[,5:8] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}
# }
# NOT RUN {
## compute and visualize distances for all types
# we will iterate over all measures
alltypes = c("intrinsic","extrinsic","asimov","binetcauchy",
"chordal","fubinistudy","martin","procrustes","projection","spectral")
ntypes = length(alltypes)
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,5), pty="s")
for (i in 1:ntypes){
dmat = gr.pdist2(mydata1, mydata2, type=alltypes[i])
image(dmat, main=alltypes[i])
}
par(opar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace