# Efficient method to find consecutive products in table

Suppose I have a table of matrices, $$[A,B,C,D,...,Z]$$ and a vector $$v$$. I would like to efficiently compute both $$ABCD...Zv$$ and the table $$[A,AB,ABC,ABCD,...,ABCD....Z]$$.

I know that to compute the product of the entire table I can do something like

Dot@@table


But how can I efficiently find the products of different length? I would like to avoid loops and explicitly limiting lengths in a table if possible, for speed.

The matrices themselves will be quite large, $$\sim400 \times 400$$, always square, and have complex values inside them.

• Looks like something FoldList[] was built for: FoldList[Dot, {A, B, C}]. Just multiply the last in the series with your vector afterwards. – J. M. is away Mar 10 at 15:03
• Thanks, this helped! And what about if I wanted to compute the table $[Av,ABv,ABCv,...]$? – Spherical Cow Mar 10 at 15:48
• You could just Map[] #.v & into your list of matrices. However, if the question is how to generate that list of vectors without keeping those intermediate matrices around, that is a little more interesting. – J. M. is away Mar 10 at 16:06