# NOT RUN {
contract(as.kform(1:5),1:8)
contract(as.kform(1),3) # 0-form
## Now some verification:
o <- rform(2,k=5,n=9,coeffs=runif(2))
V <- matrix(rnorm(45),ncol=5)
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]))(V[,-(1:4),drop=FALSE]),
as.function(contract(o,V[,1:5],lose=FALSE))(V[,-(1:5),drop=FALSE])
)
max(jj) - min(jj) # zero to numerical precision
# }
Run the code above in your browser using DataCamp Workspace