Derivative of L-1 norm of matrix Assume you want to find the derivative respect to X ($p \times p$) matrix of 
$$
\frac{\partial}{\partial X} || X - A ||_1
$$
where A is ($p \times p$) matrix.
How can I do it?

Define 
$$\eqalign{
 Y &= (X-A) \cr
 B &= {\rm abs}(Y) \cr
 G &= {\rm signum}(Y) \cr
 B &= Y\odot G \cr
}$$ where the functions are applied element-wise.
Then find the differential and gradient of the norm as
$$\eqalign{
 \phi &= 1:B = 1:Y\odot G = G:Y \cr
d\phi &= G:dY = G:dX \cr
\frac{\partial\phi}{\partial X} &= G = {\rm signum}\big(X-A\big) \cr\cr
}$$
In the above, the symbols {$\,:\,, \odot$} are used to denote the {Frobenius, Hadamard} products, respectively. 
Also note that signum has a discontinuity at zero, where its value jumps between $-1$ and $+1$.
