In ML applications dealing with categorical variables, it is often required to transform them into a OneHotEncoded representation. For example, given a vector of categorical features, $x=(1,3,4,2,3)^T$, the OneHotEncoded representation is given by
$$ X = \left( \begin{matrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{matrix} \right) . $$
Is it possible to express $X$ analytically in terms of $x$?
Potentially, I am thinking of something analogous to the way vectorization is expressed as a linear sum, but I can't think of a way to turn values of the elements of a vector to corresponding elementary vectors.