def _fractional_power_superdiag_entry(l1, l2, t12, p):
if l1 == l2:<EOL><INDENT>f12 = t12 * p * l1**(p-<NUM_LIT:1>)<EOL><DEDENT>elif abs(l1) < abs(l2) / <NUM_LIT:2> or abs(l2) < abs(l1) / <NUM_LIT:2>:<EOL><INDENT>f12 = t12 * ((l2**p) - (l1**p)) / (l2 - l1)<EOL><DEDENT>else:<EOL><INDENT>z = (l2 - l1) / (l2 + l1)<EOL>log_l1 = np.log(l1)<EOL>log_l2 = np.log(l2)<EOL>arctanh_z = np.arctanh(z)<EOL>tmp_a = t12 * np.exp((p/<NUM_LIT:2>)*(log_l2 + log_l1))<EOL>tmp_u = _unwindk(log_l2 - log_l1)<EOL>if tmp_u:<EOL><INDENT>tmp_b = p * (arctanh_z + np.pi * <NUM_LIT> * tmp_u)<EOL><DEDENT>else:<EOL><INDENT>tmp_b = p * arctanh_z<EOL><DEDENT>tmp_c = <NUM_LIT:2> * np.sinh(tmp_b) / (l2 - l1)<EOL>f12 = tmp_a * tmp_c<EOL><DEDENT>return f12<EOL>
Compute a superdiagonal entry of a fractional matrix power.

This is Eq. (5.6) in [1]_.

Parameters
----------
l1 : complex
    A diagonal entry of the matrix.
l2 : complex
    A diagonal entry of the matrix.
t12 : complex
    A superdiagonal entry of the matrix.
p : float
    A fractional power.

Returns
-------
f12 : complex
    A superdiagonal entry of the fractional matrix power.

Notes
-----
Some amount of care has been taken to return a real number
if all of the inputs are real.

References
----------
.. [1] Nicholas J. Higham and Lijing lin (2011)
       "A Schur-Pade Algorithm for Fractional Powers of a Matrix."
       SIAM Journal on Matrix Analysis and Applications,
       32 (3). pp. 1056-1078. ISSN 0895-4798