Multiply two hermitian or symmetric matrices

Hello, is there a specialized mul method in julia that can multiply efficiently Hermitian or symmetric matrices without them being of the Hermitian or Symmetric type ?

Why do you wish to avoid wrapping them? That is the very mechanism through which Julia recognizes this type of matrix and can choose the fastest algorithm.

3 Likes

I guess i should. Is there any overhead?

there is zero overhead(*)

(*)

provided that the compiler can figure out whether the matrix is wrapped or not. If, hypothetically, you generate a matrix and then check whether it is hermitian, symmetric or not and then wrap depending on the outcome there may be a little performance overhead. This can probably be avoided. I guess in many cases you will know beforehand if the matrix will be symmetric or hermitian. If not you can use function barriers which will probably make the overhead negligible

Thanks