contract(as.kform(1:5),1:8)
contract(as.kform(1),3) # 0-form
contract_elementary(c(1,2,5),c(1,2,10,11,71))
## Now some verification [takes ~10s to run]:
#o <- kform(spray(t(replicate(2, sample(9,4))), runif(2)))
#V <- matrix(rnorm(36),ncol=4)
#jj <- c(
# as.function(o)(V),
# as.function(contract(o,V[,1,drop=TRUE]))(V[,-1]), # scalar
# as.function(contract(o,V[,1:2]))(V[,-(1:2),drop=FALSE]),
# as.function(contract(o,V[,1:3]))(V[,-(1:3),drop=FALSE]),
# as.function(contract(o,V[,1:4],lose=FALSE))(V[,-(1:4),drop=FALSE])
#)
#print(jj)
#max(jj) - min(jj) # zero to numerical precision
Run the code above in your browser using DataLab