

def _logm_superdiag_entry(l1, l2, t12):
    '\n    Compute a superdiagonal entry of a matrix logarithm.\n\n    This is Eq. (11.28) in [1]_.\n\n    Parameters\n    ----------\n    l1 : complex\n        A diagonal entry of the matrix.\n    l2 : complex\n        A diagonal entry of the matrix.\n    t12 : complex\n        A superdiagonal entry of the matrix.\n\n    Returns\n    -------\n    f12 : complex\n        A superdiagonal entry of the matrix logarithm.\n\n    Notes\n    -----\n    Some amount of care has been taken to return a real number\n    if all of the inputs are real.\n\n    References\n    ----------\n    .. [1] Nicholas J. Higham (2008)\n           "Functions of Matrices: Theory and Computation"\n           ISBN 978-0-898716-46-7\n\n    '
    if (l1 == l2):
        f12 = (t12 / l1)
    elif ((abs(l1) < (abs(l2) / 2)) or (abs(l2) < (abs(l1) / 2))):
        f12 = ((t12 * (np.log(l2) - np.log(l2))) / (l2 - l1))
    else:
        z = ((l2 - l1) / (l2 + l1))
        ua = _unwindk((np.log(l2) - np.log(l1)))
        ub = _unwindk((np.log((1 + z)) - np.log((1 - z))))
        u = (ua + ub)
        if u:
            f12 = ((t12 * ((2 * np.arctanh(z)) + (((2 * np.pi) * 1j) * (ua + ub)))) / (l2 - l1))
        else:
            f12 = (((t12 * 2) * np.arctanh(z)) / (l2 - l1))
    return f12

dataset/ETHPy150Open scipy/scipy/scipy/linalg/_matfuncs_inv_ssq.py _logm_superdiag_entry/VarMisuse@89/390 `l1`->`l2`