# Example in the text:
K <- as.kform(matrix(c(1,1,2,3),2,2),c(1,5))
M <- matrix(1:9,3,3)
pullback(K,M)
# Demonstrate that the result can be complicated:
M <- matrix(rnorm(25),5,5)
pullback(as.kform(1:2),M)
# Numerical verification:
o <- volume(3)
o2 <- pullback(pullback(o,M),solve(M))
max(abs(coeffs(o-o2))) # zero to numerical precision
# Following should be zero:
pullback(as.kform(1),M)-as.kform(matrix(1:5),c(crossprod(M,c(1,rep(0,4)))))
# Following should be TRUE:
issmall(pullback(o,crossprod(matrix(rnorm(10),2,5))))
# Some stretch() use-cases:
p <- rform()
p
stretch(p,seq_len(7))
stretch(p,c(1,0,0,1,1,1,1)) # kills dimensions 2 and 3
Run the code above in your browser using DataLab