The three algorithms in this submission solve equations of the form r(X) = A, where r is a rational function and A and X are square matrices of the same size.
The function invrat_horn() implements [1, Algorithm 2] whereas invrat_pow() and invrat_ps() implement [2, Algorithm 3.1] and [2, Algorithm 3.2], respectively.
 M. Fasi and B. Iannazzo. Computing primary solutions of equations involving primary matrix functions. Linear Algebra Appl., 560:17–42, 2019.
 M. Fasi and B. Iannazzo. Substitution algorithms for rational matrix equations. MIMS EPrint 2019.8, Manchester Institute for Mathematical Sciences, The University of Manchester, UK, May 2019.
Massimiliano Fasi (2020). Substitution algorithms for rational matrix equations (https://www.mathworks.com/matlabcentral/fileexchange/74317-substitution-algorithms-for-rational-matrix-equations), MATLAB Central File Exchange. Retrieved .