x1 = matrix(rnorm(16), nrow = 4)
x2 = matrix(rnorm(25), nrow = 5)
x3 = matrix(rnorm(36), nrow = 6)
x4 = matrix(rnorm(49), nrow = 7)
p1 = x1 %x% x2 %x% x3 %x% x4
p2 = kronecker.seq(list(x1, x2, x3, x4))
all.equal(p1, p2)
Run the code above in your browser using DataLab