The more efficient way to compute XSX^T and XSy
The more efficient way to compute XSX^T and XSy I need to compute the following matrices: M = XSX^T and V = XSy what I'd like to know is the more efficient implementation using blas, knowing that S is a symmetric and definite positive matrix of dimension n, X has m rows and n columns while y is a vector of length n. My implementation is the following: I compute A = XS using dsymm and then with dgemm is obtained M=AX^T while dgemv is used to obtain V=Ay. I think that at least M can be computed in a more efficient way since I know that M is symmetric and definite positive. 2 Answers 2 Your code is the best BLAS can do for you. There is no BLAS operation, that can exploit the fact that M is symmetric. You are right though you'd technically only need to compute the upper diagonal part of the gemm product and then copy the strictly upper diagonal part to the lower diagonal part. But there is ...