Inspired from this question fast large matrix multiplication in R, I am wondering if I could use crossprod on three or more matrices. I am trying to calculate a general list which contains the cross products of several lists of matrices with Map(crossprod,listA,listB)
. I tried Map(crossprod,listA,listB,listC)
but got the crossproducts for listA and listB's element matrices only. Lists A, B, C have the same number of matrices. All the matrices are of the same dimension. My current fix is
result1<-Map(crossprod,listA,listB)
Map(crossprod,result1,listC)
How do I do a one-line code? Thank you very much!