i have a problem where I need to do the following operation:
R is a square matrix
V is a nonsquare matrix
The operation is to multiply 1 - V(i, :)*inv( R )*V(i, :)', and store the result for each i.
Right now I'm doing it using a for loop:
Rinv = inv( R );
val(i) = 1 - Z(i, :)*Rinv*Z(i, :)';
My problem requires performing this calculation a few million times and I'm trying to optimize it as much as possible. Is there a way to get rid of the for loop? I could do V*inv( R )*V', but that performs a lot more inner products than I actually need.
Thanks for the help.