

def _remainder_matrix_power(A, t):
    '\n    Compute the fractional power of a matrix, for fractions -1 < t < 1.\n\n    This uses algorithm (3.1) of [1]_.\n    The Pade approximation itself uses algorithm (4.1) of [2]_.\n\n    Parameters\n    ----------\n    A : (N, N) array_like\n        Matrix whose fractional power to evaluate.\n    t : float\n        Fractional power between -1 and 1 exclusive.\n\n    Returns\n    -------\n    X : (N, N) array_like\n        The fractional power of the matrix.\n\n    References\n    ----------\n    .. [1] Nicholas J. Higham and Lijing Lin (2013)\n           "An Improved Schur-Pade Algorithm for Fractional Powers\n           of a Matrix and their Frechet Derivatives."\n\n    .. [2] Nicholas J. Higham and Lijing lin (2011)\n           "A Schur-Pade Algorithm for Fractional Powers of a Matrix."\n           SIAM Journal on Matrix Analysis and Applications,\n           32 (3). pp. 1056-1078. ISSN 0895-4798\n\n    '
    A = np.asarray(A)
    if ((len(A.shape) != 2) or (A.shape[0] != A.shape[1])):
        raise ValueError('input must be a square array')
    (n, n) = A.shape
    if np.array_equal(A, np.triu(A)):
        Z = None
        T = A
    elif np.isrealobj(A):
        (T, Z) = schur(A)
        if (not np.array_equal(T, np.triu(T))):
            (T, Z) = rsf2csf(T, Z)
    else:
        (T, Z) = schur(A, output='complex')
    T_diag = np.diag(T)
    if (np.count_nonzero(T_diag) != n):
        raise FractionalMatrixPowerError('cannot use inverse scaling and squaring to find the fractional matrix power of a singular matrix')
    if (np.isrealobj(T) and (np.min(T_diag) < 0)):
        T = T.astype(complex)
    U = _remainder_matrix_power_triu(T, t)
    if (Z is not None):
        ZH = np.conjugate(Z).T
        return Z.dot(U).dot(ZH)
    else:
        return U

dataset/ETHPy150Open scipy/scipy/scipy/linalg/_matfuncs_inv_ssq.py _remainder_matrix_power/original