# Kronecker products and basis contractions (ie. B.A.Transpose[B]) in C?

I have implemented a basis transformation in C of the following form

kron[A,A]*B*Transpose[kron[A,A]]


where A and B are matrices and kron is the Kronecker product.

However, my naive code is not scalable, and I am looking for a library to achieve this. My starting point was to look in BLAS and LAPACK for Kronecker products and basis contractions (ie. B*A*Transpose[B]) but from my reading of the documentation these are not in the standard build, is there an efficient way to achieve this using these packages (in particular the contraction)?

• How large are your matrices? Aug 6 '15 at 19:32
• If $A$ is suitably large, it may make sense to just perform the multiplication block-wise directly with gemm. Aug 6 '15 at 21:28

To the best of my knowledge, you are correct that there is no two-sided matrix multiplication routine $BAB^T$ in BLAS/LAPACK (but I could easily have missed it).
If the matrix $C$ in $BCB^T$ is symmetric, then another possibility is changing your algorithm to work with symmetric factors of $C$, for instance $C=LDL^T$ with $D$ diagonal. Now to perform your two-sided conjugation you only have to replace $L$ with $BL$.