def expm_cond(A, check_finite=True):
if check_finite:<EOL><INDENT>A = np.asarray_chkfinite(A)<EOL><DEDENT>else:<EOL><INDENT>A = np.asarray(A)<EOL><DEDENT>if len(A.shape) != <NUM_LIT:2> or A.shape[<NUM_LIT:0>] != A.shape[<NUM_LIT:1>]:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>X = scipy.linalg.expm(A)<EOL>K = expm_frechet_kronform(A, check_finite=False)<EOL>A_norm = scipy.linalg.norm(A, '<STR_LIT>')<EOL>X_norm = scipy.linalg.norm(X, '<STR_LIT>')<EOL>K_norm = scipy.linalg.norm(K, <NUM_LIT:2>)<EOL>kappa = (K_norm * A_norm) / X_norm<EOL>return kappa<EOL>
Relative condition number of the matrix exponential in the Frobenius norm.

Parameters
----------
A : 2d array-like
    Square input matrix with shape (N, N).
check_finite : boolean, optional
    Whether to check that the input matrix contains only finite numbers.
    Disabling may give a performance gain, but may result in problems
    (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns
-------
kappa : float
    The relative condition number of the matrix exponential
    in the Frobenius norm

Notes
-----
A faster estimate for the condition number in the 1-norm
has been published but is not yet implemented in scipy.

.. versionadded:: 0.14.0

See also
--------
expm : Compute the exponential of a matrix.
expm_frechet : Compute the Frechet derivative of the matrix exponential.