I was wondering if anyone knows if an operator that extracts the main diagonal elements of a square matrix exists. I'm interested mainly in the mathematical definition and its properties (not in how to get the diagonal elements using MATLAB).
Thanks!
Edit: As pointed out in comments, it naturally exists. Again, I'm interested in the properties of such an operator. Example: assume that the operator is denoted by $dd\{\bullet\}$ where $\bullet$ is a square matrix. Is there any useful property to compute $dd\{\bullet + \bullet^{-1}\}$, provided that $\bullet^{-1}$ exists?
Operation of obtaining a vector $d$ with components from diagonal of $A$ is done by
$d= \sum\limits_{i=1}^n({e_i}^TAe_i)e_i$
where $e_i$ is the $i$-th unit vector of the standard basis.
Naturally we have
$ \sum\limits_{i=1}^n({e_i}^T(A+B)e_i)e_i= \sum\limits_{i=1}^n({e_i}^TAe_i)e_i + \sum\limits_{i=1}^n({e_i}^TBe_i)e_i$
and
$ \sum\limits_{i=1}^n({e_i}^T(kA)e_i)e_i=k\sum\limits_{i=1}^n({e_i}^T Ae_i)e_i$
so the operation is linear.
The operation can be presented also as
$d= \sum\limits_{i=1}^n(e_i{e_i}^T)Ae_i$ where matrix $P_i=e_i{e_i}^T$ is the orthogonal projection matrix onto the line determined by standard basis vector $e_i$.