I have a 2x2
matrix that I want to multiply by itself 10 times while storing the result after each multiplication. This can easily be done with a for
loop but I would like to vectorize it an eliminate the for
loop. My approach was to have my 2x2 matrix a
and raise it to a vector b
with elements 1:10
. The answer should be a 2x2x10
matrix that replicates typing
a^b(1)
a^b(2)
.
.
.
a^b(10)
To clarify I'm not doing this element wise I need actual matrix multiplication, and prefer not to use a for
loop. Thanks for any help you can give me.