  We propose a simple technique that, if combined with algorithms for computing
functions of triangular matrices, can make them more efficient. Basically, such
a technique consists in a specific scaling similarity transformation that
reduces the departure from normality of a triangular matrix, thus decreasing
its norm and in general its function condition number. It can easily be
extended to non-triangular matrices, provided that it is combined with
algorithms involving a prior Schur decomposition. Situations where the
technique should be used or not will be discussed in detail. Special attention
is devoted to particular algorithms like the inverse scaling and squaring to
the matrix logarithm and the scaling and squaring to the matrix exponential.
The advantages of our proposal are supported by theoretical results and
illustrated with numerical experiments.
