|
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i6j1os$5bl$1@fred.mathworks.com>...
> Paul Wiggins <pawiggins@gmail.com> wrote in message <146182958.83257.1284308199566.JavaMail.root@gallium.mathforum.org>...
> > Hi Guys,
> >
> > I'm struggling to vectorize the expression:
> >
> > E_i = \Sum_{jk} I_{ij} A_{jk} I_{ik}
> >
> > Clearly
> >
> > E = diag(I*A*I') would work but the i dim is really large so it seems like this would be significantly less than optimal.
> >
> > Thanks,
> >
> > Paul
> - - - - - - - -
> Ei = I(i,:)*A*I(i,:).'
>
> Roger Stafford
- - - - - - -
I didn't fully comprehend what you were asking. Apparently you want the full E vector, not just a single component of it at index i. Do this instead:
E = sum((I*A).*I,2);
(I assume that I does not denote the identity matrix.)
Roger Stafford
|