I'm trying to find Hessian of $\text{tr}((AB)' (AB))$ where $A,B$ are matrices. There are nice expressions for $H_{AA}$ and $H_{BB}$ using standard approach from Magnus 1 , can anyone suggest how to do same for $H_{AB}$ and $H_{BA}$ ?
More specifically if $A$ is 2x3 and $B$ is 3x4, then we can vectorize A,B and stack them on top of each other so that we have a function from vectors, and Hessian is a block partitioned matrix with blocks 6x6, 6x12, 12x6 and 12x12 corresponding to $H_{AA}$, $H_{AB}$, $H_{BA}$ and $H_{BB}$
Edit (after following techniques in answer, I get following)
$$H_{AA}=2(BB'\otimes I_2)$$ $$H_{BB}=2(I_4 \otimes A'A)$$ $$H_{AB}=2(B\otimes A)+2 (I_3 \otimes AB)K_{3,4}$$ $$H_{BA}=2(B'A'\otimes I_3)K_{2,3}+2(B'\otimes A')$$
BTW, the Hessian looks as follows when evaluated with all values being 1. Four colors represent values 0,2,4,8 so that $H_{AB}$ consists of just 2's and 8's.
Mathematica code used to generate.
1 (Theorem 1 in 10.6 of Magnus/Nuedecker Matrix Differential Calculus with Applications in Statistics ebook)