Let $f\colon \mathbb R\to\mathbb R$ be a function and $A\in M_n:=Hom(\mathbb R^n,\mathbb R^n)$ a linear operator with real eigenvalues and diagonal Jordan form. Then one naturally defines an operator $f(A)\in M_n$ by diagonalizing $A$ and applying $f$ to each eigenvalue. This yields a map from a subset of $M_n$ to $M_n$. Let me denote this map by $F$ rather than $f$ to avoid confusion.
In many cases $F$ naturally extends to all operators. For example, if $f$ is polynomial then one can substitute any matrix into the polynomial, if $f(x)=e^x$ then there is a matrix exponent, and so on. This gets more complicated with functions like square root, sign, etc, but they still can be applied to large sets of operators.
Is there a general theory for this type of constructions, when $f$ is not necessarily analytic? More precisely,
Question: If $f$ is smooth ($C^1$, $C^\infty$, etc), is $F$ smooth as well?
By the the smoothness of $F$, which is defined on some strange subset of $M_n$, I mean that it has a smooth extension to an open subset of $M_n$. Also, hopefully the smooth extension can be constructed naturally so that it is $GL(n)$-equivariant.
More generally, $f$ may be defined on an open subset of $\mathbb R$ or $\mathbb C$, then $F$ is defined on the set of diagonalizable operators whose eigenvalues all belong to the domain of $f$, and one asks the same question. (In the complex case, $f$ is not assumed analytic, only smooth in the sense of real analysis).
My primary motivation is curiosity, but recently I've run across some special cases of the question in differential geometry and data analysis. I think I can prove that the answer is affirmative if "smooth" is replaced by "locally Lipschitz" and construct a counter-example if "smooth" is replaced by "continuous". From some old papers I got the impression that perhaps this kind of results were well-known long ago, but I could not find any references.
Update. I was wrong about Lipschitz continuity. If $f(x)=|x|$ and $A=\begin{pmatrix} 0 & \varepsilon \\ 0 & 0 \end{pmatrix}$, then $A$ can be approximated by diagonalizable operators with real eigenvalues of either sign, so by continuity one would have to define $F(A)=A$ and $F(A)=-A$ at the same time. This probably means that $C^1$ should be removed from the wishlist and the question makes sense only for $C^\infty$ smoothness.
A type of application that I have in mind is like this: given a smooth family of operators, one wants to apply a function to all of them and keep control over the derivatives. Some interesting functions are $f(z)=\frac{z}{|z|}$ for $z\in\mathbb C\setminus\{0\}$ and non-degenerate operators, or $f$ being a bump function which preserves eigenvalues near some distinguished point and annihilates those that are far away.