## dimensions
n <- c(6,5,3)
m <- c(4,7,2)
## make random matrices
A <- lapply(seq_along(n),
function(i) Matrix(rnorm(m[i]*n[i]),m[i],n[i]))
x <- rnorm(prod(n)) # make random x
b1 <- klin.klist(A) %*% x # brute force way
b2 <- klin.eval(A, x) # using klin.eval
range(b1-b2) # should be small
Run the code above in your browser using DataLab