The formal name of this matrix product

inner-productskronecker productlinear algebramatricestensor-products

Given two $m\times n$ matrices, I want to calculate the sum of the inner product of every pair of rows (or columns) in the two matrices, therefore the result is a real number. This matrix operation looks like below
$$\left(\begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array}\right)(\times)
\left(\begin{array}{cccc}
b_{11} & b_{12} & \cdots & b_{1n}\\
b_{21} & b_{22} & \cdots & b_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
b_{m1} & b_{m2} & \cdots & b_{mn}
\end{array}\right) = \sum_{i=1}^m\sum_{j=1}^m\langle \boldsymbol{a_i}, \boldsymbol{b_j}\rangle$$

I want to know the formal name of this matrix product. I have looked up the definitions of Kronecker product and Frobenius inner product, but this is neither. The value falls between the Frobenius inner product and the sum of the Kronecker product.

Best Answer

$ \def\o{{\tt1}} \def\p{\partial} \def\E{{\cal E}}\def\F{{\cal F}}\def\G{{\cal G}} \def\L{\left}\def\R{\right}\def\LR#1{\L(#1\R)} \def\vec#1{\operatorname{vec}\LR{#1}} \def\diag#1{\operatorname{diag}\LR{#1}} \def\Diag#1{\operatorname{Diag}\LR{#1}} \def\trace#1{\operatorname{Tr}\LR{#1}} \def\qiq{\quad\implies\quad} \def\grad#1#2{\frac{\p #1}{\p #2}} $Consider the product of columns $$\eqalign{ A\;(\times)\;B &= \sum_i\sum_j a_i:b_j \\ &= \sum_i\sum_j \LR{Ae_i}:\LR{Be_j} \\ &= A:B\LR{\sum_i\sum_j e_je_i^T} \\ &= A:BJ \\ &= \trace{A^TBJ} \\ }$$ Here $\{e_k\}$ are the standard basis vectors, $J$ the all-ones matrix, and the symbol $(:)$ denotes the trace/Frobenius product, i.e. $$\eqalign{ A:B &= \sum_{i=1}^m\sum_{j=1}^n A_{ij}B_{ij} \;=\; \trace{A^TB} \\ A:A &= \big\|A\big\|^2_F \\ }$$ Similarly the product of rows would be $$\trace{AB^TJ}$$

Related Question