  Given a matrix-valued function $\mathcal{F}(\lambda)=\sum_{i=1}^d
f_i(\lambda) A_i$, with complex matrices $A_i$ and $f_i(\lambda)$ entire
functions for $i=1,\ldots,d$, we discuss a method for the numerical
approximation of the distance to singularity of $\mathcal{F}(\lambda)$. The
closest singular matrix-valued function $\widetilde{\mathcal{F}}(\lambda)$ with
respect to the Frobenius norm is approximated using an iterative method. The
property of singularity on the matrix-valued function is translated into a
numerical constraint for a suitable minimization problem. Unlike the case of
matrix polynomials, in the general setting of matrix-valued functions the main
issue is that the function $\det ( \widetilde{\mathcal{F}}(\lambda) )$ may have
an infinite number of roots. An important feature of the numerical method
consists in the possibility of addressing different structures, such as
sparsity patterns induced by the matrix coefficients, in which case the search
of the closest singular function is restricted to the class of functions
preserving the structure of the matrices.
