Reputation: 13
Consider A an nxn matrix. its not a special matrix and in the worst case all of its entries are non-zero. I am looking for a way to compute AA^T using matrix-vector operation. The total number of flops are (2n-1)*(n(n+1))/2 because all I have to do for a symmetric matrix like C=AA^T is to compute the diagonal entires which are C(i,i)=A(i,:)^T * A(i,:). What I want now is to compute the lower triangular part and then when I am done I just say that the upper triangular part is the same as the lower triangular part. The problem is can I do it in matrix-vector multiplication or will it force me to perform unnecessary multiplication (like multiplying elements in the upper part)? It is clear that a scalar computation would work but I am interested to know if a matrix-vector computation would work or not.
Upvotes: 1
Views: 97
Reputation: 2636
MATLAB is already smart enough to do this for you. When MATLAB encounters an expression like A*A.', it will recognize that the two operands are the same and will call a symmetric BLAS library function in the background to do the calculation. This symmetric function does exactly what you want ... only does about 1/2 the operations and generates an exact symmetric result.
Upvotes: 1