# Matrix Trace representation?

For a real, symmetric matrix $A$ and a real, rectangular matrix $X$, am looking for a matrix trace based representation of this simple linear algebraic expression $\sum_{i} A_{ii} ||X_{i.}||_\mathcal{H}^{2}$. Do note that $X_{i.}$ indicates the row $i$ of $X$ and the norm is a Hilbert norm (precisely a RKHS norm).

-

Assuming, the dimensions conform, you will need the hadamard product (element-wise product of two matrices). $trace(A\circ B )$ where $B=XX^T$ and $A\circ B$ denotes hadamard product, should do the job . Note that diagonal entries of $B$ are $||X_i||^2$. If you are insistent over avoiding the hadamard product also, it becomes a bit complicated. Let $\{J_i\}$ be set of all diagonal matrices with +1 or -1 in its diagonal. Note that there are $2^N$ such matrices (assuming dimension is $N\times N$). Now for any matrix $A$, we have \begin{align} D_A=\sum_{i}J_iAJ_i \end{align}
where $D_A$ denotes the diagonal matrix whose diagonal entries are same as that of $A$. Similarly for $B=XX^T$, we have \begin{align} D_B=\sum_{j}J_iBJ_i \end{align}
Note that $[D_A]_{ii}=A_{ii}$ and $[D_B]_{ii}=||X_i||^2$. Thus, the answer will be $trace(D_AD_B)$
What are the off-diagonal entries of $B$ in the Hadamard product setting? In the non-Hadamard setting, is 'each' diagonal entry in $J$ 'either' -1 or 1 (or) are all entries in the diagonal either 1 or -1 and also what is the exact $J$ that we choose from the set ${J_i}$ when you say $trace(D_AD_B)$? Id like a more clearer definition and description. – qlinck Jan 28 '13 at 21:19
The fact that you say $2^N$ gives me an understanding that each entry in the diagonal can be -1 or 1. But the other questions-still remain and require clarity in the answer-i.e, what combination of $J$ do you choose?. – qlinck Jan 28 '13 at 21:48
$[B]_{ij}=<X_i,X_j>$. – dineshdileep Jan 29 '13 at 2:53
$D_A=J_1AJ_1+J_2AJ_2+J_3AJ_3+....J_KAJ_K$ where $K=2^N$. So you have to take all possible $J$'s and then take the sum as above. This will extract the diagonal elements of $A$ alone and will make all off-diagonal entries zero. – dineshdileep Jan 29 '13 at 2:55