Can you rearrange this simple Hadamard & Matrix product

hadamard-productmatrices

I have the following matrix operation:

${((AB^T) \odot C)D}$

where juxtaposition denotes the matrix product and $\odot$ the Hadamard product.

A, B & D are all matrices of shape (3, 2) and C is a matrix of shape (3, 3). Is it possible to rearrange/decompose the operation, such as to avoid calculating the matrix product of A and B?
This doesn't work, but something like
${(A \odot C)(B^TD)}$ ?

Best Answer

$\def\B{\Big}\def\L{\left}\def\R{\right}\def\D{\operatorname{Diag}}$Let $\{a_k,b_k\}$ denote the $k^{th}$ columns of $\{A,B\}$, respectively.
Construct diagonal matrices from these column vectors $$\eqalign{ {\cal A}_k &= \D(a_k) \qquad {\cal B}_k = \D(b_k) \\ }$$ Then $$\eqalign{ AB^T &= \sum_{k=1}^2 a_kb_k^T \\ }$$ and the product in question can be expanded as a sum $$\eqalign{ P &= \B(AB^T\odot C\B)D \\ &= \L(\sum_{k=1}^2 a_kb_k^T\odot C\R)D \\ &= \sum_{k=1}^2 {\cal A}_kC{\cal B}_kD \\ &= {\cal A}_1C{\cal B}_1D + {\cal A}_2C{\cal B}_2D \\ }$$ which also eliminates the Hadamard product.

Related Question