I'm having some performance problems with my code dealing with the multiplication of big sparse matrices (stiffness and aerodynamic influence coefficient matrices). Mainly I have to multiply such matrices frequently in my code with each other. Basically, one should of course not multiply sparse matrices but rather use matrix-vector multiplications. However, in my case, I can hardly prevent matrix-matrix multiplications.
Now... I get sparse matrices in CSC, CSR and COO formats as an input. (Not sensible as well, but I cannot influence this interface -.-). Are there rules of the thumb that help me decide which format the matrices in my multiplication should best have to end up with a high(er) performance code?
I know Intel's mkl_dcsrcsc
(multiplies CSR-matrix with CSC-matrix) for example, cannot find a mkl_dcsccsr
(multiplies CSC-matrix with CSR-matrix) on the other hand. Is it, therefore, sensible for $A \cdot B$ to convert $A_\text{CSC}$ from CSC-format into CSR-format $A_\text{CSR}$ and $B_\text{CSR}$ into $B_\text{CSC}$? Might it even be sensible to take a long way and convert $A_\text{CSC}$ to $A_\text{CSR}$ and $B_\text{CSR}$ to $B_\text{COO}$ (in order to enable mkl_dcsrcoo
)?
How can I find out which format I should best use for my matrices and which functions/routines I should best use for my matrix-matrix multiplications?